The following issue popped up in my open source library, and I can't figure out what's going on.
Two of my users have (gcc) compiler errors that look like:
/home/someone/Source/src/._regex.cpp:1:1: warning: null character(s) ignored
/home/someone/Source/src/._regex.cpp:1: error: stray ‘\5’ in program
/home/someone/Source/src/._regex.cpp:1: error: stray ‘\26’ in program
/home/someone/Source/src/._regex.cpp:1: error: stray ‘\7’ in program
/home/someone/Source/src/._regex.cpp:1:5: warning: null character(s) ignored
/home/someone/Source/src/._regex.cpp:1: error: stray ‘\2’ in program
...
I can't reproduce these errors; the code compiles fine on all machines I've tested.
Googling around seemed to indicate that this is often a result of a strange encoding or strange formatting, but I ran all the source through a hex editor, and all characters are either printable ASCII (0x20 - 0x7E), or tab, or newline. That's it.
Also, both users successfully compiled the previous version of the library; but the particular file in question (regex.cpp
) and its header files haven't been modified since that time!
Please see here for more details, including links to download the code if you want. But I'd be happy with just a pointer in a possible direction.
Baffe Boyois has got the right general answer - your CMake rules must be doing too much.
On MacOS X 10.5.8 (Leopard), I get:
You should list the files you need compiled; you should not just compile all and sundry.
The problem seems to be in CMakeLists.txt:
Either the CMake GLOB is a bit too enthusiastic (I'm using version 2.6-patch 4) or you cannot afford to use it while any of your customers are using MacOS X.
What the GLOB is doing expanding to include files starting with '.' is anyone's guess; I'd be inclined to regard it as a bug in cmake.
However, as a workaround, I edited CMakeLists.txt and got this to work:
This isn't the complete solution: I ran into a continuation of the problem with the code in the yaml-reader directory. I modified the yaml-reader/CMakeLists.txt file in basically the same way.
FWIW:
One odd detail - some of the files in the 'src' directory do not have the shadow files. When I do 'tar -tvf yaml-cpp-0.2.3.tar.gz', I see the files being shipped with the source:
So the miscreant files are being shipped with the product tar file. You got infected somewhere - not sure how.
I just had this happen with my c++ program that I was making. This occurred when I copied the formula for double hashing from a pdf file, which was
I through it was the modulo operator, but it turned out to be the encoding or something, but I resolved this by deleting it and manually typing it.
The errors are in
._regex.cpp
, notregex.cpp
. Files staring with._
are autogenerated by MacOS. It seems your build system tries to compile all files ending with .cpp. It probably shouldn't compile anything starting with a dot.Could be a corrupt file on their part.
What's on line 1 of _regex.cpp on THEIR system.
If there was a download / encoding issue you'll have to look at what's in the files on their system, not what's in your code repository.
Make sure you only have .o files in your build directory. I had this issue and the cause was an error in my Makefile (actually it was an scons file) that built one source file to a .c file instead of a .o file. The resulting file was a binary, but I'm assuming gcc tried to interpret it as a .c file.