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

CMake build, failure on linking: #1982

Closed kschwede closed 3 years ago

kschwede commented 3 years ago

This has been going on a few weeks (WSL2, Ubuntu 20.04), which is why I tried compiling in the classical way. I'm following the instructions in INSTALL-Cmake.md

@mahrud what should I try?

schwede@2021AMD:~/M2CMake/M2/M2/BUILD/build$ ninja M2-binary M2-core
[1/2] Linking CXX executable usr-dist/x86_64-Linux-Ubuntu-20.04/bin/M2-binary
FAILED: usr-dist/x86_64-Linux-Ubuntu-20.04/bin/M2-binary
: && /usr/bin/c++  -O3 -DNDEBUG  -march=native -g3 -L/home/schwede/M2CMake/M2/M2/BUILD/build/usr-host/lib -fopenmp Macaulay2/d/CMakeFiles/M2-interpreter.dir/M2types.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/M2lib.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/M2mem.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/scclib.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/memdebug.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/debug.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/gmp_aux.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/gdbm_interface.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/arithmetic-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/atomic-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/M2-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/system-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/strings-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/varstrin-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/strings1-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/errio-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/vararray-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/ctype-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/nets-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/varnets-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/interrupts-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/pthread0-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/stdiop0-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/gmp-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/engine-tmp.cc.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/xml-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/stdio0-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/parse-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/expr-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/stdio-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/stdiop-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/err-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/gmp1-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/tokens-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/getline-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/lex-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/parser-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/binding-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/basic-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/convertr-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/common-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/util-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/struct-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/classes-tmp.cc.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/buckets-tmp.cc.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/equality-tmp.cc.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/hashtables-tmp.cc.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/regex-tmp.cc.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/sets-tmp.cc.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/evaluate-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/mysqldummy-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/pthread-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/actors-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/actors2-tmp.cc.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/actors3-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/actors4-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/xmlactors-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/actors5-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/actors6-tmp.cc.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/threads-tmp.cc.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/interface-tmp.cc.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/interface2-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/texmacs-tmp.c.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/interp-tmp.cc.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/version-tmp.cc.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/boost-regex.cpp.o Macaulay2/d/CMakeFiles/M2-interpreter.dir/xml-c.c.o Macaulay2/system/CMakeFiles/M2-supervisor.dir/supervisor.cpp.o Macaulay2/system/CMakeFiles/M2-supervisor.dir/m2file.cpp.o Macaulay2/system/CMakeFiles/M2-supervisor.dir/tests.cpp.o Macaulay2/bin/CMakeFiles/M2-binary.dir/timestamp.cpp.o Macaulay2/bin/CMakeFiles/M2-binary.dir/main.cpp.o Macaulay2/bin/CMakeFiles/M2-binary.dir/startup.c.o  -o usr-dist/x86_64-Linux-Ubuntu-20.04/bin/M2-binary  -Wl,-rpath,:::::::::::::::::::::::::::::::::::::::  /usr/lib/x86_64-linux-gnu/libboost_stacktrace_backtrace.so.1.71.0  Macaulay2/e/libM2-engine.a  -ldl  -lpthread  /usr/lib/x86_64-linux-gnu/libboost_regex.so.1.71.0  /usr/lib/x86_64-linux-gnu/libblas.so  /usr/lib/x86_64-linux-gnu/liblapack.so  /usr/lib/x86_64-linux-gnu/libgivaro.so  usr-host/lib/libmps.a  usr-host/lib/libmathicgb.a  /usr/lib/x86_64-linux-gnu/libmathic.so  /usr/lib/x86_64-linux-gnu/libmemtailor.so  /usr/lib/x86_64-linux-gnu/libfrobby.so  /usr/lib/x86_64-linux-gnu/libsingular-factory.so  usr-host/lib/libflint.a  /usr/lib/x86_64-linux-gnu/libntl.so  /usr/lib/x86_64-linux-gnu/libmpfr.so  /usr/lib/x86_64-linux-gnu/libgmpxx.so  /usr/lib/x86_64-linux-gnu/libgmp.so  /usr/lib/x86_64-linux-gnu/libgc.so  /usr/lib/x86_64-linux-gnu/libopenblas.so
  /usr/lib/x86_64-linux-gnu/libtbb.so  /usr/lib/x86_64-linux-gnu/libxml2.so  /usr/lib/x86_64-linux-gnu/libreadline.so  /usr/lib/x86_64-linux-gnu/libhistory.so  /usr/lib/x86_64-linux-gnu/libgdbm.so  /usr/lib/x86_64-linux-gnu/libatomic_ops.a  /usr/lib/gcc/x86_64-linux-gnu/9/libgomp.so  /usr/lib/x86_64-linux-gnu/libpthread.so && cd /home/schwede/M2CMake/M2/M2/BUILD/build/Macaulay2/bin && /usr/bin/cmake -E echo --\ Linked\ libraries: && LD_LIBRARY_PATH=/home/schwede/M2CMake/M2/M2/BUILD/build/usr-host/lib:/usr/lib /usr/bin/ldd /home/schwede/M2CMake/M2/M2/BUILD/build/usr-dist/x86_64-Linux-Ubuntu-20.04/bin/M2-binary && /usr/bin/cmake -E echo --\ INSTALL_RPATH:\ /usr/lib/x86_64-linux-gnu/Macaulay2/lib
/usr/bin/ld: Macaulay2/d/CMakeFiles/M2-interpreter.dir/boost-regex.cpp.o: in function `boost::cpp_regex_traits<char>::transform_primary(char const*, char const*) const':
/usr/include/boost/regex/v4/cpp_regex_traits.hpp:966: undefined reference to `boost::re_detail_107100::cpp_regex_traits_implementation<char>::transform_primary(char const*, char const*) const'
/usr/bin/ld: Macaulay2/d/CMakeFiles/M2-interpreter.dir/boost-regex.cpp.o: in function `boost::cpp_regex_traits<char>::transform(char const*, char const*) const':
/usr/include/boost/regex/v4/cpp_regex_traits.hpp:962: undefined reference to `boost::re_detail_107100::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
mahrud commented 3 years ago

There's an entry in the CMake FAQ about this. Try uninstalling fflas_ffpack and givaro and building those, or just run:

cmake -DBUILD_LIBRARIES="Givaro;FFLAS_FFPACK" .
ninja build-libraries

and try again.

mahrud commented 3 years ago

@d-torrance it would really help a lot if you could patch the ubuntu package for fflas_ffpack and givaro. I believe sage people have the same issue when building with fflas_ffpack and openmp.

The upstreams of those packages are already patched, they just haven't made a release in a year or two.

kschwede commented 3 years ago

Thanks!

d-torrance commented 3 years ago

@d-torrance it would really help a lot if you could patch the ubuntu package for fflas_ffpack and givaro. I believe sage people have the same issue when building with fflas_ffpack and openmp.

Both Debian and Ubuntu are in freeze right now, but I'll work on this after that. In the meantime, I could package a git snapshot for the PPA, so at least it would be available for our Github builds and users. We'd be looking at Ubuntu 21.10 and Debian 12 at the earliest as the first official releases that would contain a fix.

Also, is it possible for the CMake build to do what the autotools build currently does and strip out everything but the include directories from the flags? That would make the build work even with the current fflas-ffpack packages, I believe.

https://github.com/Macaulay2/M2/blob/f0ce581750dfd94336883695d3552671410f32f5/M2/configure.ac#L1331

mahrud commented 3 years ago

A patched version on PPA sounds excellent.

Also, is it possible for the CMake build to do what the autotools build currently does and strip out everything but the include directories from the flags? That would make the build work even with the current fflas-ffpack packages, I believe.

That's a hack. This is all CMake needs to handle fflas_ffpack and givaro: https://github.com/Macaulay2/M2/blob/f0ce581750dfd94336883695d3552671410f32f5/M2/cmake/check-libraries.cmake#L10 https://github.com/Macaulay2/M2/blob/f0ce581750dfd94336883695d3552671410f32f5/M2/cmake/check-libraries.cmake#L136-L137 https://github.com/Macaulay2/M2/blob/f0ce581750dfd94336883695d3552671410f32f5/M2/Macaulay2/d/CMakeLists.txt#L160-L164

mahrud commented 3 years ago

Thanks!

No problem. Let me know if this doesn't resolve the issue.

kschwede commented 3 years ago

This fixed it.

On Sun, Mar 7, 2021, 10:12 PM Mahrud Sayrafi notifications@github.com wrote:

Thanks!

No problem. Let me know if this doesn't resolve the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Macaulay2/M2/issues/1982#issuecomment-792467795, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQAMMI34SODGAJAIVJQLJ3TCRMDRANCNFSM4YYHZ23A .