Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boost: undefined reference #7

Open
trasherdk opened this issue Oct 8, 2020 · 4 comments
Open

boost: undefined reference #7

trasherdk opened this issue Oct 8, 2020 · 4 comments

Comments

@trasherdk
Copy link
Contributor

I can't figure this one out. I'm getting this error:

/path/monero/monero-build/src/blockchain_db/libblockchain_db.a(db_lmdb.cpp.o): In function `boost::filesystem::unique_path(boost::filesystem::path const&)':
db_lmdb.cpp:(.text._ZN5boost10filesystem11unique_pathERKNS0_4pathE[_ZN5boost10filesystem11unique_pathERKNS0_4pathE]+0x33): undefined reference to `boost::filesystem::detail::unique_path(boost::filesystem::path const&, boost::system::error_code*)'

My system boost library is boost-1.59.0 and the Monero one seems to be boost-1.64.0 but the declarations are identical.

I have checked boost header file filesystem/operations.hpp and both function are defined.

/usr/include/boost/filesystem/operations.hpp
    BOOST_FILESYSTEM_DECL
    path unique_path(const path& p, system::error_code* ec=0);

  inline
  path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%")
                                       { return detail::unique_path(p); }
  inline
  path unique_path(const path& p, system::error_code& ec)
                                       { return detail::unique_path(p, &ec); }

I checked the library file

/usr/lib64/libboost_filesystem.a
 _ZN5boost10filesystem6detail11unique_pathERKNS0_4pathEPNS_6system10error_codeE

And the one in the error

From the error
 _ZN5boost10filesystem11unique_pathERKNS0_4pathE

They seem to point to different functions ???

So. What am I missing here? What can I do?

@vtnerd
Copy link
Owner

vtnerd commented Oct 8, 2020

do message("${Boost_INCLUDE_DIR}") somewhere after the boost find step to see which Boost version is being used. This seems like a mismatch between header-file and library file.

@trasherdk
Copy link
Contributor Author

They looks fine to me:

Boost_INCLUDE_DIR.........: /usr/include
Boost_THREAD_LIBRARY......: /usr/lib64/libboost_thread.a
Boost_FILESYSTEM_LIBRARY..: /usr/lib64/libboost_filesystem.a

Is Monero build against something else? I can't find boost/filesystem/* with unique_path .

@trasherdk
Copy link
Contributor Author

It seems that monero-lws-daemon does not like a static linked version of boost.

The monero-lws-admin did build against a static boost without problems.

I removed the static boost, installed a dynamic, same version 1.59.0, and the build completed.

@j-berman
Copy link
Contributor

j-berman commented Feb 15, 2022

I was running into this too (trying to link a static build of monerod to monero-lws here). I read that ordering can cause pernicious linker issues. So I tried switching ${Boost_FILESYSTEM_LIBRARY} with ${Boost_PROGRAM_OPTIONS_LIBRARY} and it worked. Would be neat to understand why this is the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants