fbergama / wass

WASS (Waves Acquisition Stereo System) is an optimized stereo processing pipeline for sea waves 3D reconstruction.
GNU General Public License v3.0
40 stars 13 forks source link

WASS on CentOS 7.6 #8

Closed berhane closed 5 years ago

berhane commented 5 years ago

I'm trying to compile WASS according to the instructions at http://www.dais.unive.it/wass/documentation/install.html. The OpenCV compilation went well, but the WASS compilation failed with the following error:

[ 16%] Linking CXX executable wass_prepare
/usr/bin/ld: CMakeFiles/wass_prepare.dir/wass_prepare.cpp.o: undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'
//usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [wass_prepare/wass_prepare] Error 1
make[1]: *** [wass_prepare/CMakeFiles/wass_prepare.dir/all] Error 2
make: *** [all] Error 2

Some Google searching attributed to problems linking to 'pthreads' and that I could

I tried both with no luck.

If there is an easy fix, I would appreciate your help.

Thanks.

System info:

CentOS 7.6 Linux xxxxxxxx 3.10.0-957.5.1.el7.x86_64 cmake/3.12.2
cuda/10.1 gnu7/7.3.0-8.3.0 openmpi3/3.1.0-3.1.3 boost/1.67.0-1.69

Log files:

config.log make.log

fbergama commented 5 years ago

Hi and thank you for your interest in this project.

Honestly, it is the first time I see this kind of issue. In my experience looks kinda related to the boost library, but I'm not sure about that.

So, I would ask you to try adding this in the relevant CMakeLists:

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(my_app Threads::Threads)

for example, patch src/wass_prepare/CMakeLists.txt to:

cmake_minimum_required(VERSION 3.1)
project( wass_prepare )

if( DISABLE_BOOST_LOG )
else()
add_definitions(-DBOOST_LOG_DYN_LINK)
add_definitions(-DWASS_USE_BOOST_LOG)
endif()

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

include_directories( "${CMAKE_CURRENT_BINARY_DIR}/../include/"
                     "../include/"
                      ${Boost_INCLUDE_DIRS}
                      ${OpenCV_INCLUDE_DIRS}
                    )

if(MSVC)
link_directories( ${Boost_LIBRARY_DIR_RELEASE} )
endif()

add_executable( ${PROJECT_NAME} wass_prepare.cpp )

if(MSVC)
target_link_libraries( ${PROJECT_NAME}  ${OpenCV_LIBS}  )
else()
target_link_libraries( ${PROJECT_NAME} Threads::Threads ${Boost_LIBRARIES} ${OpenCV_LIBS} )
endif()

INSTALL( TARGETS ${PROJECT_NAME} DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )

If still you cannot let it work, I'll try to replicate your architecture in Docker to see if I face the same issue.

berhane commented 5 years ago

Thank you very much! That worked perfectly. I had to patch these four files similarly.

src/wass_autocalibrate/CMakeLists.txt src/wass_match/CMakeLists.txt src/wass_prepare/CMakeLists.txt src/wass_stereo/CMakeLists.txtsrc

I also had to make sure WASS was using the same C/C++ compilers as those used to compile the boost libraries using -DCMAKE_C_COMPILER flag. Without that flag, it was picking up the stock C/C++ compilers (GNU 4.8.5) in /usr/bin instead of the more recent compilers which were in a non-standard location. This worked using GNU 5.4.0 and GNU 8.3.0 compilers.

cmake ../src/ -DOpenCV_DIR="../../opencv/build" -DCMAKE_C_COMPILER=/opt/ohpc/pub/compiler/gcc/5.4.0/bin/gcc
cmake ../src/ -DOpenCV_DIR="../../opencv/build" -DCMAKE_C_COMPILER=/opt/ohpc/pub/compiler/gcc/8.3.0/bin/gcc

Thanks again!

fbergama commented 5 years ago

Great! Maybe I should patch the CMakeFiles permanently for greater compatibility. I'll test if it compiles properly on all the platforms with such modification.

I close the issue for now