Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
347 stars 231 forks source link

Error linking with libquadmath #2682

Closed mahrud closed 1 year ago

mahrud commented 2 years ago

I kept getting linking errors for a while, and I just noticed that it's also causing issues building brew bottles on ubuntu:

/home/linuxbrew/.linuxbrew/opt/binutils/bin/ld: Macaulay2/d/CMakeFiles/M2-interpreter.dir/boostmath-tmp.cc.o: undefined reference to symbol 'ldexpq@@QUADMATH_1.0'
/home/linuxbrew/.linuxbrew/opt/binutils/bin/ld: /home/linuxbrew/.linuxbrew/opt/gcc/lib/gcc/current/libquadmath.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

On my machine linking with quadmath resolves this, but apparently this fails on MacOS. @d-torrance any ideas what might be behind this?

d-torrance commented 2 years ago

Does defining the BOOST_MATH_DISABLE_FLOAT128 macro help at all? We use MFPR for all the Boost special functions, so there's no reason to link against libquadmath for 128-bit floats.

mahrud commented 2 years ago

It doesn't seem like it. Can you try seeing if your executables are linked with libquadmath, and if so does passing that actually remove it?

d-torrance commented 1 year ago

I was able to reproduce this using brew's Boost, which is version 1.80. The Debian/Ubuntu packages are still at 1.74, which is probably why I never saw this (plus the autotools build was already adding -lquadmath to the linker flags -- I'm not 100% sure why...)

This is https://github.com/boostorg/math/issues/733, and linking with -lquadmath appears to be the correct solution.

mahrud commented 1 year ago

Not the ideal fix, and I'm not sure if it is universal, but closing this for now.