Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#61111 - [cmake] FindBoost with Boost thread generates wrong Boost_LIBRARIES (added -lpthread)

Attached to Project: Arch Linux
Opened by Major (majorx234) - Monday, 17 December 2018, 17:00 GMT
Last edited by Eli Schwartz (eschwartz) - Monday, 17 December 2018, 18:07 GMT
Task Type Bug Report
Category Packages: Extra
Status Unconfirmed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Description:
Problem appear with cmake-3.13.1-1 in old version cmake-3.12.4-1 everything works fine.

If I use boost in a cmake project and use FindBoost.cmake provided by this cmake package
with
find_package(Boost REQUIRED COMPONENTS thread)

I get output in cmake with : MESSAGE(${Boost_LIBRARIES})

Outputstring:

/usr/lib/libboost_thread.so-lpthread/usr/lib/libboost_chrono.so/usr/lib/libboost_system.so/usr/lib/libboost_date_time.so/usr/lib/libboost_atomic.so

so there is a "-lpthread" inside the string of ${Boost_LIBRARIES}
wich leads to errors when cmake generates make files and and gcc try to link against -l-lpthread

I have this problem on 2 pcs even with plain new installed Archlinux just with newest boost package
boost 1.68.0-2
boost-libs 1.68.0-2

in old version cmake-3.12.4-1
the Outputstring of MESSAGE(${Boost_LIBRARIES}) is:
/usr/lib/libboost_date_time.so/usr/lib/libboost_system.so/usr/lib/libboost_thread.so/usr/lib/libboost_chrono.so/usr/lib/libboost_atomic.so

as expected

Steps to reproduce:
small cmake project with
find_package(Boost REQUIRED COMPONENTS thread)
MESSAGE(${Boost_LIBRARIES})
This task depends upon

Comment by Michel (xantares) - Thursday, 25 July 2019, 12:40 GMT
I tried, there is -lpthread in the list
-- Boost_LIBRARIES=/usr/lib/libboost_thread.so;-lpthread;/usr/lib/libboost_chrono.so;/usr/lib/libboost_date_time.so;/usr/lib/libboost_atomic.so

But cmake links fine to it, at least when using target_link_libraries:
target_link_libraries(hello ${Boost_LIBRARIES})

Please close
Comment by Major (majorx234) - Thursday, 25 July 2019, 13:48 GMT
pls don't close, fix it!

it is not standard
for target_link_libraries there are several conventions (paths,names...) but not "-l..."

look at documentation of cmake (https://cmake.org/cmake/help/v3.15/command/target_link_libraries.html)
"Each <item> may be:
..."

for an "<itme>" "-l..." is not mentioned and in point "A link flag: "
it is explicitly excluded "but not -l "
Comment by Michel (xantares) - Thursday, 25 July 2019, 16:29 GMT
it works, so at best its an undocumented cmake feature (you can ask upstream), but certainly not an archlinux bug (and this issue can be closed)

Loading...