[CMake] Undefined reference

Mauricio Klein mauricio.klein.msk at gmail.com
Thu Nov 3 13:39:09 EDT 2011


ldd reports that is not dynamically executable, as expected. But even ldd
saying that, the problem with GLIBC occurs.

On Thu, Nov 3, 2011 at 3:33 PM, Michael Hertling <mhertling at online.de>wrote:

> On 11/03/2011 06:20 PM, Mauricio Klein wrote:
> > The error reported occurs in the launch time: the daemon doesn't starts
> and
> > report (in terminal) a GLIBC version error. [...]
>
> Usually, this means that it has *not* been linked statically against
> the GLIBC on the build system. Which dependencies does ldd report?
>
> > [...] I mean, the daemon was compiled
> > in a old CentOS (4.8) and i'm trying to run in the latest Ubuntu.
> >
> > But anyway, i will make more tests as you sugested and try to discovery
> > what exactly is happening.
> >
> > Once again, thank you so much for your help!
> >
> > On Thu, Nov 3, 2011 at 3:09 PM, Michael Hertling <mhertling at online.de
> >wrote:
> >
> >> On 11/03/2011 03:51 PM, Mauricio Klein wrote:
> >>> 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.
> >>
> >> How do these crashes manifest themselves, e.g. shell/syslog messages,
> >> return values, core dumps etc.? Are you sure they are related to the
> >> GLIBC version? Does the executable actually have no single dependency
> >> on any shared library, i.e. is it linked statically in its entirety?
> >> What does ldd or readelf report?
> >>
> >>> My question is: asking for static linkage in CMake can solve this
> >> problem?
> >>
> >> If even a statically linked executable crashes on the target system,
> >> telling CMake to link statically will hardly solve this problem. ;)
> >>
> >>> Or maybe another approach in CMake, where i embed all the needed
> >>> libraries...
> >>
> >> You might take a look the the BundleUtilities Module, but at first,
> >> I'd recommend to investigate what exactly causes the crashes. Your
> >> best bet is probably to provide a tiny but self-contained example
> >> that works on your development platform and crashes on a target
> >> system, along with some information about the latter's setup.
> >>
> >> Regards,
> >>
> >> Michael
> >>
> >>> 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})'.
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> 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
>
> Follow this link to subscribe/unsubscribe:
> 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/20111103/5756c107/attachment.htm>


More information about the CMake mailing list