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

Broken --enable-suppress-external-warning for Apple Clang 15 on x86_64 #29174

Closed
hebasto opened this issue Jan 4, 2024 · 4 comments · Fixed by #29195
Closed

Broken --enable-suppress-external-warning for Apple Clang 15 on x86_64 #29174

hebasto opened this issue Jan 4, 2024 · 4 comments · Fixed by #29195

Comments

@hebasto
Copy link
Member

hebasto commented Jan 4, 2024

Apple Clang 15 does not support -Xclang -internal-isystem anymore. On both x86_64 and arm64 platforms, the following check:

bitcoin/configure.ac

Lines 742 to 744 in 65c05db

if test "$suppress_external_warnings" != "no"; then
AX_CHECK_PREPROC_FLAG([-Xclang -internal-isystem/usr/local/include], [CORE_CPPFLAGS="$CORE_CPPFLAGS -Xclang -internal-isystem/usr/local/include"], [], [$CXXFLAG_WERROR])
fi

fails with error: unknown argument: '-internal-isystem/usr/local/include'.

It makes the --enable-suppress-external-warnings option not working for dependency packages installed by Homebrew and linked to /usr/local, which happens for all non-keg packages on x86_64. There is no such an effect on arm64.

For a related discussion refer to #29165 (comment).

@fanquake
Copy link
Member

fanquake commented Jan 4, 2024

fails with error: unknown argument: '-internal-isystem/usr/local/include'

Can this be investigated further. The -Xclang and -internal-isystem options still exist in Clang. Is the issue here just the concatenation? Maybe that worked previously, but no-longer does? What happens if you change -Xclang -internal-isystem/usr/local/include to -Xclang -internal-isystem /usr/local/include?

@hebasto
Copy link
Member Author

hebasto commented Jan 4, 2024

Here are more details:

% clang -cc1 --help | grep -A 1 internal-isystem
  -internal-isystem <directory>
                          Add directory to the internal system include search path; these are assumed to not be user-provided and are used to model system and standard headers' paths.

Is the issue here just the concatenation? Maybe that worked previously, but no-longer does? What happens if you change -Xclang -internal-isystem/usr/local/include to -Xclang -internal-isystem /usr/local/include?

% clang++ -Xclang -internal-isystem /usr/local/include hello.cpp       
ld: file cannot be mmap()ed, errno=22 path=/usr/local/include in '/usr/local/include'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@hebasto
Copy link
Member Author

hebasto commented Jan 7, 2024

According to Wikipedia, the Apple clang version 15.0.0 (clang-1500.0.40.1) corresponds to LLVM clang 16.0.0.

On Ubuntu 23.10:

$ clang++-16 -Xclang -internal-isystem/usr/local/include test.cpp 
error: unknown argument: '-internal-isystem/usr/local/include'  # Same for clang++-17.

However,

$ clang++-15 -Xclang -internal-isystem/usr/local/include test.cpp  # Works.

@hebasto
Copy link
Member Author

hebasto commented Jan 7, 2024

Fixed in #29195.

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

Successfully merging a pull request may close this issue.

3 participants