Boost libraries installation with thread - linux

I've been having some trouble installing a program called tophat on linux (here is a link to the installation guide http://tophat.cbcb.umd.edu/tutorial.html) and I was hoping you could help. It requires the boost libraries and another program called samtools to run, but both seemed to install fine, yet I'm getting an error from boost here. From what I see it seems to be that the boost libraries are not installed properly, specifically one to do with threads, I did some googling and went back and reinstalled them specifically stating to include the thread library but still no dice. Can anyone help?
This is the output of me running make.
make all-recursive
make[1]: Entering directory `/home/tuxedo/tophat-2.0.6'
Making all in src
make[2]: Entering directory `/home/tuxedo/tophat-2.0.6/src'
g++ -Wall -Wno-strict-aliasing -g -gdwarf-2 -Wuninitialized -O3 -DNDEBUG -pthread - I../boost_1_52_0/boost.1.52.0//include -I../samtools_0.1.18//include -I./SeqAn-1.3 -o segment_juncs -L../boost_1_52_0/boost.1.52.0//lib -L../samtools_0.1.18//lib segment_juncs.o ../src/libtophat.a -lbam -lz
segment_juncs.o: In function `driver(std::basic_istream<char, std::char_traits<char> >&, _IO_FILE*, _IO_FILE*, _IO_FILE*, _IO_FILE*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)':
/home/tuxedo/tophat-2.0.6/src/segment_juncs.cpp:4949: undefined reference to `boost::thread::join()'
/home/tuxedo/tophat-2.0.6/src/segment_juncs.cpp:4950: undefined reference to `boost::thread::~thread()'
/home/tophat-2.0.6/src/segment_juncs.cpp:5026: undefined reference to `boost::thread::join()'
/home/tuxedo/tophat-2.0.6/src/segment_juncs.cpp:5027: undefined reference to `boost::thread::~thread()'
/home/tuxedo/tophat-2.0.6/src/segment_juncs.cpp:4942: undefined reference to `boost::thread::thread(boost::function0<void, std::allocator<boost::function_base> > const&)'
/home/tuxedo/tophat-2.0.6/src/segment_juncs.cpp:5019: undefined reference to `boost::thread::thread(boost::function0<void, std::allocator<boost::function_base> > const&)'
collect2: ld returned 1 exit status
make[2]: *** [segment_juncs] Error 1
make[2]: Leaving directory `/home/tuxedo/tophat-2.0.6/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/tuxedo/tophat-2.0.6'
make: *** [all] Error 2
Thanks in advance for any help you can give!! This has been driving me crazy for hours now!!

Related

Undefined reference to mariadb::account::create()

I want to code an app by C++ and using MySQL database in it. I used mariadbclientpp library. So I cloned it and compiled it in windows vs 2019 and it worked fine. But when I want do this in Raspbian, I got below linking error:
/usr/bin/ld: /tmp/ccJjO2Jo.o: in function `main':
sqltest.cpp:(.text+0xd8): undefined reference to `mariadb::account::create(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
I'm completely new in Linux so I did search a lot and I tried some fixes but none of them help me. I tried this ways to compile my code:
1
g++ mysqltest.cpp -I/usr/include/mariadb -L/usr/lib/arm-linux-gnueabihf/ -lmariadb -I/usr/local/include/mariadb++/ -L/usr/local/lib/libmariadbclientpp.a
2
g++ -o mysqltest sqltest.cpp -lstdc++ -I/usr/include/mariadb/ $(mariadb_config --libs)
Any idea, Please?
I found out the problem. I was about static library. The static library add without -L option so I changed command to this:
g++ mysqltest.cpp /usr/local/lib/libmariadbclientpp.a -I/usr/include/mysql
and ti's done.

Linker errors even though CMake correctly locates the relevant .so file

Note: I am using a shared system running RedHat Linux, so I cannot use apt-get nor sudo
I am attempting to compile a program (OpenMVS) via a makefile generated by CMake. First I run:
cmake . ../openMVS -DCMAKE_INSTALL_PREFIX=/u/llipson/ -DCMAKE_BUILD_TYPE=RELEASE -DVCG_ROOT="$HOME/vcglib"
Then, I run make to execute the makefiles generated by CMake. However, make fails during the linking step due to the following "undefined reference to" errors:
[[llipson#head openMVS_build]$ make
[ 18%] Built target Common
[ 26%] Built target Math
[ 49%] Built target IO
[ 77%] Built target MVS
[ 79%] Linking CXX executable ../../bin/InterfaceCOLMAP
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: In function `boost::program_options::typed_value<bool, char>::xparse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) const':
InterfaceCOLMAP.cpp:(.text._ZNK5boost15program_options11typed_valueIbcE6xparseERNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EE[_ZNK5boost15program_options11typed_valueIbcE6xparseERNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EE]+0x17): undefined reference to `boost::program_options::validate(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool*, int)'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: In function `boost::program_options::typed_value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char>::xparse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) const':
InterfaceCOLMAP.cpp:(.text._ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE6xparseERNS_3anyERKSt6vectorIS7_SaIS7_EE[_ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE6xparseERNS_3anyERKSt6vectorIS7_SaIS7_EE]+0x17): undefined reference to `boost::program_options::validate(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int)'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: In function `boost::program_options::typed_value<int, char>::name() const':
InterfaceCOLMAP.cpp:(.text._ZNK5boost15program_options11typed_valueIicE4nameEv[_ZNK5boost15program_options11typed_valueIicE4nameEv]+0x1d): undefined reference to `boost::program_options::arg[abi:cxx11]'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: In function `boost::program_options::typed_value<unsigned int, char>::name() const':
InterfaceCOLMAP.cpp:(.text._ZNK5boost15program_options11typed_valueIjcE4nameEv[_ZNK5boost15program_options11typed_valueIjcE4nameEv]+0x1d): undefined reference to `boost::program_options::arg[abi:cxx11]'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: In function `boost::program_options::typed_value<bool, char>::name() const':
InterfaceCOLMAP.cpp:(.text._ZNK5boost15program_options11typed_valueIbcE4nameEv[_ZNK5boost15program_options11typed_valueIbcE4nameEv]+0x1d): undefined reference to `boost::program_options::arg[abi:cxx11]'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: In function `boost::program_options::typed_value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char>::name() const':
InterfaceCOLMAP.cpp:(.text._ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE4nameEv[_ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE4nameEv]+0x1d): undefined reference to `boost::program_options::arg[abi:cxx11]'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: In function `boost::program_options::basic_command_line_parser<char>::basic_command_line_parser(int, char const* const*)':
InterfaceCOLMAP.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcEC2EiPKPKc[_ZN5boost15program_options25basic_command_line_parserIcEC5EiPKPKc]+0x200): undefined reference to `boost::program_options::to_internal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
InterfaceCOLMAP.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcEC2EiPKPKc[_ZN5boost15program_options25basic_command_line_parserIcEC5EiPKPKc]+0x298): undefined reference to `boost::program_options::detail::cmdline::cmdline(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: In function `Initialize(unsigned long, char const**)':
InterfaceCOLMAP.cpp:(.text._Z10InitializemPPKc+0x1e4): undefined reference to `boost::program_options::options_description::options_description(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)'
InterfaceCOLMAP.cpp:(.text._Z10InitializemPPKc+0x758): undefined reference to `boost::program_options::options_description::options_description(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)'
InterfaceCOLMAP.cpp:(.text._Z10InitializemPPKc+0x151b): undefined reference to `boost::program_options::options_description::options_description(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const& boost::program_options::validators::get_single_string<char>(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool)':
InterfaceCOLMAP.cpp:(.text._ZN5boost15program_options10validators17get_single_stringIcEERKNSt7__cxx1112basic_stringIT_St11char_traitsIS5_ESaIS5_EEERKSt6vectorIS9_SaIS9_EEb[_ZN5boost15program_options10validators17get_single_stringIcEERKNSt7__cxx1112basic_stringIT_St11char_traitsIS5_ESaIS5_EEERKSt6vectorIS9_SaIS9_EEb]+0x6f): undefined reference to `boost::program_options::validation_error::get_template[abi:cxx11](boost::program_options::validation_error::kind_t)'
InterfaceCOLMAP.cpp:(.text._ZN5boost15program_options10validators17get_single_stringIcEERKNSt7__cxx1112basic_stringIT_St11char_traitsIS5_ESaIS5_EEERKSt6vectorIS9_SaIS9_EEb[_ZN5boost15program_options10validators17get_single_stringIcEERKNSt7__cxx1112basic_stringIT_St11char_traitsIS5_ESaIS5_EEERKSt6vectorIS9_SaIS9_EEb]+0x83): undefined reference to `boost::program_options::error_with_option_name::error_with_option_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
InterfaceCOLMAP.cpp:(.text._ZN5boost15program_options10validators17get_single_stringIcEERKNSt7__cxx1112basic_stringIT_St11char_traitsIS5_ESaIS5_EEERKSt6vectorIS9_SaIS9_EEb[_ZN5boost15program_options10validators17get_single_stringIcEERKNSt7__cxx1112basic_stringIT_St11char_traitsIS5_ESaIS5_EEERKSt6vectorIS9_SaIS9_EEb]+0x144): undefined reference to `boost::program_options::validation_error::get_template[abi:cxx11](boost::program_options::validation_error::kind_t)'
InterfaceCOLMAP.cpp:(.text._ZN5boost15program_options10validators17get_single_stringIcEERKNSt7__cxx1112basic_stringIT_St11char_traitsIS5_ESaIS5_EEERKSt6vectorIS9_SaIS9_EEb[_ZN5boost15program_options10validators17get_single_stringIcEERKNSt7__cxx1112basic_stringIT_St11char_traitsIS5_ESaIS5_EEERKSt6vectorIS9_SaIS9_EEb]+0x158): undefined reference to `boost::program_options::error_with_option_name::error_with_option_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: In function `void boost::program_options::validate<int, char>(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int*, long)':
InterfaceCOLMAP.cpp:(.text._ZN5boost15program_options8validateIicEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l[_ZN5boost15program_options8validateIicEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l]+0x1af): undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: In function `void boost::program_options::validate<unsigned int, char>(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, unsigned int*, long)':
InterfaceCOLMAP.cpp:(.text._ZN5boost15program_options8validateIjcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l[_ZN5boost15program_options8validateIjcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l]+0x176): undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o:(.rodata._ZTVN5boost15program_options16validation_errorE[_ZTVN5boost15program_options16validation_errorE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o:(.rodata._ZTVN5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEE[_ZTVN5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o:(.rodata._ZTVN5boost15program_options11typed_valueIjcEE[_ZTVN5boost15program_options11typed_valueIjcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o:(.rodata._ZTVN5boost15program_options11typed_valueIicEE[_ZTVN5boost15program_options11typed_valueIicEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o:(.rodata._ZTVN5boost15program_options11typed_valueIbcEE[_ZTVN5boost15program_options11typed_valueIbcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/InterfaceCOLMAP] Error 1
make[1]: *** [apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/all] Error 2
make: *** [all] Error 2
Evidently, the makefile for the particular executable can't find the object file containing the boost::program_options methods, which is /u/llipson/lib/libboost_program_options.so. However, I set LD_LIBRARY_PATH, so CMake correctly identifies the location of the boost library as /u/llipson/lib/ (as confirmed by printing the Boost_LIBRARY_DIRS variable in CMakeLists.txt), and the generated makefile even has the correct path to the .so file as a prerequisite for building the target:
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.15
# Delete rule output on recipe failure.
.DELETE_ON_ERROR:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /n/fs/pvl/llipson/cmake-3.15.0-rc1-Linux-x86_64/bin/cmake
# The command to remove a file.
RM = /n/fs/pvl/llipson/cmake-3.15.0-rc1-Linux-x86_64/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /u/llipson/openMVS
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /u/llipson/openMVS_build
# Include any dependencies generated for this target.
include apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/depend.make
# Include the progress variables for this target.
include apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/progress.make
# Include the compile flags for this target's objects.
include apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/flags.make
apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/flags.make
apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: /u/llipson/openMVS/apps/InterfaceCOLMAP/InterfaceCOLMAP.cpp
#$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/u/llipson/openMVS_build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o"
cd /u/llipson/openMVS_build/apps/InterfaceCOLMAP && /u/llipson/gcc-5.3.0/bin/g++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o -c /u/llipson/openMVS/apps/InterfaceCOLMAP/InterfaceCOLMAP.cpp
apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.i: cmake_force
#$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.i"
cd /u/llipson/openMVS_build/apps/InterfaceCOLMAP && /u/llipson/gcc-5.3.0/bin/g++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /u/llipson/openMVS/apps/InterfaceCOLMAP/InterfaceCOLMAP.cpp > CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.i
apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.s: cmake_force
#$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.s"
cd /u/llipson/openMVS_build/apps/InterfaceCOLMAP && /u/llipson/gcc-5.3.0/bin/g++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /u/llipson/openMVS/apps/InterfaceCOLMAP/InterfaceCOLMAP.cpp -o CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.s
# Object files for target InterfaceCOLMAP
InterfaceCOLMAP_OBJECTS = \
"CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o"
# External object files for target InterfaceCOLMAP
InterfaceCOLMAP_EXTERNAL_OBJECTS =
bin/InterfaceCOLMAP: apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o
bin/InterfaceCOLMAP: apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/build.make
bin/InterfaceCOLMAP: lib/libMVS.a
bin/InterfaceCOLMAP: lib/libMath.a
bin/InterfaceCOLMAP: lib/libIO.a
bin/InterfaceCOLMAP: lib/libCommon.a
bin/InterfaceCOLMAP: /u/llipson/lib/libboost_iostreams.so
bin/InterfaceCOLMAP: /u/llipson/lib/libboost_program_options.so
bin/InterfaceCOLMAP: /u/llipson/lib/libboost_serialization.so
bin/InterfaceCOLMAP: /u/llipson/lib/libboost_regex.so
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_dnn.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_gapi.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_ml.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_objdetect.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_photo.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_stitching.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_video.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_calib3d.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_features2d.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_flann.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_highgui.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_videoio.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_imgcodecs.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_imgproc.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib64/libopencv_core.so.4.0.1
bin/InterfaceCOLMAP: /u/llipson/lib/libpng.so
bin/InterfaceCOLMAP: /usr/lib64/libz.so
bin/InterfaceCOLMAP: /u/llipson/lib/libtiff.so
bin/InterfaceCOLMAP: /n/fs/pvl/llipson/CGAL-4.13.1/lib/libCGAL.so.13.0.2
bin/InterfaceCOLMAP: /u/llipson/lib/libgmp.so
bin/InterfaceCOLMAP: /u/llipson/lib/libboost_thread.so
bin/InterfaceCOLMAP: /u/llipson/lib/libboost_chrono.so
bin/InterfaceCOLMAP: /u/llipson/lib/libboost_date_time.so
bin/InterfaceCOLMAP: /u/llipson/lib/libboost_atomic.so
bin/InterfaceCOLMAP: /n/fs/pvl/llipson/CGAL-4.13.1/lib/libCGAL_Core.so.13.0.2
bin/InterfaceCOLMAP: /n/fs/pvl/llipson/CGAL-4.13.1/lib/libCGAL_ImageIO.so.13.0.2
bin/InterfaceCOLMAP: /u/llipson/lib/libgmp.so
bin/InterfaceCOLMAP: /u/llipson/lib/libboost_thread.so
bin/InterfaceCOLMAP: /u/llipson/lib/libboost_chrono.so
bin/InterfaceCOLMAP: /u/llipson/lib/libboost_date_time.so
bin/InterfaceCOLMAP: /u/llipson/lib/libboost_atomic.so
bin/InterfaceCOLMAP: /n/fs/pvl/llipson/CGAL-4.13.1/lib/libCGAL_Core.so.13.0.2
bin/InterfaceCOLMAP: /n/fs/pvl/llipson/CGAL-4.13.1/lib/libCGAL_ImageIO.so.13.0.2
bin/InterfaceCOLMAP: /u/llipson/lib/libboost_system.so
bin/InterfaceCOLMAP: /usr/lib64/libcuda.so
bin/InterfaceCOLMAP: apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/link.txt
#$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/u/llipson/openMVS_build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking CXX executable ../../bin/InterfaceCOLMAP"
cd /u/llipson/openMVS_build/apps/InterfaceCOLMAP && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/InterfaceCOLMAP.dir/link.txt --verbose=$(VERBOSE)
# Rule to build all files generated by this target.
apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/build: bin/InterfaceCOLMAP
.PHONY : apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/build
apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/clean:
cd /u/llipson/openMVS_build/apps/InterfaceCOLMAP && $(CMAKE_COMMAND) -P CMakeFiles/InterfaceCOLMAP.dir/cmake_clean.cmake
.PHONY : apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/clean
apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/depend:
cd /u/llipson/openMVS_build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /u/llipson/openMVS /u/llipson/openMVS/apps/InterfaceCOLMAP /u/llipson/openMVS_build /u/llipson/openMVS_build/apps/InterfaceCOLMAP /u/llipson/openMVS_build/apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/DependInfo.cmake --color=$(COLOR)
.PHONY : apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/depend
I am using GNU compiler version 5.3.0
Is there any other way to resolve these linker errors, or perhaps other things I should try?
Please let me know if there is any other information I can provide. Thanks!
EDIT:
Included the full error message. Also included the makefile generated by CMake

openfst-1.6.5 cross compile failed

I have been working on the cross compilation of openfst-1.6.5.My cross compiler is gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.
Every time I excute the order as below:
./configure --prefix=`pwd` --enable-static --enable-shared --enable-far --enable-ngram-fsts --build=armv8 --host=aarch64-linux-gnu
make -j 4
The result is always as below:
/data/jiachen/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.3.1/../../../../aarch64-linux-gnu/bin/ld: warning: libfstfar.so.8, needed by ./.libs/libfstfarscript.so/, datanot/ jiachenfound/ gcc(-trylinaro -using6.3.1 --2017.02rpath- x86_64_aarch64or- linux--rpathgnu-/linkbin)/
...//.liblibs//gcclibfstfarscript.so/:aarch64 -undefinedlinux -referencegnu /to6.3.1 /`.fst.:/:.IsSTList.(/std.:.:/__cxx11.:.:/basic_stringaarch64<-charlinux,- gnustd/:bin:/char_traitsld<:char >warning,: stdlibfstfar.so.8:,: allocatorneeded< charby> .>/ .constlibs&/)libfstfarscript.so',
.not/ .foundlibs /(libfstfarscript.sotry: usingundefined -referencerpath toor `-fstrpath:-:linkIsSTTable)(
std.:/:.__cxx11libs:/:libfstfarscript.sobasic_string:< charundefined, referencestd :to: char_traits`<fstchar:>:,IsSTList (stdstd::::allocator__cxx11<:char:>basic_string <>char ,const &std):':
char_traits<char>, std::allocator<char> > const&)'
./.libs/libfstfarscript.so: undefined reference to `fst::IsSTTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
make[4]: *** [farcreate] Error 1
make[4]: *** [farprintstrings] Error 1
/data/jiachen/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.3.1/../../../../aarch64-linux-gnu/bin/ld: warning: libfstfar.so.8, needed by ./.libs/libfstfarscript.so, not found (try using -rpath or -rpath-link)
./.libs/libfstfarscript.so: undefined reference to `fst::IsSTList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
./.libs/libfstfarscript.so: undefined reference to `fst::IsSTTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[4]: *** [farcompilestrings] Error 1
/data/jiachen/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.3.1/../../../../aarch64-linux-gnu/bin/ld: warning: libfstfar.so.8, needed by ./.libs/libfstfarscript.so, not found (try using -rpath or -rpath-link)
./.libs/libfstfarscript.so: undefined reference to `fst::IsSTList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
./.libs/libfstfarscript.so: undefined reference to `fst::IsSTTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
/data/jiachen/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.3.1/../../../../aarch64-linux-gnu/bin/ld: warning: libfstfar.so.8, needed by ./.libs/libfstfarscript.so, not found (try using -rpath or -rpath-link)
./.libs/libfstfarscript.so: undefined reference to `fst::IsSTList(std::__cxx11::basic_string<char, stdmake[4]: :*** [farinfo] Error 1:
char_traits<char>, std::allocator<char> > const&)'
./.libs/libfstfarscript.so: undefined reference to `fst::IsSTTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[4]: *** [farisomorphic] Error 1
/data/jiachen/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.3.1/../../../../aarch64-linux-gnu/bin/ld: warning: libfstfar.so.8, needed by ./.libs/libfstfarscript.so, not found (try using -rpath or -rpath-link)
./.libs/libfstfarscript.so: undefined reference to `fst::IsSTList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
./.libs/libfstfarscript.so: undefined reference to `fst::IsSTTable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[4]: *** [farextract] Error 1
make[4]: Leaving directory `/data/jiachen/kaldi-aarch64/tools/openfst-1.6.5/src/extensions/far'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/data/jiachen/kaldi-aarch64/tools/openfst-1.6.5/src/extensions'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/data/jiachen/kaldi-aarch64/tools/openfst-1.6.5/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/data/jiachen/kaldi-aarch64/tools/openfst-1.6.5'
make: *** [all] Error 2
The far extension cross compile failed.How can I solve this problem?
Faced the same issue while compiling kaldi. I had to remove --enable-far option from the line OPENFST_CONFIGURE in MakeFile. Source: here

make command error: undefined reference to `pthread_create

I was trying to run the codes from sourceforge.net, but when I was trying to run the "make" command in linux, I got the following error message:
make all-recursive
make[1]: Entering directory `/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp'
Making all in src
make[2]: Entering directory `/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp/src'
/bin/sh ../libtool --mode=link --tag=CXX g++ -g -O2 -o agent_rsvp agent_rsvp.o configuration.o floatformat.o generic_interface.o ip_mask.o ip_route.o mgmt_interface.o mgmt_packet.o mpls_ioctl.o rsvp_configuration.o rsvp_connection.o rsvp_dispatcher.o rsvp_error.o rsvp_packet.o rsvp_socket.o semaphore.o tools.o verbose.o
g++ -g -O2 -o agent_rsvp agent_rsvp.o configuration.o floatformat.o generic_interface.o ip_mask.o ip_route.o mgmt_interface.o mgmt_packet.o mpls_ioctl.o rsvp_configuration.o rsvp_connection.o rsvp_dispatcher.o rsvp_error.o rsvp_packet.o rsvp_socket.o semaphore.o tools.o verbose.o
mgmt_interface.o: In function `mgmt_interface::init()':
/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp/src/mgmt_interface.cpp:108: undefined reference to `pthread_create'
/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp/src/mgmt_interface.cpp:109: undefined reference to `pthread_create'
rsvp_connection.o: In function `rsvp_connection::create_refresh_thread()':
/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp/src/rsvp_connection.cpp:136: undefined reference to `pthread_create'
rsvp_dispatcher.o: In function `rsvp_dispatcher::init(unsigned int)':
/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp/src/rsvp_dispatcher.cpp:72: undefined reference to `pthread_create'
collect2: ld returned 1 exit status
make[2]: *** [agent_rsvp] Error 1
make[2]: Leaving directory `/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp/src'
make[1 ]: * ** [all-recursive] Error 1
make[1 ]: Leaving directory `/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp'
make: *** [all] Error 2

Makefile: build of c++ file on linux, unable to locate cuda libraries in opencv 2.4.6

Hopefully someone can help with this.
After rebuilding OpenCV 2.4.6 with Cuda Toolkit 5.5 on linux, an attempt was made to build a single c++ file that references OpenCV and CUDA using via make and a CLI g++ command. The input and output from each approach are shown below.
The Makefile attempts to reference the *.a files from OpenCV, but is not successful. The CLI g++ command attempts to reference *.so files, which it seems to do, however, some methods appear to be undefined.
Is it necessary for the Makefile to access only the OpenCV *.a files?
Makefile:
CFLAGS = -g Wall
LIBPATH = /data/content/cuda/opencv-2.4.6/lib
LIBS = -lopencv_calib3d_pch_dephelp -lopencv_contrib_pch_dephelp -lopencv_core_pch_dephelp -lopencv_features2d_pch_dephelp -lopencv_flann_pch_dephelp -lopencv_gpu_pch_dephelp -lopencv_haartraining_engine -lopencv_highgui_pch_dephelp -lopencv_imgproc_pch_dephelp -lopencv_legacy_pch_dephelp -lopencv_ml_pch_dephelp -lopencv_nonfree_pch_dephelp -lopencv_objdetect_pch_dephelp -lopencv_perf_calib3d_pch_dephelp -lopencv_perf_core_pch_dephelp -lopencv_perf_features2d_pch_dephelp -lopencv_perf_gpu_pch_dephelp -lopencv_perf_highgui_pch_dephelp -lopencv_perf_imgproc_pch_dephelp -lopencv_perf_nonfree_pch_dephelp -lopencv_perf_objdetect_pch_dephelp -lopencv_perf_photo_pch_dephelp -lopencv_perf_stitching_pch_dephelp -lopencv_perf_superres_pch_dephelp -lopencv_perf_video_pch_dephelp -lopencv_photo_pch_dephelp -lopencv_stitching_pch_dephelp -lopencv_superres_pch_dephelp -lopencv_test_calib3d_pch_dephelp -lopencv_test_contrib_pch_dephelp -lopencv_test_core_pch_dephelp -lopencv_test_features2d_pch_dephelp -lopencv_test_flann_pch_dephelp -lopencv_test_gpu_pch_dephelp -lopencv_test_highgui_pch_dephelp -lopencv_test_imgproc_pch_dephelp -lopencv_test_legacy_pch_dephelp -lopencv_test_ml_pch_dephelp -lopencv_test_nonfree_pch_dephelp -lopencv_test_objdetect_pch_dephelp -lopencv_test_photo_pch_dephelp -lopencv_test_stitching_pch_dephelp -lopencv_test_superres_pch_dephelp -lopencv_test_video_pch_dephelp -lopencv_ts_pch_dephelp -lopencv_video_pch_dephelp -lopencv_videostab_pch_dephelp -lopencv_gpu -lopencv_highgui
INCLUDEPATH1 = /usr/include/opencv2/core
INCLUDEPATH2 = /usr/include/opencv2/highgui
INCLUDEPATH3 = /usr/include/opencv2/gpu
all: tiff2png1.so
tiff2png1.so: main.o
g++ -o tiff2png1.so main.o **-L $(LIBPATH) $(LIB)**
main.o: main.cpp
g++ -c main.cpp -g -Wall -I $(INCLUDEPATH1) -I $(INCLUDEPATH2) -I $(INCLUDEPATH3) $(LIBPATH)
.PHONY: clean
clean:
rm -vf tiff2png1.so *.o
Makefile Output:
g++ -o tiff2png1.so main.o -L /data/content/cuda/opencv-2.4.6/lib
main.o: In function main':
/home/.../main.cpp:13: undefined reference tocv::gpu::getCudaEnabledDeviceCount()'
/home/.../main.cpp:15: undefined reference to cv::gpu::getDevice()'
/home/.../main.cpp:21: undefined reference tocv::imread(std::basic_string, std::allocator > const&, int)'
/home/.../main.cpp:27: undefined reference to cv::gpu::GpuMat::GpuMat(cv::Mat const&)'
/home/.../main.cpp:29: undefined reference tocv::gpu::Stream::Null()'
/home/.../main.cpp:29: undefined reference to cv::gpu::resize(cv::gpu::GpuMat const&, cv::gpu::GpuMat&, cv::Size_<int>, double, double, int, cv::gpu::Stream&)'
/home/.../main.cpp:42: undefined reference tocv::Mat::Mat(cv::gpu::GpuMat const&)'
/home/.../main.cpp:49: undefined reference to cv::_InputArray::_InputArray(cv::Mat const&)'
...
main.o: In function~GpuMat': /usr/include/opencv2/core/gpumat.hpp:374: undefined reference to `cv::gpu::GpuMat::release()'
collect2: ld returned 1 exit status
make: * [tiff2png1.so] Error 1
Command Line Build
$ g++ -o tx.exe main.o -L/data/content/cuda/opencv-2.4.6/lib -lopencv_gpu
Command Line Build Output
/data/content/cuda/opencv-2.4.6/lib/libopencv_gpu.so: undefined reference to `cv::gpu::convertTo(cv::gpu::GpuMat const&, cv::gpu::GpuMat&, double, double, CUstream_st*)'
/data/content/cuda/opencv-2.4.6/lib/libopencv_gpu.so: undefined reference to `cv::gpu::setTo(cv::gpu::GpuMat&, cv::Scalar_, cv::gpu::GpuMat const&, CUstream_st*)'
/data/content/cuda/opencv-2.4.6/lib/libopencv_gpu.so: undefined reference to `cv::gpu::setTo(cv::gpu::GpuMat&, cv::Scalar_, CUstream_st*)'
collect2: ld returned 1 exit status
It looks like you may have omitted an 'S' at the end of your variable in the linker target
**LIBS** = -lopencv_calib3d_pch_dephelp ...
tiff2png1.so: main.o
g++ -o tiff2png1.so main.o -L $(LIBPATH) $(**LIB**)
and so the -l options aren't being passed to the linker
g++ -o tiff2png1.so main.o -L /data/content/cuda/opencv-2.4.6/lib **should be here** main.o

Resources