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

Linking with Boost librarie #69

Closed
ghost opened this issue Jul 17, 2014 · 9 comments
Closed

Linking with Boost librarie #69

ghost opened this issue Jul 17, 2014 · 9 comments

Comments

@ghost
Copy link

ghost commented Jul 17, 2014

Ubuntu 14.04.
x64
Using libboost1.55

At [49%] Built target pagmo_static
Linking CXX executable main"

I start getting a lot of undefined references to boost library things.

"In function pagmo::detail::get_current_thread_data()"
... "undefined reference to boost::this_thread::interruption_point()"
... "boost::thread::detatch"
... "boost::thread::XX"
etc.

I checked. libboost-thread1.55-dev
is installed via apt-get.

It seems that in the Ubuntu repositories, there are two variants of boost. There is 1.54 and 1.55. I installed the latter.

@darioizzo
Copy link
Member

This is a known behavior in Ubuntu and its related to some change that
Canonical must have introduced in the gnu toolset.

Easy workaround is to change the order of linking. First the static then
the mandatory. Relevant file is
https://github.com/esa/pagmo/blob/master/CMakeLists.txt
line 424. Just put

TARGET_LINK_LIBRARIES (main pagmo_static ${MANDATORY_LIBRARIES} )

And the same for examples and tests in case you need them

Dario

On 17 July 2014 17:24, JonathanGallagher notifications@github.com wrote:

Ubuntu 14.04.
x64
Using libboost1.55

At [49%] Built target pagmo_static
Linking CXX executable main"

I start getting a lot of undefined references to boost library things.

"In function pagmo::detail::get_current_thread_data()"
... "undefined reference to boost::this_thread::interruption_point()"
... "boost::thread::detatch"
... "boost::thread::XX"
etc.

I checked. libboost-thread1.55-dev
is installed via apt-get.

It seems that in the Ubuntu repositories, there are two variants of boost.
There is 1.54 and 1.55. I installed the latter.


Reply to this email directly or view it on GitHub
#69.

@ghost
Copy link
Author

ghost commented Jul 17, 2014

Thank you. It seems to build fine now!!

@ghost ghost closed this as completed Jul 17, 2014
@fredRos
Copy link

fredRos commented Nov 7, 2014

This helped me on Ubuntu 14.04! But I strongly suggest you make this fix in the master branch: for static libraries, the order of linking is important, and symbols are resolved from left to right. Some linkers may be more permissive, but the Ubuntu linker now just follows the standard! For the background, check http://stackoverflow.com/a/409470/987623

@darioizzo
Copy link
Member

Frederik,

changing the order in the master branch breaks linking in fedora, gentoo,
archlinux and all the distribution that use the standard gnu toolset.

Dario

On 7 November 2014 21:20, Frederik Beaujean notifications@github.com
wrote:

This helped me on Ubuntu 14.04! But I strongly suggest you make this fix
in the master branch: for static libraries, the order of linking is
important, and symbols are resolved from left to right. Some linkers may be
more permissive, but the Ubuntu linker now just follows the standard! For
the background, check http://stackoverflow.com/a/409470/987623


Reply to this email directly or view it on GitHub
#69 (comment).

@fredRos
Copy link

fredRos commented Nov 7, 2014

That is surprising. I have no way of checking, but if you say so, I'm sure you tried. That would mean the linkers on all these systems act strangely.

@darioizzo
Copy link
Member

We did try indeed ... and were equally disappointed :)

On 7 November 2014 21:30, Frederik Beaujean notifications@github.com
wrote:

That is surprising. I have no way of checking, but if you say so, I'm sure
you tried. That would mean the linkers on all these systems act strangely.


Reply to this email directly or view it on GitHub
#69 (comment).

@fredRos
Copy link

fredRos commented Nov 7, 2014

So would I :-)

@steven-varga
Copy link

Thank you! above advice worked for me on LINUX MINT 17 ID-d below with

pagmo TAG: 1.1.7-2-g140296f

Date: Sat Jul 4 18:49:27 2015 +0200

DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=17
DISTRIB_CODENAME=qiana
DISTRIB_DESCRIPTION="Linux Mint 17 Qiana"
NAME="Ubuntu"
VERSION="14.04.1 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.1 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
cat: /etc/upstream-release: Is a directory

@manuel-j-diaz
Copy link

`This is a known behavior in Ubuntu and its related to some change that
Canonical must have introduced in the gnu toolset.

Easy workaround is to change the order of linking. First the static then
the mandatory. Relevant file is
https://github.com/esa/pagmo/blob/master/CMakeLists.txt
line 424. Just put

TARGET_LINK_LIBRARIES (main pagmo_static ${MANDATORY_LIBRARIES} )

And the same for examples and tests in case you need them

Dario`

@darioizzo , where would this go now with the newer version of the CMakeLists.txt file? I'm having the same issues on Ubuntu 16.04 running gcc 5.4.0.

This issue was closed.
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

4 participants