joezuntz / cosmosis

Other
22 stars 18 forks source link

Link error during Cosmosis installation #153

Open chrstnnssnr opened 1 day ago

chrstnnssnr commented 1 day ago

I'm following the instructions https://cosmosis.readthedocs.io/en/latest/intro/installation.html "Conda-Forge (from scratch)" on a Linux machine:

$ uname -a
Linux hostname 5.14.0-427.37.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Sep 24 17:44:03 EDT 2024 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/redhat-release 
AlmaLinux release 9.3 (Shamrock Pampas Cat)

In the last step:

$ cosmosis-build-standard-library main

I get the following link errors during the class build

/data/astro/software/envs/cosmosis/bin/x86_64-conda-linux-gnu-cc -O3  -g -fPIC -O3 -g -fPIC -fopenmp -I/data/astro/software/envs/cosmosis/lib/python3.12/site-packages/cosmosis/ -std=c99  -o class build/growTable.o build/dei_rkck.o build/sparse.o build/evolver_rkck.o build/evolver_ndf15.o build/arrays.o build/parser.o build/quadrature.o build/hyperspherical.o build/common.o build/trigonometric_integrals.o build/input.o build/background.o build/thermodynamics.o build/perturbations.o build/primordial.o build/fourier.o build/transfer.o build/harmonic.o build/lensing.o build/distortions.o build/wrap_recfast.o build/injection.o build/noninjection.o build/hyrectools.o build/helium.o build/hydrogen.o build/history.o build/wrap_hyrec.o build/energy_injection.o build/output.o build/class.o -lm
/data/astro/software/envs/cosmosis/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /data/astro/software/envs/cosmosis/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/libgomp.so: undefined reference to `dlopen@GLIBC_2.2.5'
/data/astro/software/envs/cosmosis/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /data/astro/software/envs/cosmosis/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/libgomp.so: undefined reference to `dlerror@GLIBC_2.2.5'
/data/astro/software/envs/cosmosis/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /data/astro/software/envs/cosmosis/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/libgomp.so: undefined reference to `clock_gettime@GLIBC_2.2.5'
/data/astro/software/envs/cosmosis/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /data/astro/software/envs/cosmosis/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/libgomp.so: undefined reference to `dlclose@GLIBC_2.2.5'
/data/astro/software/envs/cosmosis/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /data/astro/software/envs/cosmosis/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/libgomp.so: undefined reference to `clock_getres@GLIBC_2.2.5'
/data/astro/software/envs/cosmosis/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /usr/lib64/librt.so.1: undefined reference to `__libc_unwind_link_get@GLIBC_PRIVATE'
/data/astro/software/envs/cosmosis/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /data/astro/software/envs/cosmosis/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/libgomp.so: undefined reference to `dlsym@GLIBC_2.2.5'
collect2: error: ld returned 1 exit status

Both, ld and the gomp library are provided by the installation procedure that is suggested in the above mentioned instructions.

joezuntz commented 23 hours ago

I wasn't able to replicate this under docker.

If you haven't already, could you try starting a new terminal window, and starting again from the source ./env/bin/activate step in the instructions? On some systems conda doesn't fully pick up installed libraries until you start a new shell.

If that doesn't work or you've already tried it, could you post (or email me, joe. zuntz @ ed. ac. uk - remove the spaces) the complete log in case I can spot anything?

chrstnnssnr commented 23 hours ago

Changing the cc compiler from the provided by Miniforge: /data/astro/software/envs/cosmosis/bin/x86_64-conda-linux-gnu-cc

to the system one: /bin/cc

seems to work.

$ /data/astro/software/envs/cosmosis/bin/x86_64-conda-linux-gnu-cc --version
x86_64-conda-linux-gnu-cc (conda-forge gcc 13.3.0-1) 13.3.0

$ /bin/cc --version
cc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2)
joezuntz commented 23 hours ago

I would not expect that to work in general at runtime, though you may be lucky, depending what you need to run.