[mlpack] Follow-up: compilation / linking issue "undefined reference"

Hearn, David J. DHearn at towson.edu
Wed Sep 11 14:00:13 EDT 2019


More below...

Thanks,
David

________________________________
From: Ryan Curtin <ryan at ratml.org>
Sent: Tuesday, September 10, 2019 9:25 PM
To: Hearn, David J. <DHearn at towson.edu>
Cc: mlpack at lists.mlpack.org <mlpack at lists.mlpack.org>
Subject: Re: [mlpack] Follow-up: compilation / linking issue "undefined reference"

[EXTERNAL EMAIL - USE CAUTION]

On Tue, Sep 10, 2019 at 04:18:16AM +0000, Hearn, David J. wrote:
> Hi Ryan,
>
> Thank you very much for your help!
>
> In case this is of use, I ended up removing my new boost installation,
> reinstalling an older boost (using yum), switching to an older gcc
> (4.8.5), and using the following cmake:
>
>  cmake ../ -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/software/mlpack
>  -DUSE_OPENMP=OFF
>  -DARMADILLO_INCLUDE_DIR=/usr/local/software/armadillo-9.600.6/include/
>  -DARMADILLO_LIBRARY=/usr/local/software/armadillo-9.600.6/lib64/libarmadillo.so
>  -DBUILD_PYTHON_BINDINGS=OFF -DBoost_NO_BOOST_CMAKE=1
>  -DBUILD_TESTS=OFF

This seems like a reasonable configuration step to get things working
right, given that Armadillo is in /usr/local/software/ and not in the
default search path.

> No matter what I tried, gcc 9.2 would not finish the compilation.

Hmm, can you provide the error message?  Also, was this the git master
branch or the latest release (3.1.2)?

***mlpack obtained from CLI: git clone https://github.com/mlpack/mlpack.git
***cmake output:
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- cotire 1.7.10 loaded.
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Armadillo: /usr/local/software/armadillo-9.600.6/lib64/libarmadillo.so (found suitable version "9.600.6", minimum required is "6.500.0")
-- Armadillo libraries: /usr/local/software/armadillo-9.600.6/lib64/libarmadillo.so
-- Could NOT find STB_IMAGE (missing: STB_IMAGE_INCLUDE_DIR)
-- [download 0% complete]
-- [download 1% complete]
-- [download 3% complete]
-- [download 5% complete]
-- [download 6% complete]
...
-- [download 100% complete]
-- Successfully downloaded stb into /root/Software/mlpack-githup/mlpack/build/deps/stb/
-- Found ensmallen: /usr/include (found version "1.15.1")
-- Found Boost: /usr/include (found suitable version "1.53.0", minimum required is "1.49") found components:  program_options unit_test_framework serialization
-- Found Git: /bin/git (found version "1.8.3.1")
-- gitversion.hpp is already up to date.
-- Regenerating arma_config.hpp.
-- Not building Markdown bindings.
-- Not building Python bindings.
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- CXX target mlpack cotired.
-- Found Doxygen: /bin/doxygen (found version "1.8.5") found components:  doxygen dot
-- Found PkgConfig: /bin/pkg-config (found version "0.27.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /root/Software/mlpack-githup/mlpack/build

***make output:
[  1%] Updating arma_config.hpp (if necessary)
[  1%] Built target mlpack_arma_config
[  1%] Updating gitversion.hpp (if necessary)
-- Found Git: /bin/git (found version "1.8.3.1")
-- gitversion.hpp is already up to date.
[  1%] Built target mlpack_gitversion
Moving header files to include/mlpack/
[  1%] Built target mlpack_headers
[  2%] Generating CXX prefix source src/mlpack/cotire/mlpack_CXX_prefix.cxx
[  2%] Generating CXX prefix header src/mlpack/cotire/mlpack_CXX_prefix.hxx
[  3%] Building CXX precompiled header src/mlpack/cotire/mlpack_CXX_prefix.hxx.gch
Scanning dependencies of target mlpack
[  4%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/bindings/cli/print_help.cpp.o
[  4%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/bindings/tests/clean_memory.cpp.o
[  5%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/data/load_csv.cpp.o
[  6%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/data/load.cpp.o
[  6%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/dists/discrete_distribution.cpp.o
...
[ 34%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/methods/sparse_coding/sparse_coding.cpp.o
[ 34%] Linking CXX shared library ../../lib/libmlpack.so
[ 34%] Built target mlpack
Scanning dependencies of target mlpack_sparse_coding
[ 35%] Building CXX object src/mlpack/methods/sparse_coding/CMakeFiles/mlpack_sparse_coding.dir/sparse_coding_main.cpp.o
[ 36%] Linking CXX executable ../../../../bin/mlpack_sparse_coding
CMakeFiles/mlpack_sparse_coding.dir/sparse_coding_main.cpp.o: In function `mlpack::bindings::cli::ParseCommandLine(int, char**)':
sparse_coding_main.cpp:(.text+0x3ec0): undefined reference to `boost::program_options::options_description::find(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool, bool) const'
sparse_coding_main.cpp:(.text+0x430e): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/mlpack_sparse_coding.dir/sparse_coding_main.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':
sparse_coding_main.cpp:(.text._ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE6xparseERNS_3anyERKSt6vectorIS7_SaIS7_EE[_ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE6xparseERNS_3anyERKSt6vectorIS7_SaIS7_EE]+0x19): 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)'

> The reuters_example.cpp would not compile unless I commented out:
>
> CLI::ParseCommandLine(argc, argv);

Where did you find these examples?  If the docs are out of date I can
take a minute and update them, but I don't know about the Reuters
example.

***examples are from: git clone https://github.com/chrisjmccormick/mlpack-examples.git Looks like these examples are from a separate repository.



> Now the mlpack-examples seem to compile and run without a core dump,
> so this is definite progress, although the output from knn_example
> appears to be different from the provided "expected" output.

I'm a bit confused too on this one---where is the 'expected' output for
the KNN example?  When I read this page:
http://mlpack.org/doc/mlpack-3.1.1/doxygen/sample.html
it doesn't specify particular expected output.

***The documentation with "expected" output was : https://mccormickml.com/2017/02/01/getting-started-with-mlpack/

***Thank you!!
***David



> Many thanks again! I think I'm to a place where I can begin using
> mlpack.

Great! :)

Thanks,

Ryan

--
Ryan Curtin    | "He's a peculiar man.  You could even say that he
ryan at ratml.org | has principles."  - Carson Wells

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://knife.lugatgt.org/pipermail/mlpack/attachments/20190911/32dce120/attachment.html>


More information about the mlpack mailing list