izak
izak

Reputation: 832

What would cause a compiler to fail randomly?

I am using the clang compiler on windows. I used the installer from the LLVM website. Sometimes it gives me a compiler error.

clang -I./include main.c CoreFoundation.dll

it gives:

In file included from main.c:4:
In file included from ./include\CoreFoundation/CFNumberFormatter.h:110:
./include\CoreFoundation/CFXMLParser.h:159:81: error: unknown type name 'CFXMLNodeRef'
typedef void *          (*CFXMLParserCreateXMLStructureCallBack)(CFXMLParserRef parser, 

CFXMLNodeRef nodeDesc, void *info);
...

and sometimes this..

In file included from main.c:4:
In file included from ./include\CoreFoundation/CoreFoundation.h:86:
./include\CoreFoundation/CFDateFormatter.h:104:105: error: unknown type name 'CFDateRef'; did you mean 'CFDataRef'?
CFStringRef CFDateFormatterCreateStringWithDate(CFAllocatorRef allocator, CFDateFormatterRef formatter, CFDateRef date) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
...

...and other similar warnings, seemingly randomly choosing where to stop. Sometimes it compiles through without error. When it gives an error, they seem to be be about not finding a symbol from an included file. It doesn't complain about not finding the file. But it doesn't consistently stop at the same point and sometimes compiles successfully.

Upvotes: 0

Views: 369

Answers (1)

gj13
gj13

Reputation: 1354

I can reproduce this "error" under Linux with gcc. I even get the "report this compiler bug pls" message.

When it gives an error, they seem to be be about not finding a symbol from an included file

You can get this:

  1. if you compile with multiple threads (eg. make -j8)
  2. if you abort the compile and then start it again without "cleaning" all obj files
  3. if you compiled your source, changed something and compile without "cleaning"
  4. if your compiler/make/build process changes the order every time... (had this with cmake and opencv 3 source)

Upvotes: 2

Related Questions