Open madebr opened 4 years ago
I have the exact same issue when building a shared library depending on CGAL & MPIR.
I greped the source code and found that some NASM assembly code using %ifdef PIC
./mpn/x86_64w/sqr_basecase.asm:11: %ifdef PIC
./mpn/x86_64w/sqr_basecase.asm:20: %ifdef PIC
./mpn/x86_64/netburst/sub_n.as:122:%ifdef PIC
./mpn/x86_64/netburst/sub_n.as:134:%ifdef PIC
./mpn/x86_64/netburst/add_n.as:122:%ifdef PIC
./mpn/x86_64/netburst/add_n.as:134:%ifdef PIC
./mpn/x86_64/modexact_1c_odd.as:107:%ifdef PIC
but build system doesn't pass -D PIC
to yasm command, so we make sure -D PIC
is passed to yasm command by:
YASM="$(command -v yasm)"
cat > yasm <<EOF
#!/bin/sh
exec "$YASM" -D PIC "\$@"
EOF
chmod +x yasm
export PATH="$PWD:$PATH"
resolved this problem.
Building a shared z3 library with mpir as a replacement for gmp fails because
__gmp_modlimb_invert_table
does not support relocation.The link error is:
Reference to the source: https://github.com/wbhart/mpir/blob/master/mpn/x86_64/modexact_1c_odd.as#L58-L88