-
Notifications
You must be signed in to change notification settings - Fork 29
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
manylinux2014/centos cross-compilation relying on symbols not present on musl systems #42
Comments
Updated desc with more details about how to reproduce. |
Thank you @flavorjones for your great analysis and the patch! I took a look at the libc definitions and found this. Definition in # define isnan(x) \
(sizeof (x) == sizeof (float) \
? __isnanf (x) \
: sizeof (x) == sizeof (double) \
? __isnan (x) : __isnanl (x)) And it defines the glibc library reference int __isnan(double) __attribute__ ((__const__)); Definition in # define isnan(x) __builtin_isnan (x) In musl it is defined without external function calls #define isnan(x) ( \
sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 : \
sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52 : \
__fpclassifyl(x) == FP_NAN) |
which when compiled on Centos reference functions that are not defined in musl libc. Related to rake-compiler#42
which when compiled on Centos reference functions that are not defined in musl libc. Related to rake-compiler#42
which when compiled on Centos reference functions that are not defined in musl libc. Related to rake-compiler#42
Please describe the bug
See sparklemotion/nokogiri#2142 for background and conversation about this.
When compiling C code that calls
isnan
orisinf
, code compiled on Debian systems previously implemented this via macros (not function calls). But on the manylinux2014 system, unresolved symbols appear in the shared library for__isinf@@GLIBC_2.2.5
and__isnan@@GLIBC_2.2.5
. These can be resolved on Debian linux systems, but not on musl linux systems.Help us reproduce what you're seeing
Cross-compile nokogiri without the libxml2 patch
patches/libxml2/0009-avoid-isnan-isinf.patch
, and run the test suite in an alpine image. You can also provide--prevent-strip
to nokogiri's extconf.rb to avoid stripping debugging symols.Specifically, here's what I do to reproduce this:
--prevent-strip
to the cross-config-options in nokogiri'srakelib/cross-ruby.rake
patches/libxml2/0009-avoid-isnan-isinf.patch
rake gem:x86_64-linux
to build a gem usingmanylinux2014
in thepkg/
subdirdocker run -it --mount=type=bind,source=$(pwd),target=/nokogiri flavorjones/nokogiri-test:alpine /bin/bash
cd /nokogiri
gem install --local pkg/nokogiri*linux*gem
rake test
orrake test:gdb
nm /usr/local/bundle/gems/nokogiri-1.11.0.rc4-x86_64-linux/lib/nokogiri/3.0/nokogiri.so
to see the unresolved symbolsI can help with this if you need more information.
Expected behavior
I think I expect the centos system to generate the same unresolved symbols as the previous debian system did. If it's possible to set CPP flags to make this work, I'd be happy to set them -- I've tried a bunch of things like
-D_ISOC99_SOURCE
and-D_XOPEN_SOURCE=600
but wasn't able to change the fact that centos's glibc seems to turn it into a function call under the hood.The text was updated successfully, but these errors were encountered: