Skip to content
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

Building from source on Rocky 8.10 eigen3 library not found #3485

Open
trevorkarn opened this issue Sep 18, 2024 · 47 comments
Open

Building from source on Rocky 8.10 eigen3 library not found #3485

trevorkarn opened this issue Sep 18, 2024 · 47 comments
Labels
build issue platform specific issues involving compiling M2, generating examples, or running tests high-performance computing

Comments

@trevorkarn
Copy link

trevorkarn commented Sep 18, 2024

I am trying to install from source on a Rocky 8.10 system which I don't have admin access on.

I tried following the directions at https://macaulay2.com/Downloads/SourceCode/, cloned from GitHub into ~/M2/ and ran

cd ${HOME}/M2/M2
make 
mkdir ${HOME}/M2/M2/BUILD/foo
cd ${HOME}/M2/M2/BUILD/foo
../../configure --prefix=${HOME}/local CPPFLAGS="-I/${HOME}/local/include" LIBS="-L/${HOME}/local/lib64/"

I initially had issues with tbb, but followed #3055, and installed the newest version of tbb using cmake following https://github.com/oneapi-src/oneTBB/blob/master/INSTALL.md. I did use -DCMAKE_INSTALL_PREFIX=${HOME}/local since I don't have admin access. That solved the tbb problem.

After solving the tbb problem, I again ran

../../configure --prefix=${HOME}/local CPPFLAGS="-I/${HOME}/local/include" LIBS="-L/${HOME}/local/lib64/"

from M2/BUILD/foo. Then I got the error

checking whether eigen3 library is installed... configure: error: eigen library not found

and the build stopped. I tried building the eigen3 library but that did not work for some reason. I think that eigen3 did install, because I am able to run the toy program from https://eigen.tuxfamily.org/dox/GettingStarted.html that prints a matrix by running

% g++ -I ${HOME}/local/include/eigen3 my_program.cpp -o my_program
% ./my_program 
  3  -1
2.5 1.5

I would have thought that setting CPPFLAGS="-I/${HOME}/local/include" would have been enough to fix the problem, but I am wrong.

@mahrud mahrud added the build issue platform specific issues involving compiling M2, generating examples, or running tests label Sep 18, 2024
@d-torrance
Copy link
Member

Does CPPFLAGS="-I/${HOME}/local/include/eigen3 help?

@mahrud
Copy link
Member

mahrud commented Sep 18, 2024

@d-torrance should autotools build also have a target to download/configure/install eigen? (it's a header-only library so there's nothing to build really)

@trevorkarn
Copy link
Author

I ended up doing

 export PKG_CONFIG_PATH=${HOME}/local/share/pkgconfig/
 export LD_LIBRARY_PATH=${HOME}/local/lib64

and running

 ../../configure --prefix=${HOME}/local CPPFLAGS="-I/${HOME}/local/include" LDFLAGS="-L/${HOME}/local/lib64/ -L/${HOME}/local/lib" --without-libffi --enable-download

I then ran make and that seems to be working, but the build has not completely finished yet.

@d-torrance
Copy link
Member

should autotools build also have a target to download/configure/install eigen?

Yeah, that's a good idea.

@mahrud
Copy link
Member

mahrud commented Sep 19, 2024

@trevorkarn did the build succeed? I added a reference to this issue in the wiki. Feel free to add any other details that would be helpful for people building M2 on RHEL in the future.

@trevorkarn
Copy link
Author

It did not succeed. I am now struggling with GIVARO

@d-torrance
Copy link
Member

For what it's worth, once #3487 is merged, eigen should be discovered without having to mess with pkg-config, so long as it's installed in a standard header directory or CPPFLAGS is set correctly. And if it's not found, then it will be installed automatically in the build directory. (It's also possible to avoid this entirely on RHEL by installing the eigen3 package from EPEL.)

What specific givaro issues are you having? I've also been trying to get the build to work in RHEL 8, ideally before the next release, but there are lots of little issues like this since so few packages are available in the RHEL repositories.

@trevorkarn
Copy link
Author

trevorkarn commented Sep 19, 2024

I installed givaro, by following https://github.com/linbox-team/givaro?tab=readme-ov-file#download-and-install with

./autogen.sh --prefix=${HOME}/givaro

I am again having trouble configuring. I tried

export PKG_CONFIG_PATH=${HOME}/local/share/pkgconfig/:${HOME}/local/lib64/pkgconfig/:${HOME}/givaro/lib/pkgconfig
export LD_LIBRARY_PATH=${HOME}/local/lib64
export GIVARO_LIBS=${HOME}/givaro/include
../../configure --prefix=${HOME}/local CPPFLAGS="-I/${HOME}/local/include" LDFLAGS="-L/${HOME}/local/lib64/ -L/${HOME}/local/lib" --without-libffi --enable-download

and get the error

checking whether getaddrinfo can handle numeric service (port) numbers... configure: error: test file failed to compile

If I ignore that error, and run make anyway, since I think a previous configuration seemed to work (how do I check that?), I get

...
## --------------------------------------- ##
##        START FFLAS-FFPACK CONFIG        ##
## --------------------------------------- ##
checking for family name of compiler... checking whether g++ supports C++11 features by default... yes
---------------------------------------
checking whether to enable debugging options in the library... no
checking whether to enable profiling everything in the library... no
checking whether to enable warnings when compiling the library... no
checking whether C++ compiler accepts -march=native... yes
configure: "Adding '-march=native' to OPTIM_FLAGS"
---------------------------------------
checking size of char... 1
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of __int64_t... 8
checking for __int128_t... yes
checking whether byte ordering is bigendian... no
---------------------------------------
checking for OpenMP... no
Default path = /usr /usr/local
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GIVARO... yes
checking for GIVARO usability... no
configure: error: The Givaro library could not be used with the compiler and the flags set up by the configure script
make: *** [GNUmakefile:211: submodules/fflas_ffpack/Makefile] Error 1

@trevorkarn
Copy link
Author

I reinstalled givaro in ~/local using ./autogen.sh --prefix=${HOME}/local instead of what I did above. Then things get further:

% cd ~/M2/M2/BUILD/foo
% export PKG_CONFIG_PATH=${HOME}/local/share/pkgconfig/:${HOME}/local/lib64/pkgconfig/:${HOME}/local/lib/pkgconfig/
% make

which gives output ending in

## --------------------------------------- ##
##        START FFLAS-FFPACK CONFIG        ##
## --------------------------------------- ##
checking for family name of compiler... checking whether g++ supports C++11 features by default... yes
---------------------------------------
checking whether to enable debugging options in the library... no
checking whether to enable profiling everything in the library... no
checking whether to enable warnings when compiling the library... no
checking whether C++ compiler accepts -march=native... yes
configure: "Adding '-march=native' to OPTIM_FLAGS"
---------------------------------------
checking size of char... 1
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of __int64_t... 8
checking for __int128_t... yes
checking whether byte ordering is bigendian... no
---------------------------------------
checking for OpenMP... no
Default path = /usr /usr/local
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GIVARO... yes
checking for GIVARO usability... yes
---------------------------------------
checking for use of MKL... no 
checking for BLAS... problem
*******************************************************************************
 ERROR: BLAS not found!
 BLAS routines are required for this library to compile. Please
 make sure BLAS are installed and specify its location with the option
 --with-blas-libs=<libs> and if necessary --with-blas-cflags=<cflags>
 when running configure.
*******************************************************************************
make: *** [GNUmakefile:211: submodules/fflas_ffpack/Makefile] Error 1
make: Leaving directory '/users/0/karnx018/M2/M2/BUILD/foo'

@d-torrance
Copy link
Member

You shouldn't have to build givaro yourself -- the M2 build script will do it for you.

That being said, I'm getting stuck at the same spot you are. The BLAS part of the autotools build needs an overhaul -- I'm hoping to work on that soon.

@trevorkarn
Copy link
Author

How do I tell which things I should have to build myself and which things the M2 build script will/is supposed to do for me?

I didn't have BLAS installed, so I am trying to install BLAS from source now.

@d-torrance
Copy link
Member

Basically, if you get an error before configure finishes (like the one you were getting with eigen), then the M2 build script expects it to be installed already. If configure finishes without an error, then it will build everything that it needs. You can see the list of things it will build by looking for this output towards the end:

configure: using BUILDLIST     =  gc gmp mpfi normaliz ntl flint factory lapack mpsolve frobby glpk cddlib givaro fflas_ffpack gtest memtailor mathic mathicgb eigen 4ti2 gfan csdp nauty lrslib gftables topcom cohomcalg msolve

If you build BLAS manually, then you might be able to point fflas-ffpack in the right direction by modifying M2/libraries/fflas_ffpack/Makefile.in and adding CONFIGOPTIONS += --with-blas-libs=... --with-blas-cflags=....

@mikestillman
Copy link
Member

I'd also like to try building on autotools and cmake on macos sonoma, with all packages being built. So far, I have had some troubles also with at least eigen (if I recall correctly). It would be nice to make sure this works.

@trevorkarn
Copy link
Author

trevorkarn commented Sep 19, 2024

I sucessfully built OpenBLAS using

cd ${HOME}
git clone https://github.com/OpenMathLib/OpenBLAS.git
cd OpenBLAS
make
make install PREFIX=${HOME}/local

I modified M2/libraries/fflas_ffpack/Makefile.in, adding a new line

CONFIGOPTIONS += --with-blas-libs="${HOME}/local/lib" --with-blas-cflags="${HOME}/local/include"

It failed with:

....
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_ftrmm_src.inl:196: undefined reference to `cblas_dtrmm'
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_ftrmm_src.inl:193: undefined reference to `openblas_set_num_threads'
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_ftrmm_src.inl:196: undefined reference to `cblas_dtrmm'
../e/dmat.o: In function `Givaro::Modular<double, double, void>::Element_ptr FFPACK::Invert2<Givaro::Modular<double, double, void> >(Givaro::Modular<double, double, 
void> const&, unsigned long, Givaro::Modular<double, double, void>::Element_ptr, unsigned long, Givaro::Modular<double, double, void>::Element_ptr, unsigned long, in
t&)':
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_fassign.inl:120: undefined reference to `openblas_set_num_threads'
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_fassign.inl:122: undefined reference to `cblas_dcopy'
collect2: error: ld returned 1 exit status
real    1m49.602s
user    0m8.204s
sys     0m4.090s
make[2]: *** [Makefile:133: /users/0/karnx018/M2/M2/BUILD/foo/usr-dist/x86_64-Linux-Rocky-8.10/bin/M2-binary] Error 1
make[2]: Leaving directory '/users/0/karnx018/M2/M2/BUILD/foo/Macaulay2/bin'
make[1]: *** [Makefile:15: all-in-bin] Error 2
make[1]: Leaving directory '/users/0/karnx018/M2/M2/BUILD/foo/Macaulay2'
make: *** [GNUmakefile:251: all-in-Macaulay2] Error 2
make: Leaving directory '/users/0/karnx018/M2/M2/BUILD/foo'

Do you have any advice of where to go from here?

@d-torrance
Copy link
Member

To tell the linker where libraries are, you'll want to use "-L" and to tell the compiler where headers are, you'll want to use "-I". So it will probably be something like:

CONFIGOPTIONS += --with-blas-libs="-L${HOME}/local/lib" --with-blas-cflags="-I${HOME}/local/include"

You may also need -lcblas, -lopenblas, or similar in --with-blas-libs. Flags that look like -lfoo tell the linker to look for a file named libfoo.so, so see what .so files OpenBLAS installed in ~/local/lib and play around with those.

@trevorkarn
Copy link
Author

trevorkarn commented Sep 19, 2024

I have the following .so files in ~/local/lib:

% ls ~/local/lib | grep ".so"
libeigen_blas.so
libeigen_lapack.so
libgivaro.so
libgivaro.so.9
libgivaro.so.9.2.1
libopenblas.so
libopenblas.so.0
libopenblas_zenp-r0.3.28.dev.so

so I adjusted the fflas_ffpack/Makefile.in to have the line

CONFIGOPTIONS += --with-blas-libs="-L${HOME}/local/lib -lopenblas -lgivaro -leigen_blas" --with-blas-cflags="-I${HOME}/local/include"

and I continue to get

/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_ftrmm_src.inl:193: undefined reference to `openblas_set_num_threads'
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_ftrmm_src.inl:196: undefined reference to `cblas_dtrmm'
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_ftrmm_src.inl:193: undefined reference to `openblas_set_num_threads'
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_ftrmm_src.inl:196: undefined reference to `cblas_dtrmm'
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_ftrmm_src.inl:193: undefined reference to `openblas_set_num_threads'
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_ftrmm_src.inl:196: undefined reference to `cblas_dtrmm'
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_ftrmm_src.inl:193: undefined reference to `openblas_set_num_threads'
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_ftrmm_src.inl:196: undefined reference to `cblas_dtrmm'
../e/dmat.o: In function `Givaro::Modular<double, double, void>::Element_ptr FFPACK::Invert2<Givaro::Modular<double, double, void> >(Givaro::Modular<double, double, 
void> const&, unsigned long, Givaro::Modular<double, double, void>::Element_ptr, unsigned long, Givaro::Modular<double, double, void>::Element_ptr, unsigned long, in
t&)':
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_fassign.inl:120: undefined reference to `openblas_set_num_threads'
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_fassign.inl:122: undefined reference to `cblas_dcopy'
collect2: error: ld returned 1 exit status
real    0m14.111s
user    0m7.593s
sys     0m2.849s
make[2]: *** [Makefile:133: /users/0/karnx018/M2/M2/BUILD/foo/usr-dist/x86_64-Linux-Rocky-8.10/bin/M2-binary] Error 1
make[2]: Leaving directory '/users/0/karnx018/M2/M2/BUILD/foo/Macaulay2/bin'
make[1]: *** [Makefile:15: all-in-bin] Error 2
make[1]: Leaving directory '/users/0/karnx018/M2/M2/BUILD/foo/Macaulay2'
make: *** [GNUmakefile:251: all-in-Macaulay2] Error 2
make: Leaving directory '/users/0/karnx018/M2/M2/BUILD/foo'

@mahrud
Copy link
Member

mahrud commented Sep 20, 2024

I'm almost certain you don't have to install BLAS yourself because any HPC server has some sort of optimized linear algebra framework installed. In your case, follow this guide. (Well, really, I think you mainly need to run module load mkl). If you run into some compilation issues, #3372 might be helpful.

@mahrud
Copy link
Member

mahrud commented Sep 20, 2024

Also, last time I tried the autotools build didn't know how to use OpenBLAS: #475
@d-torrance has this changed?

@d-torrance
Copy link
Member

It apparently works at least somewhat because my M2 binary (from the Ubuntu 24.04 PPA package, which was built using autotools) is linked against it:

$ ldd /usr/bin/M2-binary | grep blas
	libblas.so.3 => /lib/x86_64-linux-gnu/libblas.so.3 (0x0000794756abd000)
	libopenblas.so.0 => /lib/x86_64-linux-gnu/libopenblas.so.0 (0x0000794750000000)

I can't recall how I got this working. I'm planning on diving into the BLAS stuff in the autotools build soon -- ideally before the next release. I'd really like to get these RHEL builds working!

@trevorkarn
Copy link
Author

I'm almost certain you don't have to install BLAS yourself because any HPC server has some sort of optimized linear algebra framework installed. In your case, follow this guide. (Well, really, I think you mainly need to run module load mkl). If you run into some compilation issues, #3372 might be helpful.

Just module loading mkl didn't quite work for me. I also tried module load mkl and module load intel following the updated documentation here. I'll keep poking around.

@trevorkarn
Copy link
Author

After digging in more to module load, I tried to start over from scratch. It looks like I installed stuff that was available at my university via module load. So I ran the following:

module load mkl
module load intel
module load libffi
module load oneapi
module load eigen
cd ${HOME}
git clone https://github.com/Macaulay2/M2.git
mkdir ${HOME}/M2/M2/BUILD/foo
cd ${HOME}/M2/M2
make
cd ${HOME}/M2/M2/BUILD/foo
../../configure --prefix=${HOME}/local --enable-download
make 

The configure run seemed to go smoothly. The make step ended with

checking for OpenMP... no
Default path = /usr /usr/local
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GIVARO... no
configure: error: Package requirements (givaro >= 4.1.2) were not met:

Package 'givaro', required by 'virtual:world', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GIVARO_CFLAGS
and GIVARO_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
make: *** [GNUmakefile:211: submodules/fflas_ffpack/Makefile] Error 1
make: Leaving directory '/users/0/karnx018/M2/M2/BUILD/foo'

Should M2 build its own Givaro? Or is there another possible place that Givaro might be hiding, for example in MKL? I don't think it is in MKL and module load givaro fails, but I'm not sure I would know where else know where to look.

@mahrud
Copy link
Member

mahrud commented Sep 25, 2024

I think this indicates that make has already built givaro, but in building fflas_ffpack, it is having trouble finding givaro. You can check if givaro exists in BUILD/foo/usr-host, and I think there should be a config.log file somewhere in BUILD/foo/libraries/fflas_ffpack or somewhere like that which should tell you why it couldn't find it. We can take a look if you upload that log file.

@mahrud
Copy link
Member

mahrud commented Sep 25, 2024

Also, I should say, I'm very curious if you tried building with CMake. You can download the cmake binary from here (and optionally ninja from here) and install them in ~/bin or ~/local/bin. They don't need to be installed globally.

@trevorkarn
Copy link
Author

I think this indicates that make has already built givaro, but in building fflas_ffpack, it is having trouble finding givaro. You can check if givaro exists in BUILD/foo/usr-host, and I think there should be a config.log file somewhere in BUILD/foo/libraries/fflas_ffpack or somewhere like that which should tell you why it couldn't find it. We can take a look if you upload that log file.

Givaro does not seem to exist in BUILD/foo/usr-host. I also don't see any config.log file in BUILD/foo/libraries/fflas_ffpack.

Also, I should say, I'm very curious if you tried building with CMake. You can download the cmake binary from here (and optionally ninja from here) and install them in ~/bin or ~/local/bin. They don't need to be installed globally.

I have not tried with Cmake, only with make.

@trevorkarn
Copy link
Author

After setting

export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${HOME}/M2/M2/BUILD/foo/submodules/givaro

I tried make again from ~/M2/M2/BUILD/foo and got a different error:

## --------------------------------------- ##
##        START FFLAS-FFPACK CONFIG        ##
## --------------------------------------- ##
checking for family name of compiler... checking whether g++ supports C++11 features by default... yes
---------------------------------------
checking whether to enable debugging options in the library... no
checking whether to enable profiling everything in the library... no
checking whether to enable warnings when compiling the library... no
checking whether C++ compiler accepts -march=native... yes
configure: "Adding '-march=native' to OPTIM_FLAGS"
---------------------------------------
checking size of char... 1
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of __int64_t... 8
checking for __int128_t... yes
checking whether byte ordering is bigendian... no
---------------------------------------
checking for OpenMP... no
Default path = /usr /usr/local
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GIVARO... yes
checking for GIVARO usability... no
configure: error: The Givaro library could not be used with the compiler and the flags set up by the configure script
make: *** [GNUmakefile:211: submodules/fflas_ffpack/Makefile] Error 1
make: Leaving directory '/users/0/karnx018/M2/M2/BUILD/foo'

@trevorkarn
Copy link
Author

trevorkarn commented Sep 25, 2024

With the same PKG_CONFIG_PATH as above, I saw that ${HOME}/M2/M2/BUILD/foo/libraries/givaro had only a Makefile, so I tried running make from ${HOME}/M2/M2/BUILD/foo/libraries/givaro, which seemed to successfully build givaro. Then I went back and ran make from ${HOME}/M2/M2/BUILD/foo and got

## --------------------------------------- ##
##        START FFLAS-FFPACK CONFIG        ##
## --------------------------------------- ##
checking for family name of compiler... checking whether g++ supports C++11 features by default... yes
---------------------------------------
checking whether to enable debugging options in the library... no
checking whether to enable profiling everything in the library... no
checking whether to enable warnings when compiling the library... no
checking whether C++ compiler accepts -march=native... yes
configure: "Adding '-march=native' to OPTIM_FLAGS"
---------------------------------------
checking size of char... 1
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of __int64_t... 8
checking for __int128_t... yes
checking whether byte ordering is bigendian... no
---------------------------------------
checking for OpenMP... no
Default path = /usr /usr/local
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GIVARO... no
configure: error: Package requirements (givaro >= 4.1.2) were not met:

Package dependency requirement 'givaro >= 4.1.2' could not be satisfied.
Package 'givaro' has version '4.1.1', required version is '>= 4.1.2'

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GIVARO_CFLAGS
and GIVARO_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
make: *** [GNUmakefile:211: submodules/fflas_ffpack/Makefile] Error 1
make: Leaving directory '/users/0/karnx018/M2/M2/BUILD/foo'

I see on https://macaulay2.com/Downloads/OtherSourceCode/ that only 4.1.1 is available, not 4.1.2. @d-torrance, is that something that should be updated?

@d-torrance
Copy link
Member

That shouldn't matter since the M2 build script doesn't download the givaro tarball from that website anymore but instead fetches a git submodule.

@trevorkarn
Copy link
Author

Oh interesting. It seemed to download it from that site when I ran make from ${HOME}/M2/M2/BUILD/foo/libraries/givaro after changing the version in the Makefile to 4.1.2

@trevorkarn
Copy link
Author

When I run pkg-config, it says

cn1164% pkg-config --cflags givaro
-I/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include 

But that directory doesn't seem to have anything givaro related.

cn1164% ls ~/M2/M2/BUILD/foo/usr-host/include/
4ti2  cddlib   flint     gc    gc_cpp.h  glpk.h    gtest        mathic    mathicgb    memtailor    mpf2mpfr.h  mpfi_io.h  mps       util
NTL   factory  frobby.h  gc.h  gdbm.h    groebner  libnormaliz  mathic.h  mathicgb.h  memtailor.h  mpfi.h      mpfr.h     stdinc.h  zsolve

@trevorkarn
Copy link
Author

I got past the givaro/fflas_ffpack issue by building givaro in ~/M2/M2/BUILD/foo/submodules/givaro running make AND make install. Is it possible that however M2 is building givaro is not installing it?

@mahrud
Copy link
Member

mahrud commented Sep 26, 2024

Did it get stuck somewhere else?

@mahrud
Copy link
Member

mahrud commented Sep 26, 2024

@d-torrance btw, there's a --without-simd optioin in libraries/givaro/Makefile that is definitely counterproductive for running M2 on strong servers.

@trevorkarn
Copy link
Author

@mahrud It did get stuck, with the error message:

make[2]: Leaving directory '/users/0/karnx018/M2new/M2/BUILD/foo/Macaulay2/d'
make -C e all 
make[2]: Entering directory '/users/0/karnx018/M2new/M2/BUILD/foo/Macaulay2/e'
CXX eigen.cpp
{standard input}: Assembler messages:
{standard input}:952875: Warning: end of file not at end of a line; newline inserted
{standard input}:952884: Error: no such instruction: `m'
{standard input}: Error: open CFI at the end of file; missing .cfi_endproc directive
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [Makefile.common:33: eigen.o] Error 1
make[2]: Leaving directory '/users/0/karnx018/M2new/M2/BUILD/foo/Macaulay2/e'
make[1]: *** [Makefile:15: all-in-e] Error 2
make[1]: Leaving directory '/users/0/karnx018/M2new/M2/BUILD/foo/Macaulay2'
make: *** [GNUmakefile:251: all-in-Macaulay2] Error 2
make: Leaving directory '/users/0/karnx018/M2new/M2/BUILD/foo'

@trevorkarn
Copy link
Author

../e/dmat.o: In function `Givaro::Modular<double, double, void>::Element_ptr FFPACK::Invert2<Givaro::Modular<double, double, void> >(Givaro::Modular<double, double, void> const&, unsigned long, Givaro::Modular<double, double, void>::Element_ptr, unsigned long, Givaro::Modular<double, double, void>::Element_ptr, unsigned long, int&)':
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_fassign.inl:120: undefined reference to `openblas_set_num_threads'
/users/0/karnx018/M2/M2/BUILD/foo/usr-host/include/fflas-ffpack/fflas/fflas_fassign.inl:122: undefined reference to `cblas_dcopy'
../e/interface/groebner.o: In function `NCF4::~NCF4()':
/common/software/install/migrated/oneapi/2022.1/tbb/2021.5.1/include/oneapi/tbb/tbb_allocator.h:65: undefined reference to `tbb::detail::r1::deallocate_memory(void*)'
/common/software/install/migrated/oneapi/2022.1/tbb/2021.5.1/include/oneapi/tbb/tbb_allocator.h:65: undefined reference to `tbb::detail::r1::deallocate_memory(void*)'
/common/software/install/migrated/oneapi/2022.1/tbb/2021.5.1/include/oneapi/tbb/tbb_allocator.h:65: undefined reference to `tbb::detail::r1::deallocate_memory(void*)'
/common/software/install/migrated/oneapi/2022.1/tbb/2021.5.1/include/oneapi/tbb/tbb_allocator.h:65: undefined reference to `tbb::detail::r1::deallocate_memory(void*)'
/common/software/install/migrated/oneapi/2022.1/tbb/2021.5.1/include/oneapi/tbb/tbb_allocator.h:65: undefined reference to `tbb::detail::r1::deallocate_memory(void*)'
../e/interface/groebner.o:/common/software/install/migrated/oneapi/2022.1/tbb/2021.5.1/include/oneapi/tbb/tbb_allocator.h:65: more undefined references to `tbb::detail::r1::deallocate_memory(void*)' follow
../e/interface/groebner.o: In function `NCF4::~NCF4()':
/common/software/install/migrated/oneapi/2022.1/tbb/2021.5.1/include/oneapi/tbb/task_arena.h:366: undefined reference to `tbb::detail::r1::terminate(tbb::detail::d1::task_arena_base&)'
collect2: error: ld returned 1 exit status

real	0m38.115s
user	0m10.919s
sys	0m3.335s
make[2]: *** [Makefile:133: /users/0/karnx018/M2/M2/BUILD/foo/usr-dist/x86_64-Linux-Rocky-8.10/bin/M2-binary] Error 1
make[2]: Leaving directory '/users/0/karnx018/M2/M2/BUILD/foo/Macaulay2/bin'
make[1]: *** [Makefile:15: all-in-bin] Error 2
make[1]: Leaving directory '/users/0/karnx018/M2/M2/BUILD/foo/Macaulay2'
make: *** [GNUmakefile:251: all-in-Macaulay2] Error 2
make: Leaving directory '/users/0/karnx018/M2/M2/BUILD/foo'

@mahrud
Copy link
Member

mahrud commented Sep 26, 2024

This definitely seems to me like a case of "M2 wants to use mkl but givaro/fflas are built with cblas".

Is there also a cblas module? If so maybe you could try rebuilding (perhaps in a new build directory) without mkl.

@d-torrance
Copy link
Member

btw, there's a --without-simd optioin in libraries/givaro/Makefile that is definitely counterproductive for running M2 on strong servers.

Plus givaro doesn't even support that configure option any more! I'll get rid of it.

@d-torrance
Copy link
Member

I just successfully built M2 on a Rocky Linux 8.9 docker image!

@trevorkarn - Does building from the flint-autotools branch from my fork work?

git fetch https://github.com/d-torrance/M2 flint-autotools
git checkout FETCH_HEAD

I did install some of the dependencies using the EPEL.

@trevorkarn
Copy link
Author

@d-torrance Glad to hear you built it!

I could not build from your branch. Here is the error I got:

....
CXX eigen.cpp
{standard input}: Assembler messages:
{standard input}:426602: Warning: end of file not at end of a line; newline inserted
{standard input}: Error: open CFI at the end of file; missing .cfi_endproc directive
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [Makefile.common:33: eigen.o] Error 1
make[2]: Leaving directory '/users/0/karnx018/M3/M2/BUILD/foo/Macaulay2/e'
make[1]: *** [Makefile:15: all-in-e] Error 2
make[1]: Leaving directory '/users/0/karnx018/M3/M2/BUILD/foo/Macaulay2'
make: *** [GNUmakefile:57: all-in-Macaulay2] Error 2
make: Leaving directory '/users/0/karnx018/M3/M2/BUILD/foo'

@mahrud
Copy link
Member

mahrud commented Oct 1, 2024

Last time I think this was magically resolved when we came back to the build, is that right?

@d-torrance
Copy link
Member

That looks like you ran out of memory trying to compile eigen.cpp, which is a known issue (see #2223). Is there any way to increase the memory during the build or maybe update to a newer version of GCC or clang? The newer versions have improved performance for compiling C++ code that uses lots of templates (which is the issue for this particular file).

@trevorkarn
Copy link
Author

It is possible for me to increase memory during the build, so I'll give that a shot. Thanks!

@trevorkarn
Copy link
Author

trevorkarn commented Oct 1, 2024

OK, I got through compiling eigen.cpp, on @d-torrance's branch but got stuck building the Macaulay2Doc package.

make[2]: Entering directory '/users/0/karnx018/M3/M2/BUILD/foo/Macaulay2/packages'
: installing package Macaulay2Doc
/usr/bin/install -c -d Macaulay2Doc-temporary
make: Entering directory `/users/0/karnx018/M3/M2/BUILD/foo/Macaulay2/packages/Macaulay2Doc-temporary'
cd Macaulay2Doc-temporary && /users/0/karnx018/M3/M2/BUILD/foo/usr-dist/x86_64-Linux-Rocky-8.10/bin/M2  -q --stop --silent --no-preload -e errorDepth=0 -e debugLevel=0  -e "installPackage(\"Macaulay2Doc\", MakeDocumentation => true, MakeHTML => true, MakeInfo => true, MakePDF => false, RemakeAllDocumentation => false, IgnoreExampleErrors => false, RerunExamples => false, CheckDocumentation => true, UserMode => false, Verbose => false, InstallPrefix => \"/users/0/karnx018/M3/M2/BUILD/foo/usr-dist/\", SeparateExec => true, DebuggingMode => true); exit 0"
 -- capturing example results for "runProgram"                              /bin/sh: gfan: command not found
 -- capture failed; retrying ...
 -- making example results for "runProgram"                                 
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /tmp/M2-1261221-0/5-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/users/0/karnx018/M3/M2/BUILD/foo/usr-dist/x86_64-Linux-Rocky-8.10/bin/M2-binary" -q --no-randomize --no-readline --silent --stop --print-width 77 <"/tmp/M2-1261221-0/0_run__Program.m2" >>"/users/0/karnx018/M3/M2/BUILD/foo/usr-dist/common/share/doc/Macaulay2/Macaulay2Doc/example-output/_run__Program.errors" 2>&1
/users/0/karnx018/M3/M2/BUILD/foo/usr-dist/common/share/doc/Macaulay2/Macaulay2Doc/example-output/_run__Program.errors:0:1:(3):[12]: (output file) error: Macaulay2 exited with status code 1
/tmp/M2-1261221-0/0_run__Program.m2:0:1: (input file)
M2: *** Error 1
 -- 4.01258s elapsed
../../../../../Macaulay2/m2/debugging.m2:18:13:(1):[10]: error: installPackage: 1 error(s) occurred in running examples for package Macaulay2Doc
../../../../../Macaulay2/m2/installPackage.m2:619:38:(1):[8]: --back trace--
../../../../../Macaulay2/m2/methods.m2:154:98:(1):[7]: --back trace--
../../../../../Macaulay2/m2/option.m2:17:14:(1):[6]: --back trace--
../../../../../Macaulay2/m2/installPackage.m2:662:18:(1):[5]: --back trace--
../../../../../Macaulay2/m2/methods.m2:154:98:(1):[4]: --back trace--
../../../../../Macaulay2/m2/option.m2:17:14:(1):[3]: --back trace--
currentString:1:14:(3):[2]: --back trace--
../../../../../Macaulay2/m2/startup.m2.in:485:11:(0):[1]: --back trace--
../../../../../Macaulay2/m2/startup.m2.in:619:30:(0): --back trace--
make[2]: *** [Makefile:106: /users/0/karnx018/M3/M2/BUILD/foo/usr-dist/x86_64-Linux-Rocky-8.10/lib/Macaulay2/Macaulay2Doc/.installed] Error 1
make[2]: Leaving directory '/users/0/karnx018/M3/M2/BUILD/foo/Macaulay2/packages'
make[1]: *** [Makefile:15: all-in-packages] Error 2
make[1]: Leaving directory '/users/0/karnx018/M3/M2/BUILD/foo/Macaulay2'
make: *** [GNUmakefile:57: all-in-Macaulay2] Error 2
make: Leaving directory '/users/0/karnx018/M3/M2/BUILD/foo'

@d-torrance
Copy link
Member

Woohoo! You've gotten to the point of building documentation, which means you have a functional copy of Macaulay2. :)

I haven't gotten a chance to fiddle with building the documentation yet on my branch, but plan to soon. In the meantime, you should be able to finish the build (with a couple documentation pages with broken examples) using:

make IgnoreExampleErrors=true

@mahrud
Copy link
Member

mahrud commented Oct 1, 2024

It looks like it couldn't find gfan:

/bin/sh: gfan: command not found

But at this point you should have a functional binary.

@trevorkarn
Copy link
Author

Woohoo! You've gotten to the point of building documentation, which means you have a functional copy of Macaulay2. :)

I haven't gotten a chance to fiddle with building the documentation yet on my branch, but plan to soon. In the meantime, you should be able to finish the build (with a couple documentation pages with broken examples) using:

make IgnoreExampleErrors=true

I was not able to finish the build with IgnoreExampleErrors=true. I got the same error. Is there something else I should try?

@d-torrance
Copy link
Member

Huh, that's weird -- I'll have to investigate why that didn't work.

I pushed a new commit to the branch recently that should fix the missing gfan error.

@trevorkarn
Copy link
Author

trevorkarn commented Oct 1, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build issue platform specific issues involving compiling M2, generating examples, or running tests high-performance computing
Projects
None yet
Development

No branches or pull requests

4 participants