Electrostatics / apbs-pdb2pqr

APBS - software for biomolecular electrostatics and solvation
http://www.poissonboltzmann.org/
128 stars 62 forks source link

Double-check Cmake build #589

Closed sobolevnrm closed 4 years ago

sobolevnrm commented 4 years ago

Nathan probably messed it up. Stand by for offending commit.

Sorry, @intendo...

sobolevnrm commented 4 years ago

Need to update https://github.com/Electrostatics/apbs-pdb2pqr/blob/master/pdb2pqr/README.md after we confirm that Cmake is working.

sobolevnrm commented 4 years ago

I'm posting instructions on the Cmake build from @intendo here:

rm -rf build && mkdir build && cd build && cmake -DENABLE_PYTHON=ON .. && cmake --build . && ctest . && cd ..
sobolevnrm commented 4 years ago

When running WSL Ubuntu 18.04 on Windows 10, I run the following commands:

rm -rf build/
. ~/venvs/apbs/bin/activate
mkdir build
cd build
cmake -DENABLE_PYTHON=ON ..
cmake --build .

Everything goes well until the end, when I receive the error:

[100%] Linking C shared library ../../lib/_apbslib.so
/usr/bin/cc -fPIC -O2 -g -DNDEBUG  -shared -Wl,-soname,_apbslib.so -o ../../lib/_apbslib.so CMakeFiles/_apbslib.dir/CMakeFiles/_apbslib.dir/apbslibPYTHON_wrap.c.o   -L/mnt/c/Users/bake113/Git/apbs-pdb2pqr/apbs/externals/fetk/maloc/lib
-Wl,-rpath,/mnt/c/Users/bake113/Git/apbs-pdb2pqr/apbs/externals/fetk/maloc/lib:/home/bake113/venvs/apbs/lib/python3.6/config-3.6m-x86_64-linux-gnu -lm -lstdc++ ../../../../apbs/externals/fetk/maloc/lib/libmaloc.a ../../lib/libapbs_generic.a ../../lib/libapbs_pmgc.a ../../lib/libapbs_mg.a ../../lib/libapbs_routines.a /home/bake113/venvs/apbs/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.so ../../lib/libapbs_generic.a ../../lib/libapbs_pmgc.a -lm -lstdc++ ../../../../apbs/externals/fetk/maloc/lib/libmaloc.a
/usr/bin/ld: ../../lib/libapbs_generic.a(mgparm.c.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
apbs/tools/python/CMakeFiles/_apbslib.dir/build.make:115: recipe for target 'apbs/lib/_apbslib.so' failed
make[2]: *** [apbs/lib/_apbslib.so] Error 1
CMakeFiles/Makefile2:1133: recipe for target 'apbs/tools/python/CMakeFiles/_apbslib.dir/all' failed
make[1]: *** [apbs/tools/python/CMakeFiles/_apbslib.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

Adding -DCMAKE_C_FLAGS="-fPIC" to the initial cmake command fixed this problem.

intendo commented 4 years ago

Since this is working in Github Actions and we made the releases for 3.0.0, I think the CMake builds are correct.