[CMake] static library linking problem

Andreas Mohr andi at lisas.de
Wed May 15 01:54:46 EDT 2013


On Tue, May 14, 2013 at 08:47:36PM -0400, cmake-request at cmake.org wrote:
> Date: Tue, 14 May 2013 19:05:13 -0400
> From: Vojt?ch Nov?k <vonovak at gmail.com>



> I am getting this error:
> 
> undefined reference to `ccv_read_impl(...)'
> and more undefined references to the stuff from the library

As has been clarified by Sasha already, most likely this is a language-side issue.
Since the verbosely displayed command line seems fine, quite likely
we're past CMake configuration questions.

For C vs. C++ linking (symbol {decoration|mangling}) questions,
you'd want to use
nm -n [-C]
and perhaps various checks via objdump.


> libccv.a comes with a header file ccv.h and it depends on libjpeg and
> libpng.
> 
> I wrote my own FindCCV.cmake to find the library and put it into
> ${CMAKE_SOURCE_DIR}/cmake/Modules/, together with finders for jpeg and png.
> As far as I know, all three are found successfully (the REQUIRED keyword
> doesn't stop compilation and there are correct address entries in
> CMakeCache). The libraries are in correct order ccv, jpeg, png (ccv depends
> on them).

Side note: since this seems to be an externally built/non-CMake library,
resorting to Find* (Module mode) rather than Config mode seems obvious.

Andreas Mohr


More information about the CMake mailing list