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

macOS 10.15 Apple clang 12.0.0 build failed #7264

Closed
knell opened this issue Feb 8, 2023 · 22 comments
Closed

macOS 10.15 Apple clang 12.0.0 build failed #7264

knell opened this issue Feb 8, 2023 · 22 comments
Milestone

Comments

@knell
Copy link

knell commented Feb 8, 2023

Xcode 12.4
% g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix

src/thread/pthread/SDL_systhread.c:151:52: error: too many arguments to function call, expected 1, have 2
if (pthread_setname_np(pthread_self(), name) == ERANGE) {
~~~~~~~~~~~~~~~~~~

pthread_setname_np() accepts only one argument 'name' on this platform

@slime73
Copy link
Contributor

slime73 commented Feb 10, 2023

That file has an Apple-specific path via the preprocessor to make sure pthread_setname_np is only called with a single argument, but it seems your build setup doesn't think it's compiling for macOS (or maybe it thinks the system doesn't have dlopen, which is always available on macOS).

So I guess it's a local build setup issue?

@knell
Copy link
Author

knell commented Feb 11, 2023

Well, tbh, I have no idea, it's just clean xcode with no anything installed, build ran using cmake. I have just downloaded last 2.26.3 version and tried to build, previous version was building with no issues.

@sridenour
Copy link
Contributor

Have you tried using the Xcode project that SDL ships with?

@slouken
Copy link
Collaborator

slouken commented Nov 8, 2023

I think this is an issue with the older toolchain. I don't have access to that here, but I'll leave this bug open in case someone else comes along and has a patch to fix this. @Wohlstand?

@Wohlstand
Copy link
Contributor

Wohlstand commented Nov 8, 2023

I have several virtual machines with the stuff, I could make a shot.

@slouken slouken added the waiting Waiting on user response label Mar 3, 2024
@slouken slouken added this to the 3.2.0 milestone May 23, 2024
@slouken
Copy link
Collaborator

slouken commented Oct 6, 2024

No response, I'll go ahead and close this for now. Please let us know if it's still an issue.

@slouken slouken closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2024
@slouken slouken removed the waiting Waiting on user response label Oct 6, 2024
@Wohlstand
Copy link
Contributor

Huh, I just forgot about this one... I'll try to test some on my VMs very soon.

@Wohlstand
Copy link
Contributor

Okay, for a test purposes, I installed the same Xcode version to the Catalina VM, and the same CLang version:

Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

SDL2 branch has been built successfully via CMake and make. Now testing other ways and SDL3...

@Wohlstand
Copy link
Contributor

SDL3 is also built successfully with CMake build. Now let me try Xcode builds...

@Wohlstand
Copy link
Contributor

Via Xcode latest SDL2 branch builds fine:
изображение

However, SDL3 won't open with THIS Xcode 12.4:
изображение

Then, sounds like the problem is completely local.

Anyway, I found that it used the SDK for 11.1 rather than for 10.15:
изображение

And then, I tried to build SDL3 with:

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/ -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 ..

And then it fails at other places:

[ 38%] Building C object CMakeFiles/SDL3-shared.dir/src/SDL_properties.c.o
/Users/vitaly/Repos/SDL3/src/gpu/metal/SDL_gpu_metal.m:89:5: error: 'MTLPixelFormatB5G6R5Unorm' is unavailable: not available on macOS
    MTLPixelFormatB5G6R5Unorm,  // B5G6R5_UNORM
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLPixelFormat.h:43:5: note: 'MTLPixelFormatB5G6R5Unorm' has been explicitly marked unavailable here
    MTLPixelFormatB5G6R5Unorm API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos, macCatalyst) = 40,
    ^
/Users/vitaly/Repos/SDL3/src/gpu/metal/SDL_gpu_metal.m:90:5: error: 'MTLPixelFormatBGR5A1Unorm' is unavailable: not available on macOS
    MTLPixelFormatBGR5A1Unorm,  // B5G5R5A1_UNORM
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLPixelFormat.h:46:5: note: 'MTLPixelFormatBGR5A1Unorm' has been explicitly marked unavailable here
    MTLPixelFormatBGR5A1Unorm API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos, macCatalyst) = 43,
    ^
/Users/vitaly/Repos/SDL3/src/gpu/metal/SDL_gpu_metal.m:91:5: error: 'MTLPixelFormatABGR4Unorm' is unavailable: not available on macOS
    MTLPixelFormatABGR4Unorm,   // B4G4R4A4_UNORM
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLPixelFormat.h:45:5: note: 'MTLPixelFormatABGR4Unorm' has been explicitly marked unavailable here
    MTLPixelFormatABGR4Unorm  API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos, macCatalyst) = 42,
    ^
/Users/vitaly/Repos/SDL3/src/gpu/metal/SDL_gpu_metal.m:3862:39: error: no known instance method for selector 'supportsBCTextureCompression'
                    [renderer->device supportsBCTextureCompression] &&
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 38%] Building C object CMakeFiles/SDL3-shared.dir/src/SDL_utils.c.o
/Users/vitaly/Repos/SDL3/src/gpu/metal/SDL_gpu_metal.m:4086:51: error: use of undeclared identifier 'kCGColorSpaceITUR_2100_PQ'; did you mean 'kCGColorSpaceITUR_2020_PQ'?
            SwapchainCompositionToColorSpace[3] = kCGColorSpaceITUR_2100_PQ;
                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~
                                                  kCGColorSpaceITUR_2020_PQ
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColorSpace.h:134:29: note: 'kCGColorSpaceITUR_2020_PQ' declared here
CG_EXTERN const CFStringRef kCGColorSpaceITUR_2020_PQ
                            ^
5 errors generated.
make[2]: *** [CMakeFiles/SDL3-shared.dir/src/gpu/metal/SDL_gpu_metal.m.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/Users/vitaly/Repos/SDL3/src/dialog/cocoa/SDL_cocoadialog.m:25:9: fatal error: 'UniformTypeIdentifiers/UTType.h' file not found
#import <UniformTypeIdentifiers/UTType.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

@slouken
Copy link
Collaborator

slouken commented Oct 8, 2024

From the SDL3 README-macos.md:
Please note that building SDL requires at least Xcode 12.2 and the 11.0 SDK.

You should be able to tweak the Xcode version in the project to open it and build with the older Xcode. I don't know what version should be put there though.

@Wohlstand
Copy link
Contributor

I just changed the objectVersion to the 54 in a VSCode, and it opens.

@Wohlstand
Copy link
Contributor

And now it fails on "3 duplicated symbols"
изображение

@slouken
Copy link
Collaborator

slouken commented Oct 8, 2024

I've updated the project so it should build on Xcode 12.

@Wohlstand
Copy link
Contributor

Ye, it opens and builds, but the build at final just fails for the in-code problem.

@slouken
Copy link
Collaborator

slouken commented Oct 8, 2024

What's an "in-code" problem?

@Wohlstand
Copy link
Contributor

What's an "in-code" problem?

In my screenshot, you can see that it attempts to link both cocoa and dummy dialogue related modules, and the thing fails to link because of function names collision.

@slouken
Copy link
Collaborator

slouken commented Oct 8, 2024

Did you update? I fixed that.

@Wohlstand
Copy link
Contributor

Let me try that... Not yet, and I powered off my VM for now, going to boot it again...

@Wohlstand
Copy link
Contributor

Okay, now it builds just fine!
изображение

@slouken
Copy link
Collaborator

slouken commented Oct 8, 2024

Yay! Thanks!

@Wohlstand
Copy link
Contributor

I am glad to verify that! Have a good time!

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

No branches or pull requests

5 participants