mummer4 / mummer

Mummer alignment tool
Artistic License 2.0
433 stars 108 forks source link

Failed to make a SWIG binding installation from mummer-4.0.0beta2 #181

Closed alihamraoui closed 2 years ago

alihamraoui commented 2 years ago

I get an error while trying to make install a SWIG binding installation of mummer-4.0.0beta2 : to compile the code from git, I used :

cd mummer-4.0.0beta2/ autoreconf -fi ./configure --enable-python-binding make -j 10 sudo make install

The Error from sudo make install :

`make install-am make[1] : on entre dans le répertoire « /import/rhodos02/homes-net/sgdb/hamraoui/mummer-4.0.0beta2 » make[2] : on entre dans le répertoire « /import/rhodos02/homes-net/sgdb/hamraoui/mummer-4.0.0beta2 » /usr/bin/mkdir -p '/usr/local/lib' /bin/bash ./libtool --mode=install /usr/bin/install -c libumdmummer.la '/usr/local/lib' libtool: install: /usr/bin/install -c .libs/libumdmummer.so.0.0.0 /usr/local/lib/libumdmummer.so.0.0.0 libtool: install: (cd /usr/local/lib && { ln -s -f libumdmummer.so.0.0.0 libumdmummer.so.0 || { rm -f libumdmummer.so.0 && ln -s libumdmummer.so.0.0.0 libumdmummer.so.0; }; }) libtool: install: (cd /usr/local/lib && { ln -s -f libumdmummer.so.0.0.0 libumdmummer.so || { rm -f libumdmummer.so && ln -s libumdmummer.so.0.0.0 libumdmummer.so; }; }) libtool: install: /usr/bin/install -c .libs/libumdmummer.lai /usr/local/lib/libumdmummer.la libtool: install: /usr/bin/install -c .libs/libumdmummer.a /usr/local/lib/libumdmummer.a libtool: install: chmod 644 /usr/local/lib/libumdmummer.a libtool: install: ranlib /usr/local/lib/libumdmummer.a libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /usr/local/lib

Libraries have been installed in: /usr/local/lib

If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the '-LLIBDIR' flag during linking and do at least one of the following:

See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages.

/usr/bin/mkdir -p '/usr/local/bin' /bin/bash ./libtool --mode=install /usr/bin/install -c mummer show-coords show-aligns show-snps show-tiling show-diff repeat-match annotate combineMUMs delta-filter nucmer '/usr/local/bin' libtool: install: /usr/bin/install -c .libs/mummer /usr/local/bin/mummer libtool: install: /usr/bin/install -c .libs/show-coords /usr/local/bin/show-coords libtool: install: /usr/bin/install -c .libs/show-aligns /usr/local/bin/show-aligns libtool: install: /usr/bin/install -c .libs/show-snps /usr/local/bin/show-snps libtool: install: /usr/bin/install -c .libs/show-tiling /usr/local/bin/show-tiling libtool: install: /usr/bin/install -c .libs/show-diff /usr/local/bin/show-diff libtool: install: /usr/bin/install -c .libs/repeat-match /usr/local/bin/repeat-match libtool: install: /usr/bin/install -c .libs/annotate /usr/local/bin/annotate libtool: install: /usr/bin/install -c .libs/combineMUMs /usr/local/bin/combineMUMs libtool: install: /usr/bin/install -c .libs/delta-filter /usr/local/bin/delta-filter libtool: install: /usr/bin/install -c .libs/nucmer /usr/local/bin/nucmer /usr/bin/mkdir -p '/usr/local/bin' /usr/bin/install -c .libs/mummerplot .libs/dnadiff .libs/promer .libs/exact-tandems '/usr/local/bin' /usr/bin/mkdir -p '/usr/local/libexec/mummer' /bin/bash ./libtool --mode=install /usr/bin/install -c mgaps postnuc prepro postpro '/usr/local/libexec/mummer' libtool: install: /usr/bin/install -c .libs/mgaps /usr/local/libexec/mummer/mgaps libtool: install: /usr/bin/install -c .libs/postnuc /usr/local/libexec/mummer/postnuc libtool: install: /usr/bin/install -c .libs/prepro /usr/local/libexec/mummer/prepro libtool: install: /usr/bin/install -c .libs/postpro /usr/local/libexec/mummer/postpro /usr/bin/mkdir -p '/usr/local/include/mummer-4.0.0beta2' /usr/bin/mkdir -p '/usr/local/include/mummer-4.0.0beta2/include/mt_skip_list' /usr/bin/install -c -m 644 include/mt_skip_list/common.hpp include/mt_skip_list/set.hpp '/usr/local/include/mummer-4.0.0beta2/include/mt_skip_list' /usr/bin/mkdir -p '/usr/local/include/mummer-4.0.0beta2/include/compactsufsort' /usr/bin/install -c -m 644 include/compactsufsort/compactsufsort.hpp include/compactsufsort/const_iterator_traits.hpp include/compactsufsort/said_traits.hpp include/compactsufsort/trsort_imp.hpp include/compactsufsort/compactsufsort_imp.hpp include/compactsufsort/divsufsort_private.h include/compactsufsort/sssort_imp.hpp '/usr/local/include/mummer-4.0.0beta2/include/compactsufsort' /usr/bin/mkdir -p '/usr/local/include/mummer-4.0.0beta2/include/mummer' /usr/bin/install -c -m 644 include/mummer/sparseSA.hpp include/mummer/fasta.hpp include/mummer/postnuc.hh include/mummer/translate.hh include/mummer/sw_align.hh include/mummer/tigrinc.hh include/mummer/nucmer.hpp include/mummer/mgaps.hh include/mummer/delta.hh include/mummer/sw_alignscore.hh include/mummer/sparseSA_imp.hpp include/mummer/timer.hpp include/mummer/48bit_index.hpp include/mummer/48bit_iterator.hpp include/mummer/const_iterator_traits.hpp include/mummer/dset.hpp include/mummer/openmp_qsort.hpp include/mummer/redirect_to_pager.hpp '/usr/local/include/mummer-4.0.0beta2/include/mummer' /usr/bin/mkdir -p '/usr/local/include/mummer-4.0.0beta2/include' /usr/bin/install -c -m 644 include/thread_pipe.hpp '/usr/local/include/mummer-4.0.0beta2/include' /usr/bin/mkdir -p '/usr/local/include/mummer-4.0.0beta2/include/thread_pipe' /usr/bin/install -c -m 644 include/thread_pipe/circular_buffer.hpp include/thread_pipe/cooperative_pool2.hpp include/thread_pipe/divisor.hpp include/thread_pipe/traits.hpp '/usr/local/include/mummer-4.0.0beta2/include/thread_pipe' /usr/bin/mkdir -p '/usr/local/include/mummer-4.0.0beta2/include/jellyfish' /usr/bin/install -c -m 644 include/jellyfish/circular_buffer.hpp include/jellyfish/cooperative_pool2.hpp include/jellyfish/cpp_array.hpp include/jellyfish/divisor.hpp include/jellyfish/stream_manager.hpp include/jellyfish/whole_sequence_parser.hpp '/usr/local/include/mummer-4.0.0beta2/include/jellyfish' /usr/bin/mkdir -p '/usr/local/lib/pkgconfig' /usr/bin/install -c -m 644 mummer.pc '/usr/local/lib/pkgconfig' /usr/bin/mkdir -p '/home/hamraoui/miniconda3/lib/python3.9/site-packages/mummer' /bin/bash ./libtool --mode=install /usr/bin/install -c swig/python/_mummer.la '/home/hamraoui/miniconda3/lib/python3.9/site-packages/mummer' libtool: warning: relinking 'swig/python/_mummer.la' libtool: install: (cd /home/hamraoui/home-net/mummer-4.0.0beta2; /bin/bash "/home/hamraoui/home-net/mummer-4.0.0beta2/libtool" --silent --tag CXX --mode=relink g++ -std=c++11 -fopenmp -DNDEBUG -std=c++0x -g -O2 -module -o swig/python/_mummer.la -rpath /home/hamraoui/miniconda3/lib/python3.9/site-packages/mummer swig/python/swig_python__mummer_la-swig_wrap.lo libumdmummer.la ) mv: cannot move '_mummer.so.0.0.0' to '_mummer.so.0.0.0U': Permission denied libtool: error: error: relink 'swig/python/_mummer.la' with the above command before installing it make[2]: [Makefile:1356 : install-pythonextLTLIBRARIES] Erreur 1 make[2] : on quitte le répertoire « /import/rhodos02/homes-net/sgdb/hamraoui/mummer-4.0.0beta2 » make[1]: [Makefile:2651 : install-am] Erreur 2 make[1] : on quitte le répertoire « /import/rhodos02/homes-net/sgdb/hamraoui/mummer-4.0.0beta2 » make: *** [Makefile:2645 : install] Erreur 2 ` Any ideas of what I am doing wrong?

Thanks in advance! Ali

gmarcais commented 2 years ago

Is your local drive on NFS with root squash flag turned on? There is a permission error moving a local file: "mv: cannot move '_mummer.so.0.0.0' to '_mummer.so.0.0.0U': Permission denied". Where as creating directories in /usr/local worked. The usual reason for root to not be able to work with files in a home directory is when home is mounted from NFS with root squash.

The fact that make install requires sometimes write access to the local drive (here it relinks a shared library) is annoying, but it is the normal way that libtool works. I don't think I can "fix" it. You need to install from a directory that root can write to.

alihamraoui commented 2 years ago

Thanks @gmarcais, that seems fixed it for me!


Libraries have been installed in:
   /usr/lib/python3.8/mummer

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /usr/bin/mkdir -p '/usr/lib/python3.8/mummer'
 /usr/bin/install -c swig/python/__init__.pyc '/usr/lib/python3.8/mummer'
 /usr/bin/mkdir -p '/usr/local/lib/mummer'
 /usr/bin/install -c scripts/Foundation.pm scripts/tandem-repeat.awk `/usr/local/lib/mummer`

However, I still have some issues while trying to import mummer library in my python script: I would like to test your script example mummer/blob/master/examples/align.py : ~/Bureau/test$ python3.8 align.py sx.fa qx.fa i get this :

Traceback (most recent call last):
  File "align.py", line 1, in <module>
    import mummer
ImportError: bad magic number in 'mummer': b'a\r\r\n'

i tried to fix it with : sudo rm /usr/lib/python3.8/mummer/*.pyc

i get :

(base) hamraoui@eldir:~/Bureau/test$ python3.8 align.py sx.fa qx.fa 
Traceback (most recent call last):
  File "align.py", line 12, in <module>
    o = mummer.Options()
AttributeError: module 'mummer' has no attribute 'Options'

Thanks for help! Ali

gmarcais commented 2 years ago

I would refrain from removing files like you did, it is unlikely to help and may cause problems with your install.

It seems that the path to Python during compilation and afterward for testing are not the same. You can look in the config.log file to see what Python path was used.

As a minimal example of compilation, here is a Dockerfile that will compile MUMmer and the python binding. (The Docker may not be useful to you per say, but it does give the bare minimum needed to do the compilation) There is only 1 version of python installed in that docker image, version 3.8.

From ubuntu

RUN apt update && DEBIAN_FRONTEND=noninteractive apt-get install -yq python3 python3-dev build-essential wget

RUN wget https://github.com/mummer4/mummer/releases/download/v4.0.0rc1/mummer-4.0.0rc1.tar.gz && \
    tar zxf mummer-4.0.0rc1.tar.gz && \
    cd mummer-4.0.0rc1 && \
    ./configure --enable-python-binding PYTHON_VERSION=3 && \
    make -j 4 && \
    make install && \
    ldconfig

RUN python3 -c 'import mummer; print("success")'

Running docker build . in the same directory as this Dockerfile eventually prints:

Step 4/4 : RUN python3 -c 'import mummer; print("success")'
 ---> Running in 22c3beba68e2
success
Removing intermediate container 22c3beba68e2
 ---> 248698602f2e
Successfully built 248698602f2e

Hope this helps

alihamraoui commented 2 years ago

That is really helpful. Thanks for your support! Ali