The chromium snap FTBFS with gnome-3-38-2004-sdk in the include path
I'm working on rebasing the chromium snap on core20 and gnome-3-38-2004, and while doing that I came across this problem. The gnome-3-38 snapcraft extension patches $PGK_CONFIG_PATH
to look for .pc files it provides for a number of libraries it bundles, and this results in invokations of the compiler with an added -I/snap/gnome-3-38-2004-sdk/current/usr/include
parameter. With that, I'm getting compilation errors where clang fails to resolve cmath
symbols, e.g.:
In file included from gen/third_party/dawn/src/dawn_native/ProcTable.cpp:8:
In file included from ../../third_party/dawn/src/dawn_native/BindGroup.h:20:
In file included from ../../third_party/dawn/src/dawn_native/BindGroupLayout.h:23:
In file included from ../../third_party/dawn/src/dawn_native/BindingInfo.h:20:
In file included from ../../third_party/dawn/src/dawn_native/Error.h:18:
In file included from ../../third_party/abseil-cpp/absl/strings/str_format.h:76:
In file included from ../../third_party/abseil-cpp/absl/strings/internal/str_format/arg.h:31:
In file included from ../../third_party/abseil-cpp/absl/numeric/int128.h:30:
../../buildtools/third_party/libc++/trunk/include/cmath:321:9: error: no member named 'signbit' in the global namespace; did you mean '__signbit'?
using ::signbit;
~~^
/usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h:25:20: note: '__signbit' declared here
__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value))
^
When invoked with the -H
switch, clang shows how includes are resolved in this case:
. ../../third_party/dawn/src/dawn_native/BindGroup.h
.. ../../third_party/dawn/src/dawn_native/BindGroupLayout.h
... ../../third_party/dawn/src/dawn_native/BindingInfo.h
.... ../../third_party/dawn/src/dawn_native/Error.h
..... ../../third_party/abseil-cpp/absl/strings/str_format.h
...... ../../third_party/abseil-cpp/absl/strings/internal/str_format/arg.h
....... ../../third_party/abseil-cpp/absl/numeric/int128.h
........ ../../buildtools/third_party/libc++/trunk/include/cmath
......... /snap/gnome-3-38-2004-sdk/current/usr/include/math.h
.......... /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
.......... /usr/include/x86_64-linux-gnu/bits/math-vector.h
........... /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h
.......... /usr/include/x86_64-linux-gnu/bits/flt-eval-method.h
.......... /usr/include/x86_64-linux-gnu/bits/fp-logb.h
.......... /usr/include/x86_64-linux-gnu/bits/fp-fast.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
.......... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
.......... /usr/include/x86_64-linux-gnu/bits/iscanonical.h
.......... /usr/include/x86_64-linux-gnu/bits/mathinline.h
Now if I manually modify the invokation to use -cxx-isystem/snap/gnome-3-38-2004-sdk/current/usr/include
instead of the regular -I
flag, compilation of that specific unit succeeds, and includes are resolved differently:
. ../../third_party/dawn/src/dawn_native/BindGroup.h
.. ../../third_party/dawn/src/dawn_native/BindGroupLayout.h
... ../../third_party/dawn/src/dawn_native/BindingInfo.h
.... ../../third_party/dawn/src/dawn_native/Error.h
..... ../../third_party/abseil-cpp/absl/strings/str_format.h
...... ../../third_party/abseil-cpp/absl/strings/internal/str_format/arg.h
....... ../../third_party/abseil-cpp/absl/numeric/int128.h
........ ../../buildtools/third_party/libc++/trunk/include/cmath
......... ../../buildtools/third_party/libc++/trunk/include/math.h
.......... /snap/gnome-3-38-2004-sdk/current/usr/include/math.h
........... /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
........... /usr/include/x86_64-linux-gnu/bits/math-vector.h
............ /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h
........... /usr/include/x86_64-linux-gnu/bits/flt-eval-method.h
........... /usr/include/x86_64-linux-gnu/bits/fp-logb.h
........... /usr/include/x86_64-linux-gnu/bits/fp-fast.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
........... /usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h
........... /usr/include/x86_64-linux-gnu/bits/iscanonical.h
........... /usr/include/x86_64-linux-gnu/bits/mathinline.h
This reveals that the snap include path trips up clang and buildtools/third_party/libc++/trunk/include/cmath
resolves the <math.h>
include as /snap/gnome-3-38-2004-sdk/current/usr/include/math.h
instead of buildtools/third_party/libc++/trunk/include/math.h
.