bschiffthaler / seidr

Toolkit to create crowd networks
GNU General Public License v3.0
2 stars 1 forks source link

build with non-standard location of zlib/boost/gsl #1

Closed orionzhou closed 5 years ago

orionzhou commented 5 years ago

I tried to follow the instruction document to build seidr:

cmake -DCMAKE_BUILD_TYPE=Release ..

but it seems to find system libraries which are old:

-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.7") -- Boost version: 1.53.0

I tried to use:

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/seidr .. -DZLIB_INCLUDE_DIRS=~/miniconda3/include -DZLIB_LIBRARIES=~/miniconda3/lib ..

but it does not seem to work - so how can I tell cmake to use my custom locations of zlib/boost/GSL libraries?

Thanks!

bschiffthaler commented 5 years ago

You can point cmake to most directories by setting environment variables:

BOOST_ROOT=<path_to_boost> ZLIB_ROOT=<pah_to_zlib> HTSLIB_ROOT=<path_to_htslib>  cmake [cmake_options] ..

For those that don't currently have a CMAKE module written, you can set:

CMAKE_PREFIX_PATH="<path_to_custom_prefix>" cmake [cmake options] ..

Note that the libraries should be known at runtime as well, e.g. by specifying LD_LIBRARY_PATH

bschiffthaler commented 5 years ago

And if you can use docker or singularity, there is a build of seidr here: https://cloud.docker.com/u/bschiffthaler/repository/docker/bschiffthaler/seidr

That being said, I haven't tested the singularity container and openmpi much on HPC platforms. In theory, mpirun should work out of the box with a singularity image.

orionzhou commented 5 years ago

Okay, so after setting the CMAKE_PREFIX_PATH I was able to get it compiling, till this error occurs:

(base) zhoux379@ln0004:build $ make [ 5%] Built target seidr-common [ 8%] Built target pcor [ 10%] Built target plsnet [ 13%] Built target mi [ 21%] Built target ranger [ 24%] Built target genie3 [ 26%] Built target seidr-glmnet [ 29%] Built target el-ensemble [ 31%] Built target anoverence [ 35%] Built target tigress [ 38%] Built target bs [ 66%] Built target networkit [ 67%] Linking CXX executable seidr /panfs/roc/groups/15/springer/zhoux379/software/miniconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: CMakeFiles/sei dr.dir/src/Seidr/adjacency.cpp.o: in function adjacency(int, char**)': adjacency.cpp:(.text+0x1f50): undefined reference toboost::program_options::options_description::options_description(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, unsigned int, unsigned int)'

I tried set LD_LIBRARY_PATH:

(base) zhoux379@ln0004:build $ export LD_LIBRARY_PATH=/springer/zhoux379/software/miniconda3/lib

but the error still comes out, any idea? Thanks for your time and patience!

bschiffthaler commented 5 years ago

Are you sure it's linking now against a recent version of boost? Can you purge the build dir and post the entire log including the cmake configuration?

orionzhou commented 5 years ago

Ok I deleted everything and build it from scratch,

here is the building log,

and here is the CMakeCache.txt

I think it's linking against the recent boost (1.69.0):

(base) zhoux379@ln0003:build $ grep BOOST_LIB_VERSION /home/springer/zhoux379/software/miniconda3/include/boost/version.hpp // BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION

define BOOST_LIB_VERSION "1_69"

Thanks so much!

bschiffthaler commented 5 years ago

Alright, seems boost 1.69 causes issues.

I have successful builds with 1.66, 1.67 and 1.68 so downgrading boost to any of these versions should work with conda. It's a bit weird since the boost::po library is not supposed to have changed since 1.68 and that version still builds fine. I'll look into that in more detail, but for now:

EDIT: A bit more digging seems to indicate that the boost builds from conda-forge are what causes the problem, not the version - that seems more sensible with what I would have expected. The build from pkgs/main works just fine

EDIT: Modified the build command a bit so it builds narromi and uses all CPUs for make

conda create -n seidr -c bioconda -c conda-forge htslib boost=1.67.0=py37_4 cmake gxx_linux-64 gcc_linux-64 gfortran_linux-64 gsl glpk armadillo openmpi tclap
conda activate seidr
LDFLAGS="-L${CONDA_PREFIX}/lib" CMAKE_PREFIX_PATH=$CONDA_PREFIX cmake -DCMAKE_BUILD_TYPE=Release ..
make -j $(grep -c processor /proc/cpuinfo) 
orionzhou commented 5 years ago

It passed compiling! Thanks a lot for troubleshooting! I can't wait to try the various utilities!