rvaser / spoa

SIMD partial order alignment tool/library
MIT License
158 stars 32 forks source link

Build fails on ppc64le #54

Closed gururajrkatti closed 3 years ago

gururajrkatti commented 3 years ago

Hi , I am working on building this on linux on power little endian architecture. I found that it fails during build stage due to usage of -march=native option. This is not supported on ppc64le. Is this option needed ? Could you pl. take a look into the same and see if something can be done

Below is the exact error message

[  0%] Building CXX object CMakeFiles/spoa.dir/src/alignment_engine.cpp.o
g++-4.8: error: unrecognized command line option ‘-march=native’
make[2]: *** [CMakeFiles/spoa.dir/src/alignment_engine.cpp.o] Error 1
CMakeFiles/spoa.dir/build.make:62: recipe for target 'CMakeFiles/spoa.dir/src/alignment_engine.cpp.o' failed
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/spoa.dir/all' failed
make[1]: *** [CMakeFiles/spoa.dir/all] Error 2
make: *** [all] Error 2
Makefile:129: recipe for target 'all' failed

https://travis-ci.com/github/gururajrkatti/spoa/jobs/461198016

rvaser commented 3 years ago

Hi, here are some options you can use:

For example, you can disable -march=native with -Dspoa_optimize_for_native=OFF while running cmake.

Best regards, Robert

gururajrkatti commented 3 years ago

Hi @rvaser, thanks for your response. Using this option, I was able to pass through native error, however I get a link error related to pthread. Detailed logs below.

[100%] Linking CXX executable bin/spoa_test
/usr/local/lib/libgtest.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::~ThreadLocal()':
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED5Ev]+0x30): undefined reference to `pthread_getspecific'
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED5Ev]+0x58): undefined reference to `pthread_key_delete'
/usr/local/lib/libgtest.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::~ThreadLocal()':
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED2Ev[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED5Ev]+0x30): undefined reference to `pthread_getspecific'
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED2Ev[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED5Ev]+0x58): undefined reference to `pthread_key_delete'
/usr/local/lib/libgtest.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::GetOrCreateValue() const':
gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv]+0x34): undefined reference to `pthread_getspecific'
gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv]+0xd0): undefined reference to `pthread_setspecific'
/usr/local/lib/libgtest.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::CreateKey()':
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE9CreateKeyEv[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE9CreateKeyEv]+0x30): undefined reference to `pthread_key_create'
/usr/local/lib/libgtest.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::CreateKey()':
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE9CreateKeyEv[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE9CreateKeyEv]+0x30): undefined reference to `pthread_key_create'
/usr/local/lib/libgtest.a(gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::GetOrCreateValue() const':
gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv]+0x34): undefined reference to `pthread_getspecific'
gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv]+0xd0): undefined reference to `pthread_setspecific'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/spoa_test] Error 1
make[1]: *** [CMakeFiles/spoa_test.dir/all] Error 2
make: *** [all] Error 2
rvaser commented 3 years ago

You can try adding the commands bellow before https://github.com/rvaser/spoa/blob/master/CMakeLists.txt#L146:

find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME}_test
  Threads::Threads)

Alternatively, try using -Dgtest_disable_pthreads=ON while running cmake.

gururajrkatti commented 3 years ago

Hi @rvaser, I am able to fix the pthread issue by adding below lines to CMakeLists.txt. Will be raising a PR with these changes. Hope it is ok

diff CMakeLists.txt.org CMakeLists.txt
15a16,20
> set(CMAKE_THREAD_LIBS_INIT "-lpthread")
> set(CMAKE_HAVE_THREADS_LIBRARY 1)
> set(CMAKE_USE_WIN32_THREADS_INIT 0)
> set(CMAKE_USE_PTHREADS_INIT 1)
> set(THREADS_PREFER_PTHREAD_FLAG ON)
rvaser commented 3 years ago

As spoa does not use threading, only googletest does, the PR is not necessary and will not be considered, sorry.

mr-c commented 3 years ago

@gururajrkatti You might want to check out the Debian patches for spoa, we've been building on ppc64le this year: https://buildd.debian.org/status/package.php?p=spoa

https://sources.debian.org/src/spoa/3.4.0+ds-2/debian/patches/

Here are the flags we pass to cmake: https://sources.debian.org/src/spoa/3.4.0+ds-2/debian/rules/#L8

Currently we develop the Debian source package for spoa at https://salsa.debian.org/med-team/spoa

Hope this helps!