smarco / WFA2-lib

WFA-lib: Wavefront alignment algorithm library v2
Other
162 stars 36 forks source link

Build issue on centos #2

Closed kcleal closed 2 years ago

kcleal commented 2 years ago

Hi, Thanks for the really nice library. I have no problems building on my Mac using clang using make BUILD_TOOLS=0 BUILD_EXAMPLES=0 clean all

However I run into problem when installing on centos, installing the c++ code (old gcc version?):

make clean all
rm -rf bin build lib
make --directory=tools/align_benchmark clean
make[1]: Entering directory `/scratch/c.sbi8kc2/WFA2-lib/tools/align_benchmark'
rm -rf ./build
make[1]: Leaving directory `/scratch/c.sbi8kc2/WFA2-lib/tools/align_benchmark'
make --directory=examples clean
make[1]: Entering directory `/scratch/c.sbi8kc2/WFA2-lib/examples'
rm -rf bin
make[1]: Leaving directory `/scratch/c.sbi8kc2/WFA2-lib/examples'
make --directory=alignment all
make[1]: Entering directory `/scratch/c.sbi8kc2/WFA2-lib/alignment'
gcc -Wall -g -O3 -march=native -I.. -c affine_penalties.c -o ../build/affine_penalties.o
gcc -Wall -g -O3 -march=native -I.. -c affine2p_penalties.c -o ../build/affine2p_penalties.o
gcc -Wall -g -O3 -march=native -I.. -c cigar.c -o ../build/cigar.o
gcc -Wall -g -O3 -march=native -I.. -c score_matrix.c -o ../build/score_matrix.o
make[1]: Leaving directory `/scratch/c.sbi8kc2/WFA2-lib/alignment'
make --directory=bindings/cpp all
make[1]: Entering directory `/scratch/c.sbi8kc2/WFA2-lib/bindings/cpp'
g++ -Wall -g -O3 -march=native -I../.. -c WFAligner.cpp -o ../../build/cpp/WFAligner.o
WFAligner.cpp:57:3: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
   this->wfAligner = nullptr;
   ^
WFAligner.cpp: In constructor ‘wfa::WFAligner::WFAligner(wfa::WFAligner::AlignmentScope, wfa::WFAligner::MemoryModel)’:
WFAligner.cpp:57:21: error: ‘nullptr’ was not declared in this scope
   this->wfAligner = nullptr;
                     ^
make[1]: *** [../../build/cpp/WFAligner.o] Error 1
make[1]: Leaving directory `/scratch/c.sbi8kc2/WFA2-lib/bindings/cpp'
make: *** [bindings/cpp] Error 2

I tried deleting the /bindings/cpp from the Makefile so SUBDIRS looks like:

SUBDIRS=alignment \
        system \
        utils \
        wavefront

I also removed this line from the Makefile:

$(AR) $(AR_FLAGS) $(LIB_WFA_CPP) $(FOLDER_BUILD)/*.o $(FOLDER_BUILD_CPP)/*.o 2> /dev/null The build now works with make BUILD_TOOLS=0 BUILD_EXAMPLES=0 clean all

Would it be possible to add a c++ free rule to the makefile? Thanks again!

smarco commented 2 years ago

Hi,

Thanks for the feedback.

I don't CentOS is the problem here, but the GCC version. One of the key points of the WFA2-lib is that it autovectorizes the core loops using the "#pragma ivdep" (in the case of GCC). The problem is that this pragma is fully supported starting from GCC 4.9. If you can use a newer version of GCC, that could solve the problem. Otherwise, I will try to see what happens compiling with an older gcc (<4.9). Let me know.

kcleal commented 2 years ago

Thanks for the swift response. Im trying to create a python wrapper for the C code of WFA2-lib https://github.com/kcleal/pywfa I think I have a working prototype now, but I had to add -fPIC to the C_FLAGS to make it friendly for python installation. I also added a BUILD_CPP=0 option to the Makefile, not sure if this is of interest to you (I sent a pull request in any case). Thanks!

smarco commented 2 years ago

It is of interest, no doubt. Together with a Rust API (@AndreaGuarracino), I think that many users will find this useful.