[CMake] CMAKE_DL_LIBS

Aaron Boxer boxerab at gmail.com
Tue Mar 1 10:37:19 EST 2016


Thanks! I found the problem: I needed to add CMAKE_DL_LIBS to another
static library that the main exe was linking to.
Now this link error is gone.


On Tue, Mar 1, 2016 at 9:55 AM, J. Caleb Wherry <calebwherry at gmail.com>
wrote:

> That link looks fine to me. You might want to verify that the
> CMAKE_DL_LIBS variable actually contains what it should on your system (or
> a least contains what it should right before using it).
>
> You could explicitly add the "-dl" to that link statement and see if that
> works. That's what that variable should contain anyways on Linux boxes.
>
> -Caleb
>
> (Pasting off list response below)
>
> Thanks, Caleb. Are you saying that I need to add "-ldl" link lib in
> addition to ${CMAKE_DL_LIBS} ?
>
>
> My CMake file is here:
>
>
> https://github.com/GrokImageCompression/opendcp/blob/master/cli/CMakeLists.txt
>
> and the lines for the exe that is not linking are found here:
>
> TARGET_LINK_LIBRARIES(opendcp_j2k ${CMAKE_DL_LIBS} ${OPENDCP_LIB} )
>
>
> This is an open source proj, by the way. I can send you a few short lines
> about how to build on Ubuntu, if you are interested.
>
> Thanks very much for your help.
>
>
> Aaron
>
> On Tuesday, March 1, 2016, Aaron Boxer <boxerab at gmail.com> wrote:
>
>>
>>
>> On Tue, Mar 1, 2016 at 9:06 AM, Aaron Boxer <boxerab at gmail.com> wrote:
>>
>>> Hello!
>>> I have a CMAKE project that creates an executable that links with a
>>> static lib
>>> from a second CMAKE project. The static lib requires the dlopen and
>>> dlclose
>>> symbols.
>>>
>>> So, when I link the first project, I add ${CMAKE_DL_LIBS} to the CMake
>>> file.
>>>
>>> However, I still get an error about "undefined reference to symbol
>>> "dlclose...."
>>>
>>
>> The error states: "missing DSO from command line"
>>
>> Also, the second CMAKE project also contains executables that link with
>> the static
>> library, and they link with no problem.
>>
>>
>>
>>
>>
>
> --
> Sent from my iPhone 4s
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160301/b7623656/attachment-0001.html>


More information about the CMake mailing list