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

Ryan Curtin ryan at ratml.org
Fri Sep 6 11:44:48 EDT 2019


On Fri, Sep 06, 2019 at 03:31:40PM +0000, Hearn, David J. wrote:
> Hello,
> 
> I'm very sorry to post a repeat request. i know you all are very busy,
> but for the life of me, I cannot get mlpack code - or the library
> itself - to compile correctly on my system. I'm reposting my previous
> message in the hopes in won't get lost in the transition between
> August and September posts. I've done quite a bit of coding and have
> not run into this issue before.

Hey David,

Sorry for the slow response.  I hadn't had a chance to respond yet, but
I was able to take a minute now.

> When I tried to compile this code with:
> g++ knn_example.cpp -o knn_example -std=c++11 -larmadillo -lmlpack -lboost_serialization -fopenmp
> 
> ...
> 
> , the error I get is as follows:
> 
> /tmp/cckP4kAv.o: In function `main':
> knn_example.cpp:(.text+0x317): undefined reference to `bool mlpack::data::Load<double>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, arma::Mat<double>&, bool, bool)'
> ...

That's very strange.  I tried to reproduce this in a fedora rawhide
docker container and couldn't---it compiles correctly on my system.

Is it possible that there are multiple versions of libmlpack.so
installed on your system in different places?

> I've also tried compiling mlpack itself from source using
> boost_1_71_0, but even after giving cmake the BOOST_ROOT, boost is not
> linking appropriately when 'make' is run. Although this is a separate
> issue, if anyone has suggestions about either of these approaches to
> using mlpack, I'd be very grateful.

I haven't figured it out yet, but Boost's interactions with CMake after
1.70.0 have gotten... weird.  I now configure with
-DBoost_NO_BOOST_CMAKE=1 and this seems to make things a little bit more
sane.

Hope this helps!

Thanks,

Ryan

-- 
Ryan Curtin    | "I am the luckiest man alive!"
ryan at ratml.org |   - General Borzov


More information about the mlpack mailing list