-
AGULLO Emmanuel authored
Splitting fabulous_c_api (which included fortran symbols) into fabulous_c_api and fabulous_fortran_fapi. This commit is a tentative for fixing the following issue https://gitlab.inria.fr/guix-hpc/guix-hpc/-/jobs/688574 The build of libfabulous including both C and fortran APIs was inducing a fragile context for retrieving symbols such as the float square root (sqrtf) which was linked to the C sqrtf when Fortran was off (expected behaviour) but to the C++ one when Fortran was on (breaking the code). - https://en.cppreference.com/w/c/numeric/math/sqrt - https://www.gnu.org/software/libc/manual/html_node/Exponents-and-Logarithms.html#index-sqrtf [ 25%] Linking CXX shared library libfabulous.so cd /tmp/guix-build-fabulous-1.0.1.drv-0/build/src/api && /gnu/store/89rj5fqcg48afgk99639ds602pgf92k4-cmake-minimal-3.16.5/bin/cmake -E cmake_link_script CMakeFiles/fabulous_c_api.dir/link.txt --verbose=1 /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/bin/c++ -fPIC -O2 -g -DNDEBUG -shared -Wl,-soname,libfabulous.so.1 -o libfabulous.so.1.0.1 CMakeFiles/fabulous_c_api.dir/basic/fabulous_basic.cpp.o CMakeFiles/fabulous_c_api.dir/generic_vectors/fabulous_generic_vectors.cpp.o CMakeFiles/fabulous_c_api.dir/basic/fabulous_mod.F90.o -L/gnu/store/741057r2x06zwg6zcmqmdyv51spm6n9i-gfortran-7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0 -L/gnu/store/741057r2x06zwg6zcmqmdyv51spm6n9i-gfortran-7.5.0-lib/lib -Wl,-rpath,:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -lgfortran -lquadmath cd /tmp/guix-build-fabulous-1.0.1.drv-0/build/src/api && /gnu/store/89rj5fqcg48afgk99639ds602pgf92k4-cmake-minimal-3.16.5/bin/cmake -E cmake_symlink_library libfabulous.so.1.0.1 libfabulous.so.1 libfabulous.so make[2]: Leaving directory '/tmp/guix-build-fabulous-1.0.1.drv-0/build' [100%] Built target fabulous_c_api make[1]: Leaving directory '/tmp/guix-build-fabulous-1.0.1.drv-0/build' /gnu/store/89rj5fqcg48afgk99639ds602pgf92k4-cmake-minimal-3.16.5/bin/cmake -E cmake_progress_start /tmp/guix-build-fabulous-1.0.1.drv-0/build/CMakeFiles 0 We observe that libfabulous is linked with libgfortran : eagullo@tek10 /tmp/guix-build-fabulous-1.0.1.drv-0/build/src/api$ ldd libfabulous.so linux-vdso.so.1 (0x00007fff88bb2000) libgfortran.so.4 => /gnu/store/741057r2x06zwg6zcmqmdyv51spm6n9i-gfortran-7.5.0-lib/lib/libgfortran.so.4 (0x00007fe5cae29000) libquadmath.so.0 => /gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/libquadmath.so.0 (0x00007fe5cade7000) libstdc++.so.6 => /gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/libstdc++.so.6 (0x00007fe5cac5c000) libm.so.6 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/libm.so.6 (0x00007fe5cab1b000) libgcc_s.so.1 => /gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/libgcc_s.so.1 (0x00007fe5cab00000) libc.so.6 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/libc.so.6 (0x00007fe5ca943000) /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/ld-linux-x86-64.so.2 (0x00007fe5cb1e5000) But then some symbols (ex. sqrtf (float square root)) get linked to GLIBCXX_3.4 (due to fortran) : eagullo@tek10 /tmp/guix-build-fabulous-1.0.1.drv-0/build/src/api$ nm -a libfabulous.so | grep sqrtf U sqrtf@@GLIBCXX_3.4 Without a fortran environment at link time: eagullo@tek10 /tmp/guix-build-fabulous-1.0.1.drv-0/build/src/api$ /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/bin/c++ -fPIC -O2 -g -DNDEBUG -shared -Wl,-soname,libfabulous.so.1 -o libfabulous.so.1.0.1 CMakeFiles/fabulous_c_api.dir/basic/fabulous_basic.cpp.o CMakeFiles/fabulous_c_api.dir/generic_vectors/fabulous_generic_vectors.cpp.o CMakeFiles/fabulous_c_api.dir/basic/fabulous_mod.F90.o -Wl,-rpath,:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -lquadmath eagullo@tek10 /tmp/guix-build-fabulous-1.0.1.drv-0/build/src/api$ nm -a libfabulous.so | grep sqrtf U sqrtf@@GLIBC_2.2.5 These same symbols get link with lib c (GLIBC_2.2.5) Here are the guix channels.scm where the error can be reproduced: (list (channel (name 'guix-hpc) (url "https://gitlab.inria.fr/guix-hpc/guix-hpc.git") (commit "02b4a7cbe3c72de591004d8c8bc5b5a3e8f4d0b9")) (channel (name 'guix-hpc-non-free) (url "https://gitlab.inria.fr/guix-hpc/guix-hpc-non-free.git") (commit "96b5fda57114947df47b8183466bc36d0abd9a07")) (channel (name 'guix) (url "https://git.savannah.gnu.org/git/guix.git") (commit "13870bbe44b668ce08acc28722c0af186832497e")))
96b3922b