[cmake-developers] Possibly an obscure bug
Binkie Pinkie
binkiepinkie1917 at gmail.com
Wed Jun 15 14:34:27 EDT 2016
Hi,
TL;DR: The project compiles fine first time, but after touching a source
file to trigger a recompile, the recompilation fails with a large list of
errors.
To reproduce this must be done:
1) Have set(CMAKE_INCLUDE_CURRENT_DIR ON)
2) call your executable "list"
3) #include <list> anywhere in your project or include a system/library
header that #includes <list>
My own example, folder names have nothing to do with the bug:
[-] Blink
CMakeLists.txt
[-]blink
main.cpp
CMakeLists.txt
Top CMakeLists.txt content:
cmake_minimum_required(VERSION 2.8.12)
Project(Blink)
add_subdirectory(blink)
The other CMakeLists.txt file:
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_executable(list main.cpp)
main.cpp:
#include <cstdio>
#include <list>
int main(int argc, char *argv[])
{
printf("Hello, world\n");
return 0;
}
The project will compile, but if main.cpp gets touched the
recompilation will fail.
Using Ubuntu 16.04, cmake version 3.5.1, any compiler (gcc/clang)
And here's the sample output of a failed compilation (the first umpteen lines):
build$ make
Scanning dependencies of target list
make[2]: Circular blink/CMakeFiles/list.dir/main.cpp.o <- blink/list
dependency dropped.
[ 50%] Building CXX object blink/CMakeFiles/list.dir/main.cpp.o
In file included from /media/data/docs/dev/Blink/blink/main.cpp:2:0:
/media/data/docs/dev/Blink/build/blink/list:1:1: error: stray ‘\177’ in program
ELF > � @ @ � @ 8 @ @
^
/media/data/docs/dev/Blink/build/blink/list:1:1: error: stray ‘\2’ in program
/media/data/docs/dev/Blink/build/blink/list:1:1: error: stray ‘\1’ in program
/media/data/docs/dev/Blink/build/blink/list:1:1: error: stray ‘\1’ in program
/media/data/docs/dev/Blink/build/blink/list:1:8: warning: null
character(s) ignored
ELF > � @ @ � @ 8 @ @
^
Plus lots and lots of lines, and ends with:
/media/data/docs/dev/Blink/build/blink/list:1:2: error: ‘ELF’ does not
name a type
ELF > � @ @ � @ 8 @ @
^
/media/data/docs/dev/Blink/build/blink/list:1:651: error: ‘N’ does not
name a type
x-x86-64.so.2 GNU GNU �נ.;N�)��S� cQ
^
blink/CMakeFiles/list.dir/build.make:62: recipe for target
'blink/CMakeFiles/list.dir/main.cpp.o' failed
make[2]: *** [blink/CMakeFiles/list.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:85: recipe for target
'blink/CMakeFiles/list.dir/all' failed
make[1]: *** [blink/CMakeFiles/list.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160615/668e98fb/attachment.html>
More information about the cmake-developers
mailing list