PDB-REDO / dssp

Application to assign secondary structure to proteins
BSD 2-Clause "Simplified" License
157 stars 18 forks source link

Error linking mkdssp and unit-test #40

Closed cbaakman closed 2 years ago

cbaakman commented 2 years ago

Hello, I just cloned out the latest version (4.0.6). As I follow the instructions in the README, this happens:

$ cmake --build . --config Release

Scanning dependencies of target unit-test
[ 16%] Building CXX object CMakeFiles/unit-test.dir/test/unit-test.cpp.o
[ 33%] Building CXX object CMakeFiles/unit-test.dir/src/dssp.cpp.o
[ 50%] Linking CXX executable unit-test
/usr/bin/ld: CMakeFiles/unit-test.dir/test/unit-test.cpp.o: relocation R_X86_64_32 against symbol `typeinfo for std::exception@@GLIBCXX_3.4' can not be used when making a PDE object; recompile with -fPIE
/usr/bin/ld: CMakeFiles/unit-test.dir/src/dssp.cpp.o: relocation R_X86_64_32 against symbol `__gxx_personality_v0@@CXXABI_1.3' can not be used when making a PDE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/unit-test.dir/build.make:103: unit-test] Error 1
make[1]: *** [CMakeFiles/Makefile2:106: CMakeFiles/unit-test.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

It says I must recompile with -fPIE, but how do I make the makefile do that?

mhekkel commented 2 years ago

What is the version of libcifpp you have installed? Is that the latest as well?

cbaakman commented 2 years ago

Yes, a clone of the current repository: 4.2.1

mhekkel commented 2 years ago

What OS are you using? And did you install a boost yourself or are you using the system version?

cbaakman commented 2 years ago

The OS is ubuntu 20.04. The boost version is 1.71.0, installed from a release tarball.

mhekkel commented 2 years ago

OK, and that boost, did you build static libraries or shared libraries? What I would like to see as well is the verbose output of cmake. So could you please run the following in the build directory of dssp:

cmake .. -DCMAKE_VERBOSE_MAKEFILE=ON cmake --build . --config Release

That will reconfigure and generate a makefile that is more verbose. The output will then tell what libraries are linked.

cbaakman commented 2 years ago

The lib directory contains both static and shared libraries for boost. (all have a .a and .so file)

Here's the output of cmake:

$ cmake --build . --config Release
/usr/bin/cmake -S/home/cbaakman/projects/dssp -B/home/cbaakman/projects/dssp/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/cbaakman/projects/dssp/build/CMakeFiles /home/cbaakman/projects/dssp/build/CMakeFiles/progress.marks
/usr/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/cbaakman/projects/dssp/build'
/usr/bin/make -f CMakeFiles/unit-test.dir/build.make CMakeFiles/unit-test.dir/depend
make[2]: Entering directory '/home/cbaakman/projects/dssp/build'
cd /home/cbaakman/projects/dssp/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/cbaakman/projects/dssp /home/cbaakman/projects/dssp /home/cbaakman/projects/dssp/build /home/cbaakman/projects/dssp/build /home/cbaakman/projects/dssp/build/CMakeFiles/unit-test.dir/DependInfo.cmake --color=
Dependee "/home/cbaakman/projects/dssp/build/CMakeFiles/unit-test.dir/DependInfo.cmake" is newer than depender "/home/cbaakman/projects/dssp/build/CMakeFiles/unit-test.dir/depend.internal".
Dependee "/home/cbaakman/projects/dssp/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/cbaakman/projects/dssp/build/CMakeFiles/unit-test.dir/depend.internal".
Scanning dependencies of target unit-test
make[2]: Leaving directory '/home/cbaakman/projects/dssp/build'
/usr/bin/make -f CMakeFiles/unit-test.dir/build.make CMakeFiles/unit-test.dir/build
make[2]: Entering directory '/home/cbaakman/projects/dssp/build'
[ 16%] Building CXX object CMakeFiles/unit-test.dir/test/unit-test.cpp.o
/usr/local/bin/c++  -DBOOST_ALL_NO_LIB -DBOOST_DATE_TIME_DYN_LINK -DBOOST_IOSTREAMS_DYN_LINK -DBOOST_REGEX_DYN_LINK -DCACHE_DIR=\"/var/cache/libcifpp\" -DDATA_DIR=\"/home/cbaakman/.local/share/libcifpp\" -I/home/cbaakman/projects/dssp/build -I/home/cbaakman/projects/dssp/PRIVATE -I/home/cbaakman/projects/dssp/src -I/home/cbaakman/projects/dssp/include -isystem /home/cbaakman/.local/include -isystem /usr/local/include  -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers   -std=gnu++17 -o CMakeFiles/unit-test.dir/test/unit-test.cpp.o -c /home/cbaakman/projects/dssp/test/unit-test.cpp
[ 33%] Building CXX object CMakeFiles/unit-test.dir/src/dssp.cpp.o
/usr/local/bin/c++  -DBOOST_ALL_NO_LIB -DBOOST_DATE_TIME_DYN_LINK -DBOOST_IOSTREAMS_DYN_LINK -DBOOST_REGEX_DYN_LINK -DCACHE_DIR=\"/var/cache/libcifpp\" -DDATA_DIR=\"/home/cbaakman/.local/share/libcifpp\" -I/home/cbaakman/projects/dssp/build -I/home/cbaakman/projects/dssp/PRIVATE -I/home/cbaakman/projects/dssp/src -I/home/cbaakman/projects/dssp/include -isystem /home/cbaakman/.local/include -isystem /usr/local/include  -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers   -std=gnu++17 -o CMakeFiles/unit-test.dir/src/dssp.cpp.o -c /home/cbaakman/projects/dssp/src/dssp.cpp
[ 50%] Linking CXX executable unit-test
/usr/bin/cmake -E cmake_link_script CMakeFiles/unit-test.dir/link.txt --verbose=1
/usr/local/bin/c++   -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers   CMakeFiles/unit-test.dir/test/unit-test.cpp.o CMakeFiles/unit-test.dir/src/dssp.cpp.o  -o unit-test  /home/cbaakman/.local/lib/libcifpp.a /usr/local/lib/libboost_date_time.so.1.71.0 -lpthread /usr/local/lib/libboost_regex.so.1.71.0 /usr/local/lib/libboost_iostreams.so.1.71.0 
/usr/bin/ld: CMakeFiles/unit-test.dir/test/unit-test.cpp.o: relocation R_X86_64_32 against symbol `typeinfo for std::exception@@GLIBCXX_3.4' can not be used when making a PDE object; recompile with -fPIE
/usr/bin/ld: CMakeFiles/unit-test.dir/src/dssp.cpp.o: relocation R_X86_64_32 against symbol `__gxx_personality_v0@@CXXABI_1.3' can not be used when making a PDE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/unit-test.dir/build.make:106: unit-test] Error 1
make[2]: Leaving directory '/home/cbaakman/projects/dssp/build'
make[1]: *** [CMakeFiles/Makefile2:109: CMakeFiles/unit-test.dir/all] Error 2
make[1]: Leaving directory '/home/cbaakman/projects/dssp/build'
make: *** [Makefile:144: all] Error 2
mhekkel commented 2 years ago

What c++ compiler are you using? I see /usr/local/bin/c++ That's not the standard c++ coming with Ubuntu.

cbaakman commented 2 years ago

This might help:

$  /usr/local/bin/c++ --version
c++ (GCC) 9.1.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
mhekkel commented 2 years ago

Why are you using a custom gcc when the OS comes with a more recent one. And a custom built libboost when you can install the same version using apt-get?

cbaakman commented 2 years ago

Indeed! I changed the configuration to /usr/bin/g++ . Now the compilation succeeds. Thank you for the trouble.