[CMake] CTest having difficulty determining where certain errors occurred
troy d. straszheim
troy at resophonic.com
Thu May 29 11:05:14 EDT 2008
Hey CMake and Co,
Here's a snippet from a log generated by ctest:
<Error>
<BuildLogLine>1042</BuildLogLine>
<Text>/usr/bin/ld: cannot find -lboost_serialization-static
</Text>
<PreContext>/usr/local/bin/cmake -E cmake_progress_report /.../Boost_1_35_0-build/CMakeFiles
[ 15%] Building CXX object libs/date_time/test/CMakeFiles/Date_time/testgreg_serialize.dir/gregorian/testgreg_serial
ize.cpp.o
cd /.../Boost_1_35_0-build/libs/date_time/test && /usr/bin/c++ -DBOOST_ALL_NO_LIB=1 -I/.../Boost_1_35_0
-DBOOST_DATE_TIME_STATIC_LINK -DBOOST_ALL_NO_LIB -DUSE_DATE_TIME_PRE_1_33_FACET_IO -O3 -DNDEBUG -o CMakeFil
es/Date_time/testgreg_serialize.dir/gregorian/testgreg_serialize.cpp.o -c /.../Boost_1_35_0/libs/date_time/test/greg
orian/testgreg_serialize.cpp
Linking CXX executable ../../../bin/tests/Date_time/testgreg_serialize
cd /.../Boost_1_35_0-build/libs/date_time/test && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/Date_
time/testgreg_serialize.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC CMakeFiles/Date_time/testgreg_serialize.dir/gregorian/testgreg_serialize.cpp.
o -o ../../../bin/tests/Date_time/testgreg_serialize -rdynamic ../../../lib/libboost_date_time.a -lboost_serializat
ion-static
</PreContext>
<PostContext></PostContext>
<RepeatCount>0</RepeatCount>
</Error>
<Error>
<BuildLogLine>1043</BuildLogLine>
<Text>collect2: ld returned 1 exit status
</Text>
<PreContext></PreContext>
<PostContext>make[2]: Leaving directory `/.../Boost_1_35_0-build'
/usr/local/bin/cmake -E cmake_progress_report /.../Boost_1_35_0-build/CMakeFiles
make[2]: [bin/tests/Date_time/testgreg_serialize] Error 1 (ignored)
[ 15%] Built target Date_time/testgreg_serialize
/usr/bin/make -f libs/date_time/test/CMakeFiles/Date_time/testgreg_serialize_dll.dir/build.make libs/date_time/test/CMakeFiles/Date_time/testgreg_serialize_dll.dir/depend
make[2]: Entering directory `/.../Boost_1_35_0-build'</PostContext>
<RepeatCount>0</RepeatCount>
</Error>
Here, a binary isn't linking due to the fact that one of its dependencies wasn't built (it was
turned off via cmake option). But that isn't obvious from the structure of the data (you have to read
the context) and makes it impossible to categorize this error cleanly e.g. on a dashboard. The best you
can do, it seems, is to report two different instances of 'filename unknown, line unknown',
even though the directory and the name of the failed target are reported by make.
By contrast here is a compiler error
<Error>
<BuildLogLine>3460</BuildLogLine>
<Text>/.../Boost_1_35_0/libs/smart_ptr/test/shared_ptr_test.cpp:3:2: error: #error TDS: playing with ctest. compiler error here.
</Text>
<SourceFile>libs/smart_ptr/test/shared_ptr_test.cpp</SourceFile>
<SourceLineNumber>3</SourceLineNumber>
<PreContext>make[2]: Leaving directory `/.../Boost_1_35_0-build'
/usr/bin/make -f libs/smart_ptr/test/CMakeFiles/Smart_pointer/shared_ptr_test.dir/build.make libs/smart_ptr/test/CMakeFiles/Smart_pointer/shared_ptr_test.dir/build
make[2]: Entering directory `/.../Boost_1_35_0-build'
/usr/local/bin/cmake -E cmake_progress_report /.../Boost_1_35_0-build/CMakeFiles
[ 56%] Building CXX object libs/smart_ptr/test/CMakeFiles/Smart_pointer/shared_ptr_test.dir/shared_ptr_test.cpp.o
cd /.../Boost_1_35_0-build/libs/smart_ptr/test && /usr/bin/c++ -DBOOST_ALL_NO_LIB=1 -I/.../Boost_1_35_0 -O3 -DNDEBUG -o CMakeFiles/Smart_pointer/shared_ptr_test.dir/shared_ptr_test.cpp.o -c /.../Boost_1_35_0/libs/smart_ptr/test/shared_ptr_test.cpp
</PreContext>
<PostContext>make[2]: [libs/smart_ptr/test/CMakeFiles/Smart_pointer/shared_ptr_test.dir/shared_ptr_test.cpp.o] Error 1 (ignored)
Linking CXX executable ../../../bin/tests/Smart_pointer/shared_ptr_test
cd /.../Boost_1_35_0-build/libs/smart_ptr/test && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/Smart_pointer/shared_ptr_test.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC CMakeFiles/Smart_pointer/shared_ptr_test.dir/shared_ptr_test.cpp.o -o ../../../bin/tests/Smart_pointer/shared_ptr_test -rdynamic
make[2]: Leaving directory `/.../Boost_1_35_0-build'
/usr/local/bin/cmake -E cmake_progress_report /.../Boost_1_35_0-build/CMakeFiles </PostContext>
<RepeatCount>0</RepeatCount>
</Error>
Where the source of the error is obvious.
I'd like to try to improve this. At first glance you'd try to scrape the name of the failed target
out of the log and report it inside <Target> tags with each error/warning.
I've been picking through ctest's source code and am willing to give it a shot, but first....
Sanity check? Has this been given any thought? Are there hidden showstoppers? Would upstream take the changes?
Thanks,
-t
More information about the CMake
mailing list