-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Unable to make Boost include directory a system directory on macOS because /usr/local/include precedes it #8755
Comments
More bugs caused by and only affecting people who misuse and abuse -isystem as "not system, but as a side effect please don't emit warnings for this messy dependency"... |
No, |
The bug where Meson removes
The
The only way I can see to identify this is to parse the command line that On Ubuntu it has
|
Describe the bug
The Boost header files contain issues that are reported as compiler warnings (and then promoted to errors, stopping the build).
To avoid this the dependency can be set as
include_type: 'system'
.On macOS with Homebrew, Boost is available in both
/usr/local/Cellar/boost/1.74.0
and/usr/local
(the latter being symlinks to the former). The compiler has-I/usr/local
as a built-in include directory and this is used before-isystem/usr/local/Cellar/boost/1.74.0
. The result is that compilation fails because it uses the headers in/usr/local
and for some inexplicable reason despite being a built-in location this is not considered a system directory by the compiler.To attempt to resolve that, I tried to use
/usr/local
as theBOOST_ROOT
but Meson ignores the Boost in/usr/local
becausemesonbuild/dependencies/boost.py
explicitly ignores symlinks when checking for the libraries (if not i.is_file() or i.is_symlink():
).Fixing that problem (by removing the symlink check) then results in another problem because Meson is filtering out the
-isystem/usr/local/include
include somewhere (it doesn't appear on the compiler command line). The compiler then continues to use/usr/local/include
as a non-system directory and complains about issues in the header files.There are multiple issues here:
/usr/local
despite all the libraries being symlinks, as long as the links can be dereferenced to files./usr/local/include
as a built-in include but not as a system include.-I/usr/local/include
before-isystem/usr/local/Cellar/boost/1.74.0/include
and there is no way around this. Anything in-I
(built-in or not) is ordered before-isystem
. Anything specified as both-isystem
and-I
only gets added as-isystem
.-isystem/usr/local
to the compiler command line if that's specified inCFLAGS
/CXXFLAGS
orc_args
/cpp_args
in themeson.build
file.-isystem/usr/local
to the compiler command line if that's the location of the dependency andinclude_type: 'system'
is set.Issue 4 should be fixed. Currently I can't override Meson by setting
CXXFLAGS
orcpp_args
. It's removing my'-isystem/usr/local/include'
. I have to use'-isystem//usr/local/include/'
or'-isystem/usr/local/include/'
to trick it (this works because clang is normalising the path before using it).Fixing issues 1 and 5 would allow the build to succeed, but it would not be possible to override the location of Boost as a system include. To get clang to use
/usr/local/Cellar/boost/1.74.0/include
as a system directory,/usr/local/include
must also be specified as a system directory so that it doesn't take precedence in the search order:-isystem/usr/local/Cellar/boost/1.74.0 -isystem/usr/local/include
.Fixing issue 1 without also fixing issue 5 would make it impossible to use
-isystem
with Boost in the default/usr/local/include
location.This isn't a problem with gcc or non-Apple clang because
-isystem
always comes before built-in directories (and they don't have broken built-in search paths).To Reproduce
/usr/local/include/boost
is a link to../Cellar/boost/1.74.0/include/boost
/usr/local/lib/libboost*
are links to../Cellar/boost/1.74.0/lib/libboost_*
e93ffcc1ab0a102b39c6ecfd7acfb04605d03c53
Expected behavior
The build is successful because the compiler warnings for the Boost headers are ignored. If the Boost headers are not in the compiler built-in include directories then they must be preferred.
system parameters
The text was updated successfully, but these errors were encountered: