rrwick / Porechop

adapter trimmer for Oxford Nanopore reads
GNU General Public License v3.0
323 stars 124 forks source link

could not find cpp_functions.so - please reinstall #8

Closed jordur closed 7 years ago

jordur commented 7 years ago

Hi all/ rrwick, I got the error above triying to install porechop following the commands below: $git clone https://github.com/rrwick/Porechop.git $cd Porechop/ $python setup.py install

Indeed I tried without installation and I got the same error: $./porechop-runner.py

I am running Python 3.4.5 Could you help me with that issue? Thanks a lot

jordur commented 7 years ago

Ok! I didn't meet the requirement of gcc version 4.9.1 or later. I am using g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11). Since I am trying to run porechop in a grid enviroment, do you know if there is a way to install a newest gcc compiler on a local directory? Thank you

rrwick commented 7 years ago

I'm not very savvy with Red Hat - perhaps you can get a more search GCC using yum? If not, it's always possible to download the GCC source and build it. I've done this before and it's not too complicated (if you're used to building things from source), but it does take a looooooooong time to finish.

If getting a fresh version of GCC is too much of a pain, you could always try another compiler, like Clang. Again, yum install might be able to install it for you - I'm not sure.

When you do get an appropriate compiler up and running, you can tell the setup script or makefile to use it with the CXX variable. For example: export CXX=path/to/g++-5; python3 setup.py install

donutbrew commented 7 years ago

Don't know if you all use modules (http://modules.sourceforge.net) in your grid environment, but it makes issues like people needing different versions of things much easier to deal with.

jordur commented 7 years ago

Hi! Finally I had the chance to install gcc 6.2 locally. However Porechop installation was unsuccessful. Here the code:

## As read in Makefile, I tried to install Porechop with a particular compiler
[jdurban@trueno-login01 Porechop]$ make CXX=/home/ibv/jdurban/programas/gcc6.2/bin/g++6
/home/ibv/jdurban/programas/gcc6.2/bin/g++6 -std=c++14 -Iporechop/include -fPIC -O3 -D NDEBUG -Wall -Wextra -pedantic -march=native -c -o porechop/src/alignment.o porechop/src/alignment.cpp
/home/ibv/jdurban/programas/gcc6.2/bin/g++6 -std=c++14 -Iporechop/include -fPIC -O3 -D NDEBUG -Wall -Wextra -pedantic -march=native -c -o porechop/src/adapter_align.o porechop/src/adapter_align.cpp
/home/ibv/jdurban/programas/gcc6.2/bin/g++6 -std=c++14 -Iporechop/include -fPIC -O3 -D NDEBUG -Wall -Wextra -pedantic -march=native -shared -Wl,-soname,porechop/cpp_functions.so -o porechop/cpp_functions.so porechop/src/alignment.o porechop/src/adapter_align.o

# I checked my python version
[jdurban@trueno-login01 Porechop]$ python -V
Python 2.7.5

# I used a virtualenv python3 installation
[jdurban@trueno-login01 Porechop]$ source ~/programas/virtualenv/myVE_3/bin/activate
(myVE_3) [jdurban@trueno-login01 Porechop]$ python -V
Python 3.4.5

# I tried to install Porechop
(myVE_3) [jdurban@trueno-login01 Porechop]$ python setup.py install
running install
running build
running build_py
Cleaning previous compilation: make clean
rm -f porechop/src/alignment.o porechop/src/adapter_align.o
Compiling Porechop: make -j 8
g++ -std=c++14 -Iporechop/include -fPIC -O3 -D NDEBUG -Wall -Wextra -pedantic -march=native -c -o porechop/src/alignment.o porechop/src/alignment.cpp
g++: error: unrecognized command line option ‘-std=c++14’
make: *** [porechop/src/alignment.o] Error 1
running install_lib
running install_egg_info
running egg_info
writing entry points to porechop.egg-info/entry_points.txt
writing porechop.egg-info/PKG-INFO
writing top-level names to porechop.egg-info/top_level.txt
writing dependency_links to porechop.egg-info/dependency_links.txt
reading manifest file 'porechop.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'porechop.egg-info/SOURCES.txt'
removing '/home/ibv/jdurban/programas/virtualenv/myVE_3/lib/python3.4/site-packages/porechop-0.2.0-py3.4.egg-info' (and everything under it)
Copying porechop.egg-info to /home/ibv/jdurban/programas/virtualenv/myVE_3/lib/python3.4/site-packages/porechop-0.2.0-py3.4.egg-info
running install_scripts
Installing porechop script to /home/ibv/jdurban/programas/virtualenv/myVE_3/bin

As you can see I got the following error:

g++: error: unrecognized command line option ‘-std=c++14’

How can I overcome the error? What I am doing wrong? Thank you for your suggestions. Regards

rrwick commented 7 years ago

I think you're most of the way there! After you went into the virtual environment, you used the system's default g++, which wasn't the new version you just built.

When in your virtualenv, try this command to install: export CXX=/home/ibv/jdurban/programas/gcc6.2/bin/g++6; python3 setup.py install

jordur commented 7 years ago

Done! I executed the following script:

export CC=/home/ibv/jdurban/programas/gcc6.2/bin/gcc6
export CXX=/home/ibv/jdurban/programas/gcc6.2/bin/g++6
export LIBRARY_PATH=/home/ibv/jdurban/programas/gcc6.2/lib64:$LIBRARY_PATH
cd /home/ibv/jdurban/programas/Porechop
make clean
source ~/programas/virtualenv/myVE_3/bin/activate
python setup.py install

And finally it works! PS I had to export also the LIBRARY_PATH because I got the following error:

OSError: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /home/ibv/jdurban/programas/Porechop/porechop/cpp_functions.so)

Just if this can help anyone! Thank you so much!

rrwick commented 7 years ago

Glad to hear it! Sorry it was such a challenge. The SeqAn library I use for the alignment algorithms requires C++14, which is pain for Linux distros with older GCC versions.

jkibilds commented 5 years ago

Since I suspect that many people are still struggling with this in some form or another, I will share what worked for me. I have g++ version 7.3.0 on CentOS, installed via conda conda install -c anaconda gxx_linux-64 The problem was that the system was looking for g++ in a system-wide location where gcc version was <4.9.1, and it also was using wrong flags for compilation. If you look into the Makefile you can see that there are options to override the default CXX and CXXFLAGS variables. So my success story went like this:

# get an up-to-date version of GCC that supports C++14:
conda install -c anaconda gxx_linux-64
# download and compile Porechop:
git clone https://github.com/rrwick/Porechop.git
cd Porechop/
make CXX=/home/juriski/.conda/envs/porechop/bin/x86_64-conda_cos6-linux-gnu-g++ CXXFLAGS="-Wall -Wextra -pedantic -mtune=native -std=c++14"
# check that Porechop works:
./porechop-runner.py -h