[CMake] Undefined reference

Mauricio Klein mauricio.klein.msk at gmail.com
Fri Nov 4 09:33:10 EDT 2011


I see.

Well, i will research about package managers to perform this tasks
automatically. Better than manipulate libraries myself.

Thanks guys for every reply sent!

On Fri, Nov 4, 2011 at 5:00 AM, Hendrik Sattler <post at hendrik-sattler.de>wrote:

> Am 03.11.2011 15:51, schrieb Mauricio Klein:
>
>  Thank you Raphael, it worked!
>>
>> One last question: i've tried to compile my code using static linkage,
>> once
>> i need my daemon runs in many Linux releases. But, even static, in many
>> systems my code crashes because the GLIBC version.
>>
>> My question is: asking for static linkage in CMake can solve this problem?
>> Or maybe another approach in CMake, where i embed all the needed
>> libraries...
>>
>> Thanks for your attention!
>>
>> On Thu, Nov 3, 2011 at 12:19 PM, Raphael Kubo da Costa
>> <rakuco at freebsd.org>wrote:
>>
>>  Mauricio Klein
>>> <mauricio.klein.msk at gmail.com> writes:
>>>
>>> > I can compile all my codes without problems, but in the linkage step, i
>>> > receive a lot of errors about undefined reference to OpenSSL functions
>>> > (yes, my code uses OpenSSL).
>>> >
>>> > In my own (and ugly :P) Makefile, i use "-lssl" flag in g++ compile
>>> line.
>>> >
>>> > My question is: how can i pass this flag in CMake.
>>> > Also, i'm not sure if i'm using CMake correctly. Is correctly use
>>> "-lssl"
>>> > flag in CMake or i need to copy the library to a folder inside my
>>> project
>>> > and link to this copy?
>>>
>>> You need to find OpenSSL with `find_package(OpenSSL)' and then, assuming
>>> it is found (ie. OPENSSL_FOUND is true), link to its libraries with
>>> `target_link_libraries(YOUR_**APP ${OPENSSL_LIBRARIES})'.
>>>
>>
> After the issues with glibc were already mentioned, be also aware that
> static linking to openssl is really not recommended. Just look at the
> history of security updates to openssl. Do you really want to ship a new
> executable on every update of any statically linked library? Probably not.
> The only good reason these days to link statically is maybe some
> performance hit shared libraries.
>
> HS
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/**
> opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/**CMake_FAQ<http://www.cmake.org/Wiki/CMake_FAQ>
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/**listinfo/cmake<http://www.cmake.org/mailman/listinfo/cmake>
>



-- 
Best regards,

Maurício Souza Klein.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111104/cf0c084f/attachment.htm>


More information about the CMake mailing list