When compiling tests with bazel with clang on linux, I get a linker error undefined reference to nextafter.
Does the bug persist in the most recent commit?
Yes.
What operating system and version are you using?
Linux. The specifics don't matter because we're using a custom sysroot, described below.
What compiler and version are you using?
clag version 13.0.0 with --sysroot pointing to a sysroot built using crosstool-ng based on centos7.
What build system are you using?
bazel version 5.1.1.
Additional context
This is basically the same bug as #3601, but the fix for that one made the incorrect assumption that this was only a problem on BSD. The correct solution is to change
|
":freebsd": ["-lm", "-pthread"], |
|
":openbsd": ["-lm", "-pthread"], |
|
"//conditions:default": ["-pthread"], |
to be simply
"//conditions:default": ["-lm", "-pthread"],
It won't do any harm when using compilers like gcc which add -lm implicitly, but it will prevent breakage for compilers which do not do this.
When compiling tests with bazel with clang on linux, I get a linker error
undefined reference to nextafter.Does the bug persist in the most recent commit?
Yes.
What operating system and version are you using?
Linux. The specifics don't matter because we're using a custom sysroot, described below.
What compiler and version are you using?
clagversion 13.0.0 with--sysrootpointing to a sysroot built usingcrosstool-ngbased on centos7.What build system are you using?
bazel version 5.1.1.
Additional context
This is basically the same bug as #3601, but the fix for that one made the incorrect assumption that this was only a problem on BSD. The correct solution is to change
googletest/BUILD.bazel
Lines 123 to 125 in 0e40217
to be simply
It won't do any harm when using compilers like gcc which add
-lmimplicitly, but it will prevent breakage for compilers which do not do this.