[CMake] CMAKE -- compiling questions

Michael Hertling mhertling at online.de
Wed May 26 09:54:45 EDT 2010


On 05/26/2010 01:03 PM, Lucian Goron wrote:
> Hello Michael, I followed the steps suggested by you. Here is the result.
> 
> goron at schwarz:~/work/ransac/build$ rm -rf

"rm -rf" does nothing, use "rm -rf *" instead.

> goron at schwarz:~/work/ransac/build$ cmake -DCMAKE_BUILD_TYPE=debug ../
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/goron/work/ransac/build

If the build directory had really been cleaned, CMake would start off
with detecting the compilers, finding packages etc., but so, you just
reconfigured, regenerated the Makefiles and prepared for a rebuild in
the current directory filled with the legacies from the previous run;
in particular, CMake's cache still exists.

> goron at schwarz:~/work/ransac/build$ make VERBOSE=1
> /usr/bin/cmake -H/home/goron/work/ransac -B/home/goron/work/ransac/build
> --check-build-system CMakeFiles/Makefile.cmake 0
> /usr/bin/cmake -E cmake_progress_start
> /home/goron/work/ransac/build/CMakeFiles
> /home/goron/work/ransac/build/CMakeFiles/progress.marks
> make -f CMakeFiles/Makefile2 all
> make[1]: Entering directory `/home/goron/work/ransac/build'
> make -f CMakeFiles/coloredElevationMap.dir/build.make
> CMakeFiles/coloredElevationMap.dir/depend
> make[2]: Entering directory `/home/goron/work/ransac/build'
> cd /home/goron/work/ransac/build && /usr/bin/cmake -E cmake_depends "Unix
> Makefiles" /home/goron/work/ransac /home/goron/work/ransac
> /home/goron/work/ransac/build /home/goron/work/ransac/build
> /home/goron/work/ransac/build/CMakeFiles/coloredElevationMap.dir/DependInfo.cmake
> --color=
> make[2]: Leaving directory `/home/goron/work/ransac/build'
> make -f CMakeFiles/coloredElevationMap.dir/build.make
> CMakeFiles/coloredElevationMap.dir/build
> make[2]: Entering directory `/home/goron/work/ransac/build'
> Linking CXX executable coloredElevationMap
> /usr/bin/cmake -E cmake_link_script
> CMakeFiles/coloredElevationMap.dir/link.txt --verbose=1
> /usr/bin/c++   -Wall -Wno-deprecated
> CMakeFiles/coloredElevationMap.dir/coloredElevationMap.cc.o
> CMakeFiles/coloredElevationMap.dir/home/goron/work/common/StringTokenizer.cc.o
> CMakeFiles/coloredElevationMap.dir/home/goron/work/common/CommonANNRoutines.cc.o
> CMakeFiles/coloredElevationMap.dir/home/goron/work/common/CommonVTKRoutines.cc.o
> CMakeFiles/coloredElevationMap.dir/home/goron/work/common/CommonIORoutines.cc.o
> CMakeFiles/coloredElevationMap.dir/home/goron/work/common/Common3DGeomRoutines.cc.o
> CMakeFiles/coloredElevationMap.dir/home/goron/work/common/CommonTerminalRoutines.cc.o
> CMakeFiles/coloredElevationMap.dir/home/goron/work/common/ANN-VTK.cc.o
> CMakeFiles/coloredElevationMap.dir/home/goron/work/common/VTKShapes.cc.o  -o
> coloredElevationMap -rdynamic -L/home/goron/VTK/VTK-build/bin
> -L../../common/levmar -L../../common/ann/lib -lvtkCommon -lvtkRendering
> -lvtkWidgets -lvtkHybrid -lvtkGraphics -lANN -llapack -llevmar -lvtkParallel
> -lvtkRendering -lvtkGraphics -lvtkverdict -lvtkImaging -lvtkftgl
> -lvtkfreetype -lQtGui -lpng -lSM -lICE -lXrender -lfreetype -lfontconfig
> -lXext -lX11 -lm -lQtSql -lQtCore -lz -lrt -ldl -lXt -lSM -lICE -lXrender
> -lfreetype -lfontconfig -lXext -lX11 -lm -lQtSql -lQtCore -lz -lrt -ldl -lXt
> -lvtkIO -lvtkFiltering -lvtkDICOMParser -lvtkmetaio -lvtksqlite -lvtkpng
> -lvtktiff -lvtkzlib -lvtkjpeg -lvtkexpat -lVPIC -lCosmo -lvtkCommon -lm
> -lpthread -lvtksys -ldl -lvtkexoIIc -lvtkNetCDF -lGL
> -Wl,-rpath,/home/goron/VTK/VTK-build/bin:../../common/levmar:../../common/ann/lib
> 
> CMakeFiles/coloredElevationMap.dir/home/goron/work/common/CommonVTKRoutines.cc.o:
> In function `Create2xRenderWindowAndInteractorMovie(vtkRenderer*,
> vtkRenderer*, char const*, char const*, int, int, int)':
> CommonVTKRoutines.cc:(.text+0xa720): undefined reference to
> `vtkFFMPEGWriter::New()'
> CMakeFiles/coloredElevationMap.dir/home/goron/work/common/CommonVTKRoutines.cc.o:
> In function `Create4xRenderWindowAndInteractorMovie(vtkRenderer*,
> vtkRenderer*, vtkRenderer*, vtkRenderer*, char const*, char const*, int,
> int, int)':
> CommonVTKRoutines.cc:(.text+0xad84): undefined reference to
> `vtkFFMPEGWriter::New()'
> CMakeFiles/coloredElevationMap.dir/home/goron/work/common/CommonVTKRoutines.cc.o:
> In function `CreateRenderWindowAndInteractorMovie(vtkRenderer*, char const*,
> char const*, int, int, int)':
> CommonVTKRoutines.cc:(.text+0xb6e3): undefined reference to
> `vtkFFMPEGWriter::New()'
> collect2: ld returned 1 exit status
> make[2]: *** [coloredElevationMap] Error 1
> make[2]: Leaving directory `/home/goron/work/ransac/build'
> make[1]: *** [CMakeFiles/coloredElevationMap.dir/all] Error 2
> make[1]: Leaving directory `/home/goron/work/ransac/build'
> make: *** [all] Error 2
> goron at schwarz:~/work/ransac/build$

This seems as if the build type has been already set to "debug" afore;
otherwise, the files in CMakeFiles/coloredElevationMap.dir would have
been recompiled. On the other hand, obviously, they were not compiled
with "-g" as they don't reveal line numbers for unresolved references.
Are those files really a part of *that* project, and how do you tell
CMake to account for them, e.g. in an ADD_EXECUTABLE()? Furthermore,
paths like CMakeFiles/coloredElevationMap.dir/home/goron/work/common
seems a little weird to me; do you indeed have home/goron/work/common
as a subdirectory in your project?

Apart from that, I would recommend to follow MW's advice, i.e. rebuild
everything, rebuild comprehensively and start with an empty build
directory.

Regards,

Michael


More information about the CMake mailing list