fangohr / octopus-in-docker

Dockerfile for Octopus. Useful for tutorials, OSX, Windows, testing.
BSD 3-Clause "New" or "Revised" License
0 stars 3 forks source link

libsymspg cannot be found #9

Closed fangohr closed 7 months ago

fangohr commented 10 months ago

In this repository, we compile Octopus using dependencies from Debian packages.

We have two different workflows:

Both passed fine when Octopus 13.0 was released.

Now the 13.0 version still passes fine but there is a problem with the develop:

https://github.com/fangohr/octopus-in-docker/actions/runs/7268660059/job/19804909600#step:3:8555

At runtime, the libsymspg.so.0 cannot be found:

#19 [14/23] RUN octopus --version > octopus-version
#19 0.197 octopus: error while loading shared libraries: libsymspg.so.0: cannot open shared object file: No such file or directory
#19 ERROR: process "/bin/sh -c octopus --version > octopus-version" did not complete successfully: exit code: 127
fangohr commented 10 months ago

Some debug output (from building this container on my laptop):

#18 [15/19] RUN ldd /usr/local/bin/octopus
#18 sha256:654864217432f5e49b5086702d5893b2e346bcd2208e1bab36caa5fdaf571e11
#18 0.140   linux-vdso.so.1 (0x0000ffff88000000)
#18 0.140   libsymspg.so.0 => not found
#18 0.140   libnetcdff.so.7 => /usr/lib/aarch64-linux-gnu/libnetcdff.so.7 (0x0000ffff86d40000)
#18 0.140   libnlopt.so.0 => /usr/lib/aarch64-linux-gnu/libnlopt.so.0 (0x0000ffff86cd3000)
#18 0.140   libfftw3_omp.so.3 => /usr/lib/aarch64-linux-gnu/libfftw3_omp.so.3 (0x0000ffff86cbc000)
#18 0.140   libfftw3.so.3 => /usr/lib/aarch64-linux-gnu/libfftw3.so.3 (0x0000ffff86bf1000)
#18 0.140   liblapack.so.3 => /usr/lib/aarch64-linux-gnu/liblapack.so.3 (0x0000ffff86681000)
#18 0.140   libblas.so.3 => /usr/lib/aarch64-linux-gnu/libblas.so.3 (0x0000ffff86637000)
#18 0.140   libgsl.so.25 => /usr/lib/aarch64-linux-gnu/libgsl.so.25 (0x0000ffff8638f000)
#18 0.140   libxcf03.so.5 => /usr/lib/aarch64-linux-gnu/libxcf03.so.5 (0x0000ffff86378000)
#18 0.140   libstdc++.so.6 => /usr/lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000ffff861a0000)
#18 0.140   libgfortran.so.5 => /usr/lib/aarch64-linux-gnu/libgfortran.so.5 (0x0000ffff86036000)
#18 0.140   libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffff85f8b000)
#18 0.140   libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffff85f67000)
#18 0.140   libmpi_mpifh.so.40 => /usr/lib/aarch64-linux-gnu/libmpi_mpifh.so.40 (0x0000ffff85ef2000)
#18 0.140   libgomp.so.1 => /usr/lib/aarch64-linux-gnu/libgomp.so.1 (0x0000ffff85ea5000)
#18 0.140   libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffff85e74000)
#18 0.140   libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff85d00000)
#18 0.140   /lib/ld-linux-aarch64.so.1 (0x0000ffff87fd0000)
#18 0.140   libnetcdf.so.18 => /usr/lib/aarch64-linux-gnu/libnetcdf.so.18 (0x0000ffff85bc1000)
#18 0.140   libatlas.so.3 => /usr/lib/aarch64-linux-gnu/libatlas.so.3 (0x0000ffff85938000)
#18 0.140   libgslcblas.so.0 => /usr/lib/aarch64-linux-gnu/libgslcblas.so.0 (0x0000ffff858f7000)
#18 0.140   libxc.so.5 => /usr/lib/aarch64-linux-gnu/libxc.so.5 (0x0000ffff854e0000)
#18 0.140   libmpi.so.40 => /usr/lib/aarch64-linux-gnu/libmpi.so.40 (0x0000ffff853ac000)
#18 0.140   libopen-pal.so.40 => /usr/lib/aarch64-linux-gnu/libopen-pal.so.40 (0x0000ffff852e9000)
#18 0.140   libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000ffff852d5000)
#18 0.140   libhdf5_serial_hl.so.100 => /usr/lib/aarch64-linux-gnu/libhdf5_serial_hl.so.100 (0x0000ffff852a3000)
#18 0.140   libhdf5_serial.so.103 => /usr/lib/aarch64-linux-gnu/libhdf5_serial.so.103 (0x0000ffff84edf000)
#18 0.140   libcurl-gnutls.so.4 => /usr/lib/aarch64-linux-gnu/libcurl-gnutls.so.4 (0x0000ffff84e3e000)
#18 0.140   libopen-rte.so.40 => /usr/lib/aarch64-linux-gnu/libopen-rte.so.40 (0x0000ffff84d6c000)
#18 0.140   libhwloc.so.15 => /usr/lib/aarch64-linux-gnu/libhwloc.so.15 (0x0000ffff84d0a000)
#18 0.140   libutil.so.1 => /lib/aarch64-linux-gnu/libutil.so.1 (0x0000ffff84cf6000)
#18 0.140   libevent_core-2.1.so.7 => /usr/lib/aarch64-linux-gnu/libevent_core-2.1.so.7 (0x0000ffff84cad000)
#18 0.140   libevent_pthreads-2.1.so.7 => /usr/lib/aarch64-linux-gnu/libevent_pthreads-2.1.so.7 (0x0000ffff84c98000)
#18 0.140   libsz.so.2 => /usr/lib/aarch64-linux-gnu/libsz.so.2 (0x0000ffff84c85000)
#18 0.140   libz.so.1 => /lib/aarch64-linux-gnu/libz.so.1 (0x0000ffff84c5b000)
#18 0.140   libnghttp2.so.14 => /usr/lib/aarch64-linux-gnu/libnghttp2.so.14 (0x0000ffff84c1f000)
#18 0.140   libidn2.so.0 => /usr/lib/aarch64-linux-gnu/libidn2.so.0 (0x0000ffff84bef000)
#18 0.140   librtmp.so.1 => /usr/lib/aarch64-linux-gnu/librtmp.so.1 (0x0000ffff84bc0000)
#18 0.140   libssh2.so.1 => /usr/lib/aarch64-linux-gnu/libssh2.so.1 (0x0000ffff84b7e000)
#18 0.140   libpsl.so.5 => /usr/lib/aarch64-linux-gnu/libpsl.so.5 (0x0000ffff84b5c000)
#18 0.140   libnettle.so.8 => /usr/lib/aarch64-linux-gnu/libnettle.so.8 (0x0000ffff84b09000)
#18 0.140   libgnutls.so.30 => /usr/lib/aarch64-linux-gnu/libgnutls.so.30 (0x0000ffff848ed000)
#18 0.140   libgssapi_krb5.so.2 => /usr/lib/aarch64-linux-gnu/libgssapi_krb5.so.2 (0x0000ffff8488f000)
#18 0.140   libldap_r-2.4.so.2 => /usr/lib/aarch64-linux-gnu/libldap_r-2.4.so.2 (0x0000ffff84828000)
#18 0.140   liblber-2.4.so.2 => /usr/lib/aarch64-linux-gnu/liblber-2.4.so.2 (0x0000ffff84809000)
#18 0.140   libbrotlidec.so.1 => /usr/lib/aarch64-linux-gnu/libbrotlidec.so.1 (0x0000ffff847ee000)
#18 0.140   libudev.so.1 => /usr/lib/aarch64-linux-gnu/libudev.so.1 (0x0000ffff847b7000)
#18 0.140   libaec.so.0 => /usr/lib/aarch64-linux-gnu/libaec.so.0 (0x0000ffff8479f000)
#18 0.140   libunistring.so.2 => /usr/lib/aarch64-linux-gnu/libunistring.so.2 (0x0000ffff84611000)
#18 0.140   libhogweed.so.6 => /usr/lib/aarch64-linux-gnu/libhogweed.so.6 (0x0000ffff845b9000)
#18 0.140   libgmp.so.10 => /usr/lib/aarch64-linux-gnu/libgmp.so.10 (0x0000ffff84531000)
#18 0.140   libgcrypt.so.20 => /usr/lib/aarch64-linux-gnu/libgcrypt.so.20 (0x0000ffff84461000)
#18 0.140   libp11-kit.so.0 => /usr/lib/aarch64-linux-gnu/libp11-kit.so.0 (0x0000ffff84312000)
#18 0.140   libtasn1.so.6 => /usr/lib/aarch64-linux-gnu/libtasn1.so.6 (0x0000ffff842ec000)
#18 0.140   libkrb5.so.3 => /usr/lib/aarch64-linux-gnu/libkrb5.so.3 (0x0000ffff84203000)
#18 0.140   libk5crypto.so.3 => /usr/lib/aarch64-linux-gnu/libk5crypto.so.3 (0x0000ffff841c5000)
#18 0.140   libcom_err.so.2 => /lib/aarch64-linux-gnu/libcom_err.so.2 (0x0000ffff841b1000)
#18 0.140   libkrb5support.so.0 => /usr/lib/aarch64-linux-gnu/libkrb5support.so.0 (0x0000ffff84194000)
#18 0.140   libresolv.so.2 => /lib/aarch64-linux-gnu/libresolv.so.2 (0x0000ffff8416b000)
#18 0.140   libsasl2.so.2 => /usr/lib/aarch64-linux-gnu/libsasl2.so.2 (0x0000ffff8413f000)
#18 0.140   libbrotlicommon.so.1 => /usr/lib/aarch64-linux-gnu/libbrotlicommon.so.1 (0x0000ffff8410e000)
#18 0.140   libgpg-error.so.0 => /lib/aarch64-linux-gnu/libgpg-error.so.0 (0x0000ffff840db000)
#18 0.140   libffi.so.7 => /usr/lib/aarch64-linux-gnu/libffi.so.7 (0x0000ffff840c2000)
#18 0.140   libkeyutils.so.1 => /lib/aarch64-linux-gnu/libkeyutils.so.1 (0x0000ffff840ab000)
#18 DONE 0.1s

#19 [16/19] RUN ldd /usr/local/bin/octopus | grep libsym
#19 sha256:58e3dec93cb5c5b4b6f37ec1717825930bb47d946f7b2c95fbbb35cf50598742
#19 0.289   libsymspg.so.0 => not found
#19 DONE 0.3s
fangohr commented 10 months ago

The file is available at /usr/local/lib/libsymspg.so.0.

Once I set a LD_LIBRARY_PATH, it is found, and everything seems to work:

root@170c8cf7da26:/usr/local# echo $LD_LIBRARY_PATH/
/usr/local/lib/
root@170c8cf7da26:/usr/local# octopus --version
octopus mercatoris (git commit 566e66d9fd5b3beccbd48baffce1dcbeaa0fc805)
root@170c8cf7da26:/usr/local# ldd /usr/local/bin/octopus 
    linux-vdso.so.1 (0x0000ffffbed40000)
    libsymspg.so.0 => /usr/local/lib/libsymspg.so.0 (0x0000ffffbd94d000)
    libnetcdff.so.7 => /usr/lib/aarch64-linux-gnu/libnetcdff.so.7 (0x0000ffffbd8b3000)
    libnlopt.so.0 => /usr/lib/aarch64-linux-gnu/libnlopt.so.0 (0x0000ffffbd846000)
    libfftw3_omp.so.3 => /usr/lib/aarch64-linux-gnu/libfftw3_omp.so.3 (0x0000ffffbd82f000)
    libfftw3.so.3 => /usr/lib/aarch64-linux-gnu/libfftw3.so.3 (0x0000ffffbd764000)
    liblapack.so.3 => /usr/lib/aarch64-linux-gnu/liblapack.so.3 (0x0000ffffbd1f4000)
    libblas.so.3 => /usr/lib/aarch64-linux-gnu/libblas.so.3 (0x0000ffffbd1aa000)
    libgsl.so.25 => /usr/lib/aarch64-linux-gnu/libgsl.so.25 (0x0000ffffbcf02000)
    libxcf03.so.5 => /usr/lib/aarch64-linux-gnu/libxcf03.so.5 (0x0000ffffbceeb000)
    libstdc++.so.6 => /usr/lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000ffffbcd13000)
    libgfortran.so.5 => /usr/lib/aarch64-linux-gnu/libgfortran.so.5 (0x0000ffffbcba9000)
    libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffffbcafe000)
    libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffffbcada000)
    libmpi_mpifh.so.40 => /usr/lib/aarch64-linux-gnu/libmpi_mpifh.so.40 (0x0000ffffbca65000)
    libgomp.so.1 => /usr/lib/aarch64-linux-gnu/libgomp.so.1 (0x0000ffffbca18000)
    libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffffbc9e7000)
    libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffffbc873000)
    /lib/ld-linux-aarch64.so.1 (0x0000ffffbed10000)
    libnetcdf.so.18 => /usr/lib/aarch64-linux-gnu/libnetcdf.so.18 (0x0000ffffbc734000)
    libatlas.so.3 => /usr/lib/aarch64-linux-gnu/libatlas.so.3 (0x0000ffffbc4ab000)
    libgslcblas.so.0 => /usr/lib/aarch64-linux-gnu/libgslcblas.so.0 (0x0000ffffbc46a000)
    libxc.so.5 => /usr/lib/aarch64-linux-gnu/libxc.so.5 (0x0000ffffbc053000)
    libmpi.so.40 => /usr/lib/aarch64-linux-gnu/libmpi.so.40 (0x0000ffffbbf1f000)
    libopen-pal.so.40 => /usr/lib/aarch64-linux-gnu/libopen-pal.so.40 (0x0000ffffbbe5c000)
    libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000ffffbbe48000)
    libhdf5_serial_hl.so.100 => /usr/lib/aarch64-linux-gnu/libhdf5_serial_hl.so.100 (0x0000ffffbbe16000)
    libhdf5_serial.so.103 => /usr/lib/aarch64-linux-gnu/libhdf5_serial.so.103 (0x0000ffffbba52000)
    libcurl-gnutls.so.4 => /usr/lib/aarch64-linux-gnu/libcurl-gnutls.so.4 (0x0000ffffbb9b1000)
    libopen-rte.so.40 => /usr/lib/aarch64-linux-gnu/libopen-rte.so.40 (0x0000ffffbb8df000)
    libhwloc.so.15 => /usr/lib/aarch64-linux-gnu/libhwloc.so.15 (0x0000ffffbb87d000)
    libutil.so.1 => /lib/aarch64-linux-gnu/libutil.so.1 (0x0000ffffbb869000)
    libevent_core-2.1.so.7 => /usr/lib/aarch64-linux-gnu/libevent_core-2.1.so.7 (0x0000ffffbb820000)
    libevent_pthreads-2.1.so.7 => /usr/lib/aarch64-linux-gnu/libevent_pthreads-2.1.so.7 (0x0000ffffbb80b000)
    libsz.so.2 => /usr/lib/aarch64-linux-gnu/libsz.so.2 (0x0000ffffbb7f8000)
    libz.so.1 => /lib/aarch64-linux-gnu/libz.so.1 (0x0000ffffbb7ce000)
    libnghttp2.so.14 => /usr/lib/aarch64-linux-gnu/libnghttp2.so.14 (0x0000ffffbb792000)
    libidn2.so.0 => /usr/lib/aarch64-linux-gnu/libidn2.so.0 (0x0000ffffbb762000)
    librtmp.so.1 => /usr/lib/aarch64-linux-gnu/librtmp.so.1 (0x0000ffffbb733000)
    libssh2.so.1 => /usr/lib/aarch64-linux-gnu/libssh2.so.1 (0x0000ffffbb6f1000)
    libpsl.so.5 => /usr/lib/aarch64-linux-gnu/libpsl.so.5 (0x0000ffffbb6cf000)
    libnettle.so.8 => /usr/lib/aarch64-linux-gnu/libnettle.so.8 (0x0000ffffbb67c000)
    libgnutls.so.30 => /usr/lib/aarch64-linux-gnu/libgnutls.so.30 (0x0000ffffbb460000)
    libgssapi_krb5.so.2 => /usr/lib/aarch64-linux-gnu/libgssapi_krb5.so.2 (0x0000ffffbb402000)
    libldap_r-2.4.so.2 => /usr/lib/aarch64-linux-gnu/libldap_r-2.4.so.2 (0x0000ffffbb39b000)
    liblber-2.4.so.2 => /usr/lib/aarch64-linux-gnu/liblber-2.4.so.2 (0x0000ffffbb37c000)
    libbrotlidec.so.1 => /usr/lib/aarch64-linux-gnu/libbrotlidec.so.1 (0x0000ffffbb361000)
    libudev.so.1 => /usr/lib/aarch64-linux-gnu/libudev.so.1 (0x0000ffffbb32a000)
    libaec.so.0 => /usr/lib/aarch64-linux-gnu/libaec.so.0 (0x0000ffffbb312000)
    libunistring.so.2 => /usr/lib/aarch64-linux-gnu/libunistring.so.2 (0x0000ffffbb184000)
    libhogweed.so.6 => /usr/lib/aarch64-linux-gnu/libhogweed.so.6 (0x0000ffffbb12c000)
    libgmp.so.10 => /usr/lib/aarch64-linux-gnu/libgmp.so.10 (0x0000ffffbb0a4000)
    libgcrypt.so.20 => /usr/lib/aarch64-linux-gnu/libgcrypt.so.20 (0x0000ffffbafd4000)
    libp11-kit.so.0 => /usr/lib/aarch64-linux-gnu/libp11-kit.so.0 (0x0000ffffbae85000)
    libtasn1.so.6 => /usr/lib/aarch64-linux-gnu/libtasn1.so.6 (0x0000ffffbae5f000)
    libkrb5.so.3 => /usr/lib/aarch64-linux-gnu/libkrb5.so.3 (0x0000ffffbad76000)
    libk5crypto.so.3 => /usr/lib/aarch64-linux-gnu/libk5crypto.so.3 (0x0000ffffbad38000)
    libcom_err.so.2 => /lib/aarch64-linux-gnu/libcom_err.so.2 (0x0000ffffbad24000)
    libkrb5support.so.0 => /usr/lib/aarch64-linux-gnu/libkrb5support.so.0 (0x0000ffffbad07000)
    libresolv.so.2 => /lib/aarch64-linux-gnu/libresolv.so.2 (0x0000ffffbacde000)
    libsasl2.so.2 => /usr/lib/aarch64-linux-gnu/libsasl2.so.2 (0x0000ffffbacb2000)
    libbrotlicommon.so.1 => /usr/lib/aarch64-linux-gnu/libbrotlicommon.so.1 (0x0000ffffbac81000)
    libgpg-error.so.0 => /lib/aarch64-linux-gnu/libgpg-error.so.0 (0x0000ffffbac4e000)
    libffi.so.7 => /usr/lib/aarch64-linux-gnu/libffi.so.7 (0x0000ffffbac35000)
    libkeyutils.so.1 => /lib/aarch64-linux-gnu/libkeyutils.so.1 (0x0000ffffbac1e000)
fangohr commented 10 months ago

The only (from the log and diffs) obvious change in the octopus source since 13.0 affecting the spglib is this merge request: https://gitlab.com/octopus-code/octopus/-/merge_requests/2203#223b88ed92041047578558955bddba830aac1c5d

I have not checked if the version before that MR builds fine.

fangohr commented 10 months ago

A pull request to this repo, which "fixes" the issue by setting the LD_LIBRARY_PATH is #8 (Note that the first few commits are misleading as I thought at first we needed a new Debian package installed.)

I suspect there should be a different solution though?

iamashwin99 commented 10 months ago

the relevant MR in octopus is perhaps https://gitlab.com/octopus-code/octopus/-/merge_requests/2205#top, where the copy of the external library was upgraded. The logs you showed, mentions that this external lib is compiled during the build stage.

2023-12-19T23:13:45.7301908Z #15 23.80 config.status: executing libtool commands
2023-12-19T23:13:45.7302868Z #15 23.81 === configuring in external_libs/spglib-2.1.0 (/opt/octopus/external_libs/spglib-2.1.0)
2023-12-19T23:13:45.7304073Z #15 23.82 configure: running /bin/bash ./configure --disable-option-checking '--prefix=/usr/local'  '--enable-mpi' '--enable-openmp' --cache-file=/dev/null --srcdir=.
2023-12-19T23:13:45.8317971Z #15 23.89 checking for a BSD-compatible install... /usr/bin/install -c
iamashwin99 commented 10 months ago

So the fix in this MR is not the solution, as we are compiling octopus spglib (@2.0.2), but linking against system spglib (@debian-1.16.1)

fangohr commented 10 months ago

I did two more experiments: If I try to build octopus (in this container) using this commit:

commit 2261062f40c090dbcbfc3d8e230d1b176601817f
Merge: bc9757bd9 22f96007b
Author: Micael Oliveira <micaeljtoliveira@gmail.com>
Date:   Thu Dec 7 00:05:24 2023 +0000

    Merge branch 'iteration_counters' into 'main'

    Introduce generic iteration counters in multisystem framework

    Closes #634

    See merge request octopus-code/octopus!2242

then it builds fine.

The next commit (11 minutes later) is

commit 37170540e31b03278df71e6be2ebc1e1c2d063d8
Merge: 2261062f4 2db69a403
Author: Micael Oliveira <micaeljtoliveira@gmail.com>
Date:   Thu Dec 7 00:16:25 2023 +0000

    Merge branch 'spglib-2.0.2' into 'main'

    Add spglib 2.1.0 source

    See merge request octopus-code/octopus!2205

and with this one the compilation fails.

So it looks like with this MR the problem was introduced.

iamashwin99 commented 10 months ago

One speculation to this problem from https://github.com/fangohr/octopus-in-docker/pull/10 is that perhaps a newer version of the spglib builds share libraries by default but in the past ( the old ones) spglib is built as a static library, which meant that the spglib was included inside the octopus binary.

fangohr commented 7 months ago

We debugged this with Henning. Conclusion:

/usr/local/lib (perhaps more) is not considered by ld.so if the command is run as root.

So setting the path explicitly in our container is okay. We should document why we do this, though. (Because the executing user is ~root~.)

fangohr commented 7 months ago

closed by #26