Problem in Building mplsh-run in lshkit - c++

been trying out this for quite some time but
I'm still unable to built mplsh-run from lshkit
Not sure if this would help to explain my situation during the
building process
/tmp/cc17kth4.o: In function `lshkit::MultiProbeLshRecallTable::reset(lshkit::MultiProbeLshModel, unsigned int, double, double)':
mplsh-run.cpp:(.text._ZN6lshkit24MultiProbeLshRecallTable5resetENS_18MultiProbeLshModelEjdd[lshkit::MultiProbeLshRecallTable::reset(lshkit::MultiProbeLshModel, unsigned int, double, double)]+0x230): undefined reference to `lshkit::MultiProbeLshModel::recall(double) const'
/tmp/cc17kth4.o: In function `void lshkit::MultiProbeLshIndex<unsigned int>::query_recall<lshkit::TopkScanner<lshkit::Matrix<float>::Accessor, lshkit::metric::l2sqr<float> > >(float const*, float, lshkit::TopkScanner<lshkit::Matrix<float>::Accessor, lshkit::metric::l2sqr<float> >&) const':
mplsh-run.cpp:(.text._ZNK6lshkit18MultiProbeLshIndexIjE12query_recallINS_11TopkScannerINS_6MatrixIfE8AccessorENS_6metric5l2sqrIfEEEEEEvPKffRT_[void lshkit::MultiProbeLshIndex<unsigned int>::query_recall<lshkit::TopkScanner<lshkit::Matrix<float>::Accessor, lshkit::metric::l2sqr<float> > >(float const*, float, lshkit::TopkScanner<lshkit::Matrix<float>::Accessor, lshkit::metric::l2sqr<float> >&) const]+0x2c4): undefined reference to `lshkit::MultiProbeLsh::genProbeSequence(float const*, std::vector<unsigned int, std::allocator<unsigned int> >&, unsigned int) const'
/tmp/cc17kth4.o: In function `void lshkit::MultiProbeLshIndex<unsigned int>::query<lshkit::TopkScanner<lshkit::Matrix<float>::Accessor, lshkit::metric::l2sqr<float> > >(float const*, unsigned int, lshkit::TopkScanner<lshkit::Matrix<float>::Accessor, lshkit::metric::l2sqr<float> >&)':
mplsh-run.cpp:(.text._ZN6lshkit18MultiProbeLshIndexIjE5queryINS_11TopkScannerINS_6MatrixIfE8AccessorENS_6metric5l2sqrIfEEEEEEvPKfjRT_[void lshkit::MultiProbeLshIndex<unsigned int>::query<lshkit::TopkScanner<lshkit::Matrix<float>::Accessor, lshkit::metric::l2sqr<float> > >(float const*, unsigned int, lshkit::TopkScanner<lshkit::Matrix<float>::Accessor, lshkit::metric::l2sqr<float> >&)]+0x4a): undefined reference to `lshkit::MultiProbeLsh::genProbeSequence(float const*, std::vector<unsigned int, std::allocator<unsigned int> >&, unsigned int) const'
collect2: ld returned 1 exit status
the command that i used to built mplsh-run is
g++ -I./lshkit/include -L/usr/lib -lm -lgsl -lgslcblas -lboost_program_options-mt mplsh-run.cpp
Do you guys have any clue on how I could solve this?

Put the .cpp file as the first argument.
g++ mplsh-run.cpp -I./lshkit/include -lm -lgsl -lgslcblas -lboost_program_options-mt
Also try with different permutations of -lm -lgsl and -lgslcblas

Related

program option linking error boost library with 1.66 version

I am working on one project where I need to compile all our backend c++ applications from centos to rhel8 Linux machine. I am facing a boost program option error with the boost 1.66 version which comes preloaded in rhel8. If I use boost 1.63 it works for me but mt library. mt library is not available in boost 1.66 version. So i made few changes in makefile. Please find below the difference of make file between 1.63 and 1.66 boost. I am getting program option linking error . Please help me to solve this issue.
working command-line compilation with boost 1.63.
/usr/bin/g++ -o /home/rhel8/allan/dev/kevlar/bin/linux5_64_DBG/toolset -g -export-dynamic -Wl,"-(" /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarToolSet.o /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarToolSetMain.o /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarJournalEditorTool.o /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarQueryCheckpointTool.o /home/rhel8/allan/dev/cure/lib/linux5_64_DBG/libcureapplication.a /home/rhel8/allan/dev/eqmon/lib/linux5_64_DBG/libeqmon-mt.a /home/rhel8/allan/dev/eqcyclopsmon/lib/linux5_64_DBG/libeqcyclopsmon.a /home/rhel8/allan/dev/ivcom/src/linux5_64_DBG/libivcom.a /home/rhel8/allan/dev/gslog/lib/linux5_64_DBG/libgslog-mt.a /home/rhel8/allan/dev/gscpputil/linux5_64_DBG/libgscpputil.a /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcre.a /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcrecpp.a /home/rhel8/allan/dev/gscushmdb/linux5_64_DBG/libgscushmdb.a /home/rhel8/allan/dev/hermes/lib/linux5_64_DBG/libhermescommandmanager.a /home/rhel8/allan/dev/hermes/lib/linux5_64_DBG/libhermescommon.a /home/rhel8/allan/dev/ivshmdb/api/linux5_64_DBG/libivshmdbapi.a /home/rhel8/allan/dev/ivshmdb/lib/linux5_64_DBG/libIvShmDbUserEnums.a /home/rhel8/allan/dev/ivshmdb/lib/linux5_64_DBG/libivshmdbcommanddefinition.a /home/rhel8/allan/dev/ivshmdb/lib/linux5_64_DBG/libIvShmDbUserRecords.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarapplication.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarcurrenttime.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarcommandlinetools.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlardatastreampair.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarflightrecorder.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarjournalmanager.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarmessagewrapper.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarreplicator.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarresources.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarsharedmemoryutils.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlartransaction.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlaruniqueid.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libKevlarUserEnums.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarcommanddefinition.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libKevlarUserRecords.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libUserRecords.a -Wl,"-)" /home/rhel8/allan/boost_1.63/lib/libboost_filesystem-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_regex-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_program_options-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_date_time-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_system-mt.a -lexpat /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcre.a /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcrecpp.a /usr/lib64/libpython2.7.so -pthread -Xlinker -ldl -ltirpc -lutil -lrt
/home/rhel8/allan/boost_1.63/lib/libboost_filesystem-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_regex-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_program_options-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_date_time-mt.a /home/rhel8/allan/boost_1.63/lib/libboost_system-mt.a
non working command line compilation with boost 1.66
/usr/bin/g++ -o /home/rhel8/allan/dev/kevlar/bin/linux5_64_DBG/toolset -g -export-dynamic -Wl,"-(" /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarToolSet.o /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarToolSetMain.o /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarJournalEditorTool.o /home/rhel8/allan/dev/kevlar/tools/linux5_64_DBG/KevlarQueryCheckpointTool.o /home/rhel8/allan/dev/cure/lib/linux5_64_DBG/libcureapplication.a /home/rhel8/allan/dev/eqmon/lib/linux5_64_DBG/libeqmon-mt.a /home/rhel8/allan/dev/eqcyclopsmon/lib/linux5_64_DBG/libeqcyclopsmon.a /home/rhel8/allan/dev/ivcom/src/linux5_64_DBG/libivcom.a /home/rhel8/allan/dev/gslog/lib/linux5_64_DBG/libgslog-mt.a /home/rhel8/allan/dev/gscpputil/linux5_64_DBG/libgscpputil.a /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcre.a /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcrecpp.a /home/rhel8/allan/dev/gscushmdb/linux5_64_DBG/libgscushmdb.a /home/rhel8/allan/dev/hermes/lib/linux5_64_DBG/libhermescommandmanager.a /home/rhel8/allan/dev/hermes/lib/linux5_64_DBG/libhermescommon.a /home/rhel8/allan/dev/ivshmdb/api/linux5_64_DBG/libivshmdbapi.a /home/rhel8/allan/dev/ivshmdb/lib/linux5_64_DBG/libIvShmDbUserEnums.a /home/rhel8/allan/dev/ivshmdb/lib/linux5_64_DBG/libivshmdbcommanddefinition.a /home/rhel8/allan/dev/ivshmdb/lib/linux5_64_DBG/libIvShmDbUserRecords.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarapplication.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarcurrenttime.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarcommandlinetools.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlardatastreampair.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarflightrecorder.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarjournalmanager.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarmessagewrapper.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarreplicator.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarresources.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarsharedmemoryutils.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlartransaction.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlaruniqueid.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libKevlarUserEnums.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libkevlarcommanddefinition.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libKevlarUserRecords.a /home/rhel8/allan/dev/kevlar/lib/linux5_64_DBG/libUserRecords.a -Wl,"-)" -lboost_filesystem -lboost_regex -lboost_program_options -lboost_date_time -lboost_system -lexpat /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcre.a /home/rhel8/allan/dev/pcre/linux5_64/lib/libpcrecpp.a /usr/lib64/libpython2.7.so -pthread -Xlinker -ldl -ltirpc -lutil -lrt
-lboost_filesystem -lboost_regex -lboost_program_options -lboost_date_time -lboost_system -lexpat
this library are available in /usr/lib64 folder with so extension.
Below is the error when i compile with boost 1.66
Error after compiling with 1.66 boost version
/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o):(.data.rel.ro._ZTVN5boost15program_options11typed_valueISt6vectorISsSaISsEEcEE[_ZTVN5boost15program_options11typed_valueISt6vectorISsSaISsEEcEE]+0x38): undefined reference to boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool) const' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o):(.data.rel.ro._ZTVN5boost15program_options11typed_valueISscEE[_ZTVN5boost15program_options11typed_valueISscEE]+0x38): undefined reference to boost::program_options::value_semantic_codecvt_helper::parse(boost::any&, std::vector<std::string, std::allocatorstd::string > const&, bool) const'
/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o):(.data.rel.ro._ZTVN5boost15program_options20invalid_option_valueE[_ZTVN5boost15program_options20invalid_option_valueE]+0x30): undefined reference to boost::program_options::error_with_option_name::substitute_placeholders(std::string const&) const' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o):(.data.rel.ro._ZTVN5boost15program_options16validation_errorE[_ZTVN5boost15program_options16validation_errorE]+0x30): undefined reference to boost::program_options::error_with_option_name::substitute_placeholders(std::string const&) const'
/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o): In function boost::program_options::typed_value<std::vector<std::string, std::allocator<std::string> >, char>::name() const': /usr/include/boost/program_options/detail/value_semantic.hpp:22: undefined reference to boost::program_options::arg'
/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o): In function boost::program_options::typed_value<std::string, char>::name() const':/usr/include/boost/program_options/detail/value_semantic.hpp:22: undefined reference to boost::program_options::arg' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o): In function boost::program_options::typed_value<std::string, char>::xparse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&) const':/usr/include/boost/program_options/detail/value_semantic.hpp:184: undefined reference to boost::program_options::validate(boost::any&, std::vector<std::string, std::allocatorstd::string > const&, std::string*, int)' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o): In function void boost::program_options::validate<std::string, char>(boost::any&, 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> > > > const&, std::vector<std::string, std::allocator<std::string> >*, int)': /usr/include/boost/program_options/detail/value_semantic.hpp:149: undefined reference to boost::program_options::validate(boost::any&, std::vector<std::string, std::allocatorstd::string > const&, std::string*, int)' /usr/include/boost/program_options/detail/value_semantic.hpp:153: undefined reference to boost::program_options::invalid_option_value::invalid_option_value(std::string const&)' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o):(.data.rel.ro._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE[_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE]+0x38): undefined reference to boost::program_options::error_with_option_name::substitute_placeholders(std::string const&) const' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineToolSet.o):(.data.rel.ro._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE]+0x30): undefined reference to boost::program_options::error_with_option_name::substitute_placeholders(std::string const&) const' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineTool.o): In function KevlarCommandLineTool::KevlarCommandLineTool(std::string const&, std::string const&)':/home/rhel8/allan/dev/timer/commandLineTools/KevlarCommandLineTool.cpp:12: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineTool.o): In function boost::program_options::basic_command_line_parser::basic_command_line_parser(int, char const* const*)': /usr/include/boost/program_options/detail/parsers.hpp:44: undefined reference to boost::program_options::detail::cmdline::cmdline(std::vector<std::string, std::allocator<std::string> > const&)' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarCommandLineTool.o): In function std::vector<std::string, std::allocatorstd::string > boost::program_options::to_internalstd::string(std::vector<std::string, std::allocatorstd::string > const&)': /usr/include/boost/program_options/detail/convert.hpp:79: undefined reference to boost::program_options::to_internal(std::string const&)' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o): In function KevlarJournalEditor::KevlarJournalEditor(CureApplication*)': /home/rhel8/allan/dev/timer/commandLineTools/KevlarJournalEditor.cpp:36: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)' /home/rhel8/allan/dev/timer/commandLineTools/KevlarJournalEditor.cpp:36: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o): In function boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t, std::string const&, std::string const&, int)': /usr/include/boost/program_options/errors.hpp:378: undefined reference to boost::program_options::validation_error::get_template(boost::program_options::validation_error::kind_t)' /usr/include/boost/program_options/errors.hpp:378: undefined reference to boost::program_options::error_with_option_name::error_with_option_name(std::string const&, std::string const&, std::string const&, int)'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o): In function boost::program_options::variables_map::operator[](std::string const&) const': /usr/include/boost/program_options/variables_map.hpp:155: undefined reference to boost::program_options::abstract_variables_map::operator[](std::string const&) const' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o):(.data.rel.ro._ZTVN5boost15program_options11typed_valueIicEE[_ZTVN5boost15program_options11typed_valueIicEE]+0x38): undefined reference to boost::program_options::value_semantic_codecvt_helper::parse(boost::any&, std::vector<std::string, std::allocatorstd::string > const&, bool) const'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o): In function boost::program_options::typed_value<int, char>::name() const':/usr/include/boost/program_options/detail/value_semantic.hpp:22: undefined reference to boost::program_options::arg' /home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o): In function void boost::program_options::validate<int, char>(boost::any&, 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> > > > const&, int*, long)':/usr/include/boost/program_options/detail/value_semantic.hpp:95: undefined reference to boost::program_options::invalid_option_value::invalid_option_value(std::string const&)'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o):(.data.rel.ro._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options16validation_errorEEEEE[_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options16validation_errorEEEEE]+0x38): undefined reference to boost::program_options::error_with_option_name::substitute_placeholders(std::string const&) const'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarJournalEditor.o):(.data.rel.ro._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options16validation_errorEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15program_options16validation_errorEEE]+0x30): undefined reference to boost::program_options::error_with_option_name::substitute_placeholders(std::string const&) const'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarShmDatabaseUtility.o): In function KevlarShmDatabaseUtility::KevlarShmDatabaseUtility()':/home/rhel8/allan/dev/timer/commandLineTools/KevlarShmDatabaseUtility.cpp:38: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'/home/rhel8/allan/dev/timer/commandLineTools/KevlarShmDatabaseUtility.cpp:38: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'/home/rhel8/allan/dev/timer/commandLineTools/KevlarShmDatabaseUtility.cpp:38: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarShmEditor.o): In function KevlarShmEditor::KevlarShmEditor(CureApplication*)':/home/rhel8/allan/dev/timer/commandLineTools/KevlarShmEditor.cpp:278: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'/home/rhel8/allan/dev/timer/commandLineTools/KevlarShmEditor.cpp:278: undefined reference to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarLogQueryTool.o):/home/rhel8/allan/dev/timer/commandLineTools/KevlarLogQueryTool.cpp:113: more undefined references to boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)' follow/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarLogQueryTool.o):(.data.rel.ro._ZTVN5boost15program_options11typed_valueIjcEE[_ZTVN5boost15program_options11typed_valueIjcEE]+0x38): undefined reference to boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool) const'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarLogQueryTool.o): In function boost::program_options::typed_value<unsigned int, char>::name() const':/usr/include/boost/program_options/detail/value_semantic.hpp:22: undefined reference to boost::program_options::arg'/home/rhel8/allan/dev/timer/lib/linux5_64_DBG/libtimercommandlinetools.a(KevlarLogQueryTool.o): In function void boost::program_options::validate<unsigned int, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > > const&, unsigned int*, long)':/usr/include/boost/program_options/detail/value_semantic.hpp:95: undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::string const&)'collect2: error: ld returned 1 exit status

Compiling with external libraries

I am having an issue with compiling one of the sample (example codes) for a C++ based jwt library from a github project: jwt-cpp
I cloned it and compiled it using the steps provided in the README file, which seemed successful.
After that I did a ldconfig.
Now, I am trying to build the example code.
#include <iostream>
#include "jwt/jwt_all.h"
using json = nlohmann::json;
int main()
{
// Setup a signer
HS256Validator signer("secret!");
// Create the json payload that expires 01/01/2017 # 12:00am (UTC)
json payload = {{"sub", "subject"}, {"exp", 1483228800}};
// Let's encode the token to a string
auto token = JWT::Encode(signer, payload);
std::cout << token << std::endl;
}
I compile this with a command on terminal, which says:
g++ -std=c++11 \
-I/usr/local/include \
-I/usr/local/include \
/usr/local/lib/libjwt.a \
/usr/local/lib/libcrypto.a \
sign.cpp -o sign
And it results in following error:
/tmp/ccX4ghoR.o: In function `main':
sign.cpp:(.text+0x24e): undefined reference to
JWT::Encode(MessageSigner const&, nlohmann::basic_json<std::map,
std::vector, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >, bool, long, unsigned long, double,
std::allocator, nlohmann::adl_serializer> const&,
nlohmann::basic_json<std::map, std::vector,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >, bool, long, unsigned long, double,
std::allocator, nlohmann::adl_serializer>)'
/tmp/ccX4ghoR.o: In function
`HS256Validator::HS256Validator(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)': sign.cpp:(.text._ZN14HS256ValidatorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN14HS256ValidatorC5ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x21): undefined reference to `EVP_sha256' sign.cpp:(.text._ZN14HS256ValidatorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN14HS256ValidatorC5ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x5f): undefined reference to `HMACValidator::HMACValidator(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, evp_md_st
const*, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)'
/tmp/ccX4ghoR.o:
(.rodata._ZTV14HS256Validator[_ZTV14HS256Validator]+0x20): undefined
reference to `HMACValidator::Verify(nlohmann::basic_json<std::map,
std::vector, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >, bool, long, unsigned long, double,
std::allocator, nlohmann::adl_serializer> const&, unsigned char
const*, unsigned long, unsigned char const*, unsigned long) const'
/tmp/ccX4ghoR.o:
(.rodata._ZTV14HS256Validator[_ZTV14HS256Validator]+0x28): undefined
reference to `HMACValidator::toJson[abi:cxx11]() const'
/tmp/ccX4ghoR.o:
(.rodata._ZTV14HS256Validator[_ZTV14HS256Validator]+0x38): undefined
reference to `MessageValidator::Accepts(nlohmann::basic_json<std::map,
std::vector, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >, bool, long, unsigned long, double,
std::allocator, nlohmann::adl_serializer> const&) const'
/tmp/ccX4ghoR.o:
(.rodata._ZTV14HS256Validator[_ZTV14HS256Validator]+0x40): undefined
reference to `HMACValidator::Sign(unsigned char const*, unsigned long,
unsigned char*, unsigned long*) const'
/tmp/ccX4ghoR.o: In function `HS256Validator::~HS256Validator()':
sign.cpp:
(.text._ZN14HS256ValidatorD2Ev[_ZN14HS256ValidatorD5Ev]+0x20):
undefined reference to `HMACValidator::~HMACValidator()'
/tmp/ccX4ghoR.o:
(.rodata._ZTI14HS256Validator[_ZTI14HS256Validator]+0x10): undefined
reference to `typeinfo for HMACValidator'
collect2: error: ld returned 1 exit status
What have I tried:
I have read through these questions to know what I might be doing wrong:
How to use libraries and compile C file using external library from linux terminal, Although second question is specifically for C and not C++, the problem there and the solution is applicable to C++ as well.
I have also tried variants of command line compilation such as,
g++ -std=c++11 \
-I/usr/local/include \
-I/usr/local/include \
-L/usr/local/lib/ \
-lcrypto -ljwt \
sign.cpp -o sign
I am familiar with the fact that when I do a -lfoo, the linker tries to find a libfoo.a at the location provided with -L option.
I have confirmed that the options that are used for compilation contains what they should.
For -I options:
I can see jwt and openssl directories in /usr/local/include
For -L options:
I can see libjwt.a, libssl.a, libcrypto.a, libssl.so, etc at /usr/local/lib/
Question:
What am I doing wrong to compile this example?
You're gonna kick yourself when I tell you the issue.
Put the source file, sign.cpp before the library declarations in your program:
g++ -std=c++11 -I/usr/local/include -L/usr/local/lib sign.cpp -lcrypto -ljwt -o sign
The reason being is that the unix linker doesn't look backwards in the command line to resolve dependencies. There's a few command line switches (e.g. --start-group and --end-group) that will adjust this behavior, but the above will get you unblocked for now. More details here.
In the above example, I took the liberty of removing the duplicated INCLUDE path arguments. You probably don't even need the -I/usr/local/include or -L/usr/local/lib part because that's typically already in the standard compiler path.

Error building OpenCV3.1 with CUDA on Ubuntu 15.10 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm trying to build OpenCV 3.1 on Linux (Ubuntu 15.10), but am getting the following errors:
cd /home/rob/Libraries/OpenCV3/opencv-3.1.0/build/modules/cudev/test && /usr/bin/cmake -E cmake_link_script CMakeFiles/opencv_test_cudev.dir/link.txt --verbose=1
/usr/lib/ccache/c++ -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Winit-self -Wpointer-arith -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -Wno-undef -Wno-missing-declarations -Wno-unused-function -Wno-unused-variable -Wno-enum-compare -Wno-shadow -O3 -DNDEBUG -DNDEBUG CMakeFiles/opencv_test_cudev.dir/test_main.cpp.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_lut.cu.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_cvt.cu.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_arithm_op.cu.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_reduction.cu.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_warp.cu.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_color_cvt.cu.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_split_merge.cu.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_pyramids.cu.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_bitwize_op.cu.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_deriv.cu.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_arithm_func.cu.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_integral.cu.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_transpose.cu.o CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_cmp_op.cu.o -o ../../../bin/opencv_test_cudev -L/usr/local/cuda/lib64 -rdynamic -lcudart ../../../lib/libopencv_ts.a ../../../lib/libopencv_highgui.so.3.1.0 -ldl -lm -lpthread -lrt ../../../../3rdparty/ippicv/unpack/ippicv_lnx/lib/intel64/libippicv.a -lcudart -lnppc -lnppi -lnpps -lcufft -L/usr/local/cuda/lib64 -lcudart ../../../lib/libopencv_videoio.so.3.1.0 ../../../lib/libopencv_imgcodecs.so.3.1.0 ../../../lib/libopencv_imgproc.so.3.1.0 ../../../lib/libopencv_core.so.3.1.0 ../../../lib/libopencv_cudev.so.3.1.0 -lnppc -lnppi -lnpps -lcufft -Wl,-rpath,/usr/local/cuda/lib64:/home/rob/Libraries/OpenCV3/opencv-3.1.0/build/lib
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_lut.cu.o: In function `testing::internal::TypeParameterizedTest<LutTest, testing::internal::TemplateSel<LutTest_GpuMat_Test>, testing::internal::Types1<unsigned char> >::Register(char const*, char const*, char const*, int)':
tmpxft_00006387_00000000-10_test_lut.compute_20.cudafe1.cpp:(.text._ZN7testing8internal21TypeParameterizedTestI7LutTestNS0_11TemplateSelI19LutTest_GpuMat_TestEENS0_6Types1IhEEE8RegisterEPKcSA_SA_i[_ZN7testing8internal21TypeParameterizedTestI7LutTestNS0_11TemplateSelI19LutTest_GpuMat_TestEENS0_6Types1IhEEE8RegisterEPKcSA_SA_i]+0x14b): undefined reference to `testing::Message::GetString() const'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_cvt.cu.o: In function `testing::internal::TypeParameterizedTest<CvtTest, testing::internal::TemplateSel<CvtTest_GpuMat_Test>, testing::internal::Types2<int, float> >::Register(char const*, char const*, char const*, int)':
tmpxft_000063d6_00000000-10_test_cvt.compute_20.cudafe1.cpp:(.text._ZN7testing8internal21TypeParameterizedTestI7CvtTestNS0_11TemplateSelI19CvtTest_GpuMat_TestEENS0_6Types2IifEEE8RegisterEPKcSA_SA_i[_ZN7testing8internal21TypeParameterizedTestI7CvtTestNS0_11TemplateSelI19CvtTest_GpuMat_TestEENS0_6Types2IifEEE8RegisterEPKcSA_SA_i]+0x141): undefined reference to `testing::Message::GetString() const'
tmpxft_000063d6_00000000-10_test_cvt.compute_20.cudafe1.cpp:(.text._ZN7testing8internal21TypeParameterizedTestI7CvtTestNS0_11TemplateSelI19CvtTest_GpuMat_TestEENS0_6Types2IifEEE8RegisterEPKcSA_SA_i[_ZN7testing8internal21TypeParameterizedTestI7CvtTestNS0_11TemplateSelI19CvtTest_GpuMat_TestEENS0_6Types2IifEEE8RegisterEPKcSA_SA_i]+0x452): undefined reference to `testing::Message::GetString() const'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_cvt.cu.o: In function `testing::internal::TypeParameterizedTest<CvtTest, testing::internal::TemplateSel<CvtTest_GpuMat_Test>, testing::internal::Types4<unsigned short, short, int, float> >::Register(char const*, char const*, char const*, int)':
tmpxft_000063d6_00000000-10_test_cvt.compute_20.cudafe1.cpp:(.text._ZN7testing8internal21TypeParameterizedTestI7CvtTestNS0_11TemplateSelI19CvtTest_GpuMat_TestEENS0_6Types4ItsifEEE8RegisterEPKcSA_SA_i[_ZN7testing8internal21TypeParameterizedTestI7CvtTestNS0_11TemplateSelI19CvtTest_GpuMat_TestEENS0_6Types4ItsifEEE8RegisterEPKcSA_SA_i]+0x152): undefined reference to `testing::Message::GetString() const'
tmpxft_000063d6_00000000-10_test_cvt.compute_20.cudafe1.cpp:(.text._ZN7testing8internal21TypeParameterizedTestI7CvtTestNS0_11TemplateSelI19CvtTest_GpuMat_TestEENS0_6Types4ItsifEEE8RegisterEPKcSA_SA_i[_ZN7testing8internal21TypeParameterizedTestI7CvtTestNS0_11TemplateSelI19CvtTest_GpuMat_TestEENS0_6Types4ItsifEEE8RegisterEPKcSA_SA_i]+0x472): undefined reference to `testing::Message::GetString() const'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_cvt.cu.o:tmpxft_000063d6_00000000-10_test_cvt.compute_20.cudafe1.cpp:(.text._ZN7testing8internal21TypeParameterizedTestI7CvtTestNS0_11TemplateSelI19CvtTest_GpuMat_TestEENS0_6Types5IhtsifEEE8RegisterEPKcSA_SA_i[_ZN7testing8internal21TypeParameterizedTestI7CvtTestNS0_11TemplateSelI19CvtTest_GpuMat_TestEENS0_6Types5IhtsifEEE8RegisterEPKcSA_SA_i]+0x140): more undefined references to `testing::Message::GetString() const' follow
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_reduction.cu.o: In function `testing::AssertionResult testing::internal::CmpHelperFloatingPointEQ<float>(char const*, char const*, float, float)':
tmpxft_000063c4_00000000-10_test_reduction.compute_20.cudafe1.cpp:(.text._ZN7testing8internal24CmpHelperFloatingPointEQIfEENS_15AssertionResultEPKcS4_T_S5_[_ZN7testing8internal24CmpHelperFloatingPointEQIfEENS_15AssertionResultEPKcS4_T_S5_]+0x12a): undefined reference to `testing::internal::StringStreamToString(std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >*)'
tmpxft_000063c4_00000000-10_test_reduction.compute_20.cudafe1.cpp:(.text._ZN7testing8internal24CmpHelperFloatingPointEQIfEENS_15AssertionResultEPKcS4_T_S5_[_ZN7testing8internal24CmpHelperFloatingPointEQIfEENS_15AssertionResultEPKcS4_T_S5_]+0x139): undefined reference to `testing::internal::StringStreamToString(std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >*)'
tmpxft_000063c4_00000000-10_test_reduction.compute_20.cudafe1.cpp:(.text._ZN7testing8internal24CmpHelperFloatingPointEQIfEENS_15AssertionResultEPKcS4_T_S5_[_ZN7testing8internal24CmpHelperFloatingPointEQIfEENS_15AssertionResultEPKcS4_T_S5_]+0x154): undefined reference to `testing::internal::EqFailure(char const*, char const*, std::string const&, std::string const&, bool)'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_warp.cu.o: In function `testing::AssertionResult testing::internal::CmpHelperEQ<int, int>(char const*, char const*, int const&, int const&)':
tmpxft_000063ba_00000000-10_test_warp.compute_20.cudafe1.cpp:(.text._ZN7testing8internal11CmpHelperEQIiiEENS_15AssertionResultEPKcS4_RKT_RKT0_[_ZN7testing8internal11CmpHelperEQIiiEENS_15AssertionResultEPKcS4_RKT_RKT0_]+0x5c): undefined reference to `testing::internal::EqFailure(char const*, char const*, std::string const&, std::string const&, bool)'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_warp.cu.o: In function `testing::AssertionResult& testing::AssertionResult::operator<< <char [12]>(char const (&) [12])':
tmpxft_000063ba_00000000-10_test_warp.compute_20.cudafe1.cpp:(.text._ZN7testing15AssertionResultlsIA12_cEERS0_RKT_[_ZN7testing15AssertionResultlsIA12_cEERS0_RKT_]+0x66): undefined reference to `testing::Message::GetString() const'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_warp.cu.o: In function `testing::AssertionResult& testing::AssertionResult::operator<< <char const*>(char const* const&)':
tmpxft_000063ba_00000000-10_test_warp.compute_20.cudafe1.cpp:(.text._ZN7testing15AssertionResultlsIPKcEERS0_RKT_[_ZN7testing15AssertionResultlsIPKcEERS0_RKT_]+0x67): undefined reference to `testing::Message::GetString() const'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_warp.cu.o: In function `testing::AssertionResult& testing::AssertionResult::operator<< <char [7]>(char const (&) [7])':
tmpxft_000063ba_00000000-10_test_warp.compute_20.cudafe1.cpp:(.text._ZN7testing15AssertionResultlsIA7_cEERS0_RKT_[_ZN7testing15AssertionResultlsIA7_cEERS0_RKT_]+0x66): undefined reference to `testing::Message::GetString() const'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_warp.cu.o: In function `testing::AssertionResult& testing::AssertionResult::operator<< <std::string>(std::string const&)':
tmpxft_000063ba_00000000-10_test_warp.compute_20.cudafe1.cpp:(.text._ZN7testing15AssertionResultlsISsEERS0_RKT_[_ZN7testing15AssertionResultlsISsEERS0_RKT_]+0x54): undefined reference to `testing::Message::GetString() const'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_warp.cu.o: In function `testing::AssertionResult& testing::AssertionResult::operator<< <char [5]>(char const (&) [5])':
tmpxft_000063ba_00000000-10_test_warp.compute_20.cudafe1.cpp:(.text._ZN7testing15AssertionResultlsIA5_cEERS0_RKT_[_ZN7testing15AssertionResultlsIA5_cEERS0_RKT_]+0x66): undefined reference to `testing::Message::GetString() const'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_warp.cu.o: In function `testing::AssertionResult testing::internal::CmpHelperEQ<cv::Size_<int>, cv::Size_<int> >(char const*, char const*, cv::Size_<int> const&, cv::Size_<int> const&)':
tmpxft_000063ba_00000000-10_test_warp.compute_20.cudafe1.cpp:(.text._ZN7testing8internal11CmpHelperEQIN2cv5Size_IiEES4_EENS_15AssertionResultEPKcS7_RKT_RKT0_[_ZN7testing8internal11CmpHelperEQIN2cv5Size_IiEES4_EENS_15AssertionResultEPKcS7_RKT_RKT0_]+0x5c): undefined reference to `testing::internal::EqFailure(char const*, char const*, std::string const&, std::string const&, bool)'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_bitwize_op.cu.o: In function `testing::internal::TypeParameterizedTest<LShiftTest, testing::internal::TemplateSel<LShiftTest_Accuracy_Test>, testing::internal::Types1<int> >::Register(char const*, char const*, char const*, int)':
tmpxft_000063f1_00000000-10_test_bitwize_op.compute_20.cudafe1.cpp:(.text._ZN7testing8internal21TypeParameterizedTestI10LShiftTestNS0_11TemplateSelI24LShiftTest_Accuracy_TestEENS0_6Types1IiEEE8RegisterEPKcSA_SA_i[_ZN7testing8internal21TypeParameterizedTestI10LShiftTestNS0_11TemplateSelI24LShiftTest_Accuracy_TestEENS0_6Types1IiEEE8RegisterEPKcSA_SA_i]+0xdc): undefined reference to `testing::Message::GetString() const'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_bitwize_op.cu.o: In function `testing::internal::TypeParameterizedTest<BitNotTest, testing::internal::TemplateSel<BitNotTest_GpuMat_Test>, testing::internal::Types1<int> >::Register(char const*, char const*, char const*, int)':
tmpxft_000063f1_00000000-10_test_bitwize_op.compute_20.cudafe1.cpp:(.text._ZN7testing8internal21TypeParameterizedTestI10BitNotTestNS0_11TemplateSelI22BitNotTest_GpuMat_TestEENS0_6Types1IiEEE8RegisterEPKcSA_SA_i[_ZN7testing8internal21TypeParameterizedTestI10BitNotTestNS0_11TemplateSelI22BitNotTest_GpuMat_TestEENS0_6Types1IiEEE8RegisterEPKcSA_SA_i]+0x14b): undefined reference to `testing::Message::GetString() const'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_bitwize_op.cu.o: In function `testing::internal::TypeParameterizedTest<BitNotTest, testing::internal::TemplateSel<BitNotTest_GpuMat_Test>, testing::internal::Types2<short, int> >::Register(char const*, char const*, char const*, int)':
tmpxft_000063f1_00000000-10_test_bitwize_op.compute_20.cudafe1.cpp:(.text._ZN7testing8internal21TypeParameterizedTestI10BitNotTestNS0_11TemplateSelI22BitNotTest_GpuMat_TestEENS0_6Types2IsiEEE8RegisterEPKcSA_SA_i[_ZN7testing8internal21TypeParameterizedTestI10BitNotTestNS0_11TemplateSelI22BitNotTest_GpuMat_TestEENS0_6Types2IsiEEE8RegisterEPKcSA_SA_i]+0x140): undefined reference to `testing::Message::GetString() const'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_bitwize_op.cu.o: In function `testing::internal::TypeParameterizedTest<BitNotTest, testing::internal::TemplateSel<BitNotTest_GpuMat_Test>, testing::internal::Types3<unsigned short, short, int> >::Register(char const*, char const*, char const*, int)':
tmpxft_000063f1_00000000-10_test_bitwize_op.compute_20.cudafe1.cpp:(.text._ZN7testing8internal21TypeParameterizedTestI10BitNotTestNS0_11TemplateSelI22BitNotTest_GpuMat_TestEENS0_6Types3ItsiEEE8RegisterEPKcSA_SA_i[_ZN7testing8internal21TypeParameterizedTestI10BitNotTestNS0_11TemplateSelI22BitNotTest_GpuMat_TestEENS0_6Types3ItsiEEE8RegisterEPKcSA_SA_i]+0x140): undefined reference to `testing::Message::GetString() const'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_bitwize_op.cu.o: In function `testing::internal::TypeParameterizedTest<BitNotTest, testing::internal::TemplateSel<BitNotTest_GpuMat_Test>, testing::internal::Types4<unsigned char, unsigned short, short, int> >::Register(char const*, char const*, char const*, int)':
tmpxft_000063f1_00000000-10_test_bitwize_op.compute_20.cudafe1.cpp:(.text._ZN7testing8internal21TypeParameterizedTestI10BitNotTestNS0_11TemplateSelI22BitNotTest_GpuMat_TestEENS0_6Types4IhtsiEEE8RegisterEPKcSA_SA_i[_ZN7testing8internal21TypeParameterizedTestI10BitNotTestNS0_11TemplateSelI22BitNotTest_GpuMat_TestEENS0_6Types4IhtsiEEE8RegisterEPKcSA_SA_i]+0x140): undefined reference to `testing::Message::GetString() const'
CMakeFiles/opencv_test_cudev.dir/opencv_test_cudev_generated_test_bitwize_op.cu.o:tmpxft_000063f1_00000000-10_test_bitwize_op.compute_20.cudafe1.cpp:(.text._ZN7testing8internal21TypeParameterizedTestI10BitAndTestNS0_11TemplateSelI29BitAndTest_GpuMat_GpuMat_TestEENS0_6Types1IiEEE8RegisterEPKcSA_SA_i[_ZN7testing8internal21TypeParameterizedTestI10BitAndTestNS0_11TemplateSelI29BitAndTest_GpuMat_GpuMat_TestEENS0_6Types1IiEEE8RegisterEPKcSA_SA_i]+0x14b): more undefined references to `testing::Message::GetString() const' follow
collect2: error: ld returned 1 exit status
modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/build.make:5441: recipe for target 'bin/opencv_test_cudev' failed
make[2]: *** [bin/opencv_test_cudev] Error 1
make[2]: Leaving directory '/home/rob/Libraries/OpenCV3/opencv-3.1.0/build'
CMakeFiles/Makefile2:1834: recipe for target 'modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/all' failed
make[1]: *** [modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/all] Error 2
make[1]: Leaving directory '/home/rob/Libraries/OpenCV3/opencv-3.1.0/build'
Makefile:146: recipe for target 'all' failed
make: *** [all] Error 2
It seems it's in a testing module.
Using CUDA 7.5, GCC-5.2.1 for OpenCV and GCC-4.7 For CUDA specific parts (you've always needed to use two different compilers)
Does anyone a fix or just a way to disable the module since it's only testing?
I had the same problem. I subsequently disabled compiling the testing modules with the cmake option "-DBUILD_TESTS=OFF". Then the opencv build seems to proceed without a problem.
Hope this helps.

how is linking done in c++?

i am using proxygen library by facebook to build a simple client example . in a directory i have two object files how do i link them :
i am using:
g++ -std=c++11 -o my_echo CurlClientMain.o CurlClient.o -lproxygenhttpserver -lfolly -lglog -lgflags -pthread
i think i ma missing some linker flag like -lgflags in above example. maybe after including some -someflag will help out compilation . how do i know what all possilble library flags are posiible like the one they have used -lproxyhttpserver.
In short where is all these libs defined or located. i am using ubuntu.
Here is my error message
In function `main':
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::HTTPConnector(proxygen::HTTPConnector::Callback*, folly::HHWheelTimer*)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:102: undefined reference to `proxygen::HTTPConnector::connect(folly::EventBase*, folly::SocketAddress const&, std::chrono::duration<long, std::ratio<1l, 1000l> >, std::map<folly::AsyncSocket::OptionKey, int, std::less<folly::AsyncSocket::OptionKey>, std::allocator<std::pair<folly::AsyncSocket::OptionKey const, int> > > const&, folly::SocketAddress const&)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::~HTTPConnector()'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:99: undefined reference to `proxygen::HTTPConnector::connectSSL(folly::EventBase*, folly::SocketAddress const&, std::shared_ptr<folly::SSLContext> const&, ssl_session_st*, std::chrono::duration<long, std::ratio<1l, 1000l> >, std::map<folly::AsyncSocket::OptionKey, int, std::less<folly::AsyncSocket::OptionKey>, std::allocator<std::pair<folly::AsyncSocket::OptionKey const, int> > > const&, folly::SocketAddress const&, std::string const&)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::~HTTPConnector()'
CurlClient.o: In function `CurlService::CurlClient::connectSuccess(proxygen::HTTPUpstreamSession*)':
/home/kshitij/proxygen/httpclient/samples/curl/CurlClient.cpp:69: undefined reference to `proxygen::HTTPUpstreamSession::newTransaction(proxygen::HTTPTransactionHandler*)'
collect2: error: ld returned 1 exit status
kshitij#forgetit:~/proxygen/httpclient/samples/curl$ g++ -std=c++11 -o my_echo CurlClientMain.o CurlClient.o -lproxygenhttpserver -lfolly -lglog -lgflags -pthread
CurlClientMain.o: In function `main':
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::HTTPConnector(proxygen::HTTPConnector::Callback*, folly::HHWheelTimer*)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:102: undefined reference to `proxygen::HTTPConnector::connect(folly::EventBase*, folly::SocketAddress const&, std::chrono::duration<long, std::ratio<1l, 1000l> >, std::map<folly::AsyncSocket::OptionKey, int, std::less<folly::AsyncSocket::OptionKey>, std::allocator<std::pair<folly::AsyncSocket::OptionKey const, int> > > const&, folly::SocketAddress const&)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::~HTTPConnector()'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:99: undefined reference to `proxygen::HTTPConnector::connectSSL(folly::EventBase*, folly::SocketAddress const&, std::shared_ptr<folly::SSLContext> const&, ssl_session_st*, std::chrono::duration<long, std::ratio<1l, 1000l> >, std::map<folly::AsyncSocket::OptionKey, int, std::less<folly::AsyncSocket::OptionKey>, std::allocator<std::pair<folly::AsyncSocket::OptionKey const, int> > > const&, folly::SocketAddress const&, std::string const&)'
/home/kshitij/proxygen/httpclient/samples/curl/CurlClientMain.cpp:91: undefined reference to `proxygen::HTTPConnector::~HTTPConnector()'
CurlClient.o: In function `CurlService::CurlClient::connectSuccess(proxygen::HTTPUpstreamSession*)':
/home/kshitij/proxygen/httpclient/samples/curl/CurlClient.cpp:69: undefined reference to `proxygen::HTTPUpstreamSession::newTransaction(proxygen::HTTPTransactionHandler*)'
collect2: error: ld returned 1 exit status
how do i know what all possilble library flags are posiible like the one they have used -lproxyhttpserver.
It depends on your compilation environment.
You appear to use the GNU compiler in linux. There is a tool to list all installed shared libraries:
ldconfig -p
You will get a list of lines like this
libpthread.so.0 (libc6,x86-64, OS ABI: Linux 2.6.32) => /lib/x86_64-linux-gnu/libpthread.so.0
Remove the lib prefix and the extension .so.X and you get the name of the library. In this case it's pthread. To link with a libray use the option -lNAME. So, -lpthread in this example.
In short where is all these libs defined or located
The righthand part of the => is the full path to the library.

How to use FANN in C++

Here I have read good references about FANN for Artificial Neural Networks in C/C++.
Actually I am using C++ (on Ubuntu with g++ v4.6.1). The library written in C, has a wrapper for C++. But I don't get it to work. Even the example included xor_sample.cpp works.
I have a Makefile with a line like this:
xor_sample:
g++ -I $(FANNINCLUDE) xor_sample.cpp -o xor_sample
Being FANNINCLUDE the path to FANN/src/include, where the headers are (floatfan.h and fann_cpp.h).
Has somebody actually compiled it for C++? What I am doing wrong?
My intention is to use the headers files (NOT installing the library and linking with -lfann). Is this possible?
EDIT: I get this errors
/tmp/ccIpH6p4.o: In function `FANN::training_data::destroy_train()':
xor_sample.cpp:(.text._ZN4FANN13training_data13destroy_trainEv[FANN::training_data::destroy_train()]+0x18): undefined reference to `fann_destroy_train'
/tmp/ccIpH6p4.o: In function `FANN::training_data::read_train_from_file(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
xor_sample.cpp:(.text._ZN4FANN13training_data20read_train_from_fileERKSs[FANN::training_data::read_train_from_file(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x20): undefined reference to `fann_read_train_from_file'
/tmp/ccIpH6p4.o: In function `FANN::training_data::save_train_to_fixed(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)':
xor_sample.cpp:(.text._ZN4FANN13training_data19save_train_to_fixedERKSsj[FANN::training_data::save_train_to_fixed(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)]+0x37): undefined reference to `fann_save_train_to_fixed'
/tmp/ccIpH6p4.o: In function `FANN::training_data::length_train_data()':
xor_sample.cpp:(.text._ZN4FANN13training_data17length_train_dataEv[FANN::training_data::length_train_data()]+0x1f): undefined reference to `fann_length_train_data'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::destroy()':
xor_sample.cpp:(.text._ZN4FANN10neural_net7destroyEv[FANN::neural_net::destroy()]+0x18): undefined reference to `fann_get_user_data'
xor_sample.cpp:(.text._ZN4FANN10neural_net7destroyEv[FANN::neural_net::destroy()]+0x39): undefined reference to `fann_destroy'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::create_standard_array(unsigned int, unsigned int const*)':
xor_sample.cpp:(.text._ZN4FANN10neural_net21create_standard_arrayEjPKj[FANN::neural_net::create_standard_array(unsigned int, unsigned int const*)]+0x1f): undefined reference to `fann_create_standard_array'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::run(float*)':
xor_sample.cpp:(.text._ZN4FANN10neural_net3runEPf[FANN::neural_net::run(float*)]+0x26): undefined reference to `fann_run'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::init_weights(FANN::training_data const&)':
xor_sample.cpp:(.text._ZN4FANN10neural_net12init_weightsERKNS_13training_dataE[FANN::neural_net::init_weights(FANN::training_data const&)]+0x2a): undefined reference to `fann_init_weights'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::save(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
xor_sample.cpp:(.text._ZN4FANN10neural_net4saveERKSs[FANN::neural_net::save(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x30): undefined reference to `fann_save'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::save_to_fixed(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
xor_sample.cpp:(.text._ZN4FANN10neural_net13save_to_fixedERKSs[FANN::neural_net::save_to_fixed(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x30): undefined reference to `fann_save_to_fixed'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::train_on_data(FANN::training_data const&, unsigned int, unsigned int, float)':
xor_sample.cpp:(.text._ZN4FANN10neural_net13train_on_dataERKNS_13training_dataEjjf[FANN::neural_net::train_on_data(FANN::training_data const&, unsigned int, unsigned int, float)]+0x3f): undefined reference to `fann_train_on_data'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::get_MSE()':
xor_sample.cpp:(.text._ZN4FANN10neural_net7get_MSEEv[FANN::neural_net::get_MSE()]+0x20): undefined reference to `fann_get_MSE'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::set_callback(int (*)(FANN::neural_net&, FANN::training_data&, unsigned int, unsigned int, float, unsigned int, void*), void*)':
xor_sample.cpp:(.text._ZN4FANN10neural_net12set_callbackEPFiRS0_RNS_13training_dataEjjfjPvES4_[FANN::neural_net::set_callback(int (*)(FANN::neural_net&, FANN::training_data&, unsigned int, unsigned int, float, unsigned int, void*), void*)]+0x1c): undefined reference to `fann_get_user_data'
xor_sample.cpp:(.text._ZN4FANN10neural_net12set_callbackEPFiRS0_RNS_13training_dataEjjfjPvES4_[FANN::neural_net::set_callback(int (*)(FANN::neural_net&, FANN::training_data&, unsigned int, unsigned int, float, unsigned int, void*), void*)]+0x81): undefined reference to `fann_set_user_data'
xor_sample.cpp:(.text._ZN4FANN10neural_net12set_callbackEPFiRS0_RNS_13training_dataEjjfjPvES4_[FANN::neural_net::set_callback(int (*)(FANN::neural_net&, FANN::training_data&, unsigned int, unsigned int, float, unsigned int, void*), void*)]+0x9c): undefined reference to `fann_set_callback'
xor_sample.cpp:(.text._ZN4FANN10neural_net12set_callbackEPFiRS0_RNS_13training_dataEjjfjPvES4_[FANN::neural_net::set_callback(int (*)(FANN::neural_net&, FANN::training_data&, unsigned int, unsigned int, float, unsigned int, void*), void*)]+0xb3): undefined reference to `fann_set_callback'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::print_parameters()':
xor_sample.cpp:(.text._ZN4FANN10neural_net16print_parametersEv[FANN::neural_net::print_parameters()]+0x18): undefined reference to `fann_print_parameters'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::set_learning_rate(float)':
xor_sample.cpp:(.text._ZN4FANN10neural_net17set_learning_rateEf[FANN::neural_net::set_learning_rate(float)]+0x1f): undefined reference to `fann_set_learning_rate'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::set_activation_function_hidden(FANN::activation_function_enum)':
xor_sample.cpp:(.text._ZN4FANN10neural_net30set_activation_function_hiddenENS_24activation_function_enumE[FANN::neural_net::set_activation_function_hidden(FANN::activation_function_enum)]+0x1f): undefined reference to `fann_set_activation_function_hidden'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::set_activation_function_output(FANN::activation_function_enum)':
xor_sample.cpp:(.text._ZN4FANN10neural_net30set_activation_function_outputENS_24activation_function_enumE[FANN::neural_net::set_activation_function_output(FANN::activation_function_enum)]+0x1f): undefined reference to `fann_set_activation_function_output'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::set_activation_steepness_hidden(float)':
xor_sample.cpp:(.text._ZN4FANN10neural_net31set_activation_steepness_hiddenEf[FANN::neural_net::set_activation_steepness_hidden(float)]+0x1f): undefined reference to `fann_set_activation_steepness_hidden'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::set_activation_steepness_output(float)':
xor_sample.cpp:(.text._ZN4FANN10neural_net31set_activation_steepness_outputEf[FANN::neural_net::set_activation_steepness_output(float)]+0x1f): undefined reference to `fann_set_activation_steepness_output'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::get_network_type()':
xor_sample.cpp:(.text._ZN4FANN10neural_net16get_network_typeEv[FANN::neural_net::get_network_type()]+0x1f): undefined reference to `fann_get_network_type'
/tmp/ccIpH6p4.o: In function `FANN::neural_net::internal_callback(fann*, fann_train_data*, unsigned int, unsigned int, float, unsigned int)':
xor_sample.cpp:(.text._ZN4FANN10neural_net17internal_callbackEP4fannP15fann_train_datajjfj[FANN::neural_net::internal_callback(fann*, fann_train_data*, unsigned int, unsigned int, float, unsigned int)]+0xe): undefined reference to `fann_get_user_data'
collect2: ld returned 1 exit status
make: *** [xor_sample] Error 1
if you just need them installed, they are already on ubuntu repository
sudo apt-get install libfann1 libfann1-dev
if you still want to install it from source, there's a guide on their page
http://leenissen.dk/fann/wp/help/installing-fann/
if this doesn't bring you further, try installing to other location using:
cmake -D CMAKE_INSTALL_PREFIX:PATH=/usr .
Hope this helps
You should still be able to compile it without installing FANN by correcting your makefile
g++ -I $(FANNINCLUDE) xor_sample.cpp -o xor_sample -L $(FANNLIBS) -lfann
Of course you will still need to have compiled LibFANN, and "FANNLIBS" will have to be the directory of the compiled libraries of libfann.