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

Build problems with macOS Sonoma #66

Open
lpar opened this issue Sep 27, 2023 · 7 comments
Open

Build problems with macOS Sonoma #66

lpar opened this issue Sep 27, 2023 · 7 comments

Comments

@lpar
Copy link

lpar commented Sep 27, 2023

In file included from /Users/meta/Programming/Go/src/github.com/RJVB/afsctool/src/utils.cpp:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/string:537:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__algorithm/max.h:13:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__algorithm/comp_ref_type.h:13:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__debug:16:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/cstddef:46:5: error: <cstddef> tried including <stddef.h> but didn't find libc++'s <stddef.h> header.           This usually means that your header search paths are not configured properly.           The header search paths should contain the C++ Standard Library headers before           any C Standard Library, and you are probably using compiler flags that make that           not be the case.
#   error <cstddef> tried including <stddef.h> but didn't find libc++'s <stddef.h> header. \
    ^

It looks as if stddef.h is in
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stddef.h
rather than
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/stddef.h

i.e. Apple seem to have split the C++ headers into two locations, or stopped supporting C++ in the 14.0 SDK.

There's also a /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/include/ which seems to include both string and stddef.h, and the name suggests it may be appropriate. Unfortunately I don't know enough about Cmake to know how to try it.

@RJVB
Copy link
Owner

RJVB commented Sep 27, 2023 via email

@nichtverstehen
Copy link

This line in CMakeLists.txt adds MacOS SDK dir to the CXX_INCLUDES in the wrong position:

include_directories(${ZLIBP_INCLUDE_DIR})

Not sure what the right solution is, but removing it unblocks compilation.

@RJVB
Copy link
Owner

RJVB commented Oct 22, 2024 via email

@nichtverstehen
Copy link

nichtverstehen commented Oct 22, 2024

> pkg-config --variable=includedir zlib
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include
> pkg-config --cflags zlib

> pkg-config --debug zlib
...
Reading 'zlib' from file '/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/13/zlib.pc'

Perhaps FindZLIBP.cmake should respect cflags or cflags-only-I (empty in this case) instead of trying to extract includedir variable.

@RJVB
Copy link
Owner

RJVB commented Oct 22, 2024 via email

@nichtverstehen
Copy link

> ls -ld /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include
drwxr-xr-x  302 root  wheel  9664 Jul  4 18:08 /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/
> ls -ld /usr/include
ls: /usr/include: No such file or directory

Generally, my machine is a pretty vanilla Sonoma install + Xcode CLT + Xcode 16 + a few Homebrew packages. I didn't create any special symlinks.

The offending arg is -I/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include. It comes from includedir variable of zlib.pc. Here's what my zlib.pc is:

> cat /opt/homebrew/Library/Homebrew/os/mac/pkgconfig/13/zlib.pc
homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
includedir=${prefix}/include

Name: zlib
Description: zlib compression library
Version: 1.2.11

Requires:
Libs: -L${libdir} -L${sharedlibdir} -lz
Cflags:

TBH, I don't know why Homebrew is providing pkgconfig for the system install of zlib.

In any case, most important thing is that the build works for you as the maintainer and there is a workaround for this issue that affects some users.

@RJVB
Copy link
Owner

RJVB commented Oct 23, 2024 via email

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

3 participants