Red Hat Bugzilla – Bug 496423
something maybe busted in stdlib.h?
Last modified: 2009-04-23 06:54:26 EDT
Description of problem:
Trying to compile truecrypt on fedora 11, I get this:
In file included from StringConverter.h:12,
/usr/include/stdlib.h:351: error: expected ‘;’ before ‘*’ token
/usr/include/stdlib.h:352: error: expected ‘;’ before ‘*’ token
/usr/include/stdlib.h:353: error: expected ‘;’ before ‘*’ token
/usr/include/stdlib.h:357: error: expected ‘;’ before ‘*’ token
/usr/include/stdlib.h:361: error: ‘int32_t’ has not been declared
I didn't have this problem on fedora 10, but I haven't yet analyzed
it enough to know if the source code is doing something weird or the
stdlib.h header is really busted.
Version-Release number of selected component (if applicable):
Every time I try to compile this code.
Steps to Reproduce:
1.way too complex to describe. This is version 5.0 of the truecrypt
source with some local patches applied.
no compile problems
Created attachment 340196 [details]
Buffer.cpp run through g++ -E
I'm not sure what the heck this code is doing. It appears to maybe be defining
int32 in terms of int32_t and vice-versa, but with some namespaces involved as well. I'm willing to call it a truecrypt source bug, but it is still true that
the same source compiles OK in fedora 10 (or did a while back, I suppose
recent updates may have busted it there as well).
I guess I need to hack the source even more to reliably compile.
Here's the command line used by the Makefile to compile this. There
are lots of suspicous -D options as well (this is the version I modified
to use -E instead of -c):
g++ -E -MMD -I/zooty/build/truecrypt-5.0-source -I/zooty/build/truecrypt-5.0-source/Crypto -DBOOL=int -DFALSE=0 -DTRUE=1 -D__int8=char -D__int16=short -D__int32=int '-D__int64=long long' -O2 -fno-strict-aliasing -DTC_UNIX -DTC_LINUX -fdata-sections -ffunction-sections -Wall -Wno-sign-compare -Wno-unused-parameter Buffer.cpp > Buffer.e
Can you please add -dD to the options, so that macros can be seen in the preprocessed source as well?
Created attachment 340850 [details]
Buffer.cpp run through g++ -E -dD
OK, here's the same file with -dD added to the command line.
I did discover a way to get this to work: After I unpack and patch the source,
I added a little script that runs through all the .cpp files and just
at the beginning of the file so it is included before all other local includes.
Everything seems to compile perfectly fine if I do that, and it is no worse
than most of the other hacks I'm doing to the source :-).
That's clearly a truecrypt bug.
See how it does:
That's invalid, standard headers may be only included outside of any external declaration or definition, so can't be included from within a namespace definition, see ISO C++ [lib.using.headers]/3.
Yea, I was definitely leaning toward a truecrypt bug, I just couldn't
figure out what silly thing it was doing. Thanks for letting me know.