Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build on 10.6.x for ppc #13

Closed
wants to merge 1 commit into from
Closed

Conversation

barracuda156
Copy link

Fixes: #12

@enzo1982
Copy link
Owner

I think this not the correct way to fix this.

The MacOS X 10.6 SDK defines the kAudioFormatMPEG4AAC_ELD constant, see here. So if it is not defined in your build, you must be using earlier headers (probably from the MacOS X 10.5 SDK). However, when using earlier headers, you should not set the target OS version to 10.6 which causes MAC_OS_X_VERSION_10_6 to be defined.

Ideally, set the target to 10.5 in your build and this should not be an issue. Setting the MACOSX_DEPLOYMENT_TARGET environment variable to 10.5 may already be enough to fix this.

The other option would be to make sure you actually build using the 10.6 SDK which defines kAudioFormatMPEG4AAC_ELD. I would not recommend this, though, as this could easily produce binaries that won't run on 10.5 due to dependencies on 10.6 features.

@barracuda156
Copy link
Author

First of all, there are two cases of 10.6/ppc: native developer build 10A190 (last one known to run on PPC) and Rosetta from 10.6.x releases. 10A190 does use earlier headers, which is nevertheless 10.6 version, not 10.5.
However, the same symbol error is observed on 10.6.8 Rosetta, which has standard headers.
Maybe something makes it defined only for Intel, despite a mention in that CoreAudio file?

Using older SDK is a hack: I think it is a fallback when nothing works and results in suboptimal build, but here a native one works fine with a one line tweak.
If there is any concern of a conflict, maybe define it when it is otherwise undefined?

@enzo1982
Copy link
Owner

So I tried this in a MacOS X 10.6 VM and figured out what happens:

The 10.6 SDK that comes with Xcode 3.2.6 indeed contains a CoreAudioTypes.h that does not define the kAudioFormatMPEG4AAC_ELD constant. Yet the COREAUDIOTYPES_VERSION macro value is 1051 just like in the version I linked above which does define that constant.

The 10.6 SDK that comes with Xcode 4.2 has the kAudioFormatMPEG4AAC_ELD constant, so it was added at some point between Xcode 3.2.6 and 4.2, but without incrementing the value of COREAUDIOTYPES_VERSION.

Because the COREAUDIOTYPES_VERSION macro is the same, there is no way to check whether the constant is defined (it's an enum value, so it cannot be checked with #ifdef).

Checking whether we are building for PPC like in this PR is not an option either. The issue applies to any architecture when using Xcode 3.2.6.

The only idea I have right now for solving this is using a different name for that constant.

However, using the 10.5 SDK as suggested before avoids the issue. This can be achieved by adding the -isysroot option to CXXFLAGS, but maybe MacPorts has a simpler way to specify the build SDK. In any case, adding -isysroot /Developer/SDKs/MacOSX10.5.sdk fixes the issue for me.

@barracuda156
Copy link
Author

@enzo1982 I see, thank you for investigating. Then perhaps worth fixing this even more so? While ppc on 10.6.x is a rather exotic case, Xcode 3.2.6 on 10.6.x is standard, and AFAIU far more common than 4.2 (which was a paid version).

@enzo1982
Copy link
Owner

Yes, I will change the names of the three constants to be able to use them independent of the MacOS X SDK. That should fix the issue.

enzo1982 added a commit that referenced this pull request May 15, 2023
Xcode 3.2.6 comes with a MacOS X 10.6 SDK that doesn't define the kAudioFormatMPEG4AAC_ELD enum value while newer versions of the SDK shipped with Xcode 4.x define it.

To avoid breakage when building with Xcode 3.2.6 (which is the last version that supported PPC builds), rename the fallback definitions so they work regardless of the SDK defining the enum values or not.

See issue #12 and PR #13 on GitHub.
@enzo1982
Copy link
Owner

Pushed commit 4ea79d5 to fix this.

@barracuda156
Copy link
Author

Pushed commit 4ea79d5 to fix this.

Fixed with that, closing. Thank you!

@barracuda156 barracuda156 deleted the ppc branch May 16, 2023 02:19
@enzo1982
Copy link
Owner

Fixed with that, closing. Thank you!

Thank you for being so persistent on this! Wouldn't have figured out the actual cause of the issue otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build is broken for PPC
2 participants