Bug 41472 - gcc preprocessor fails
gcc preprocessor fails
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
http://lark.cc.ukans.edu/~pauljohn/Sw...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-05-20 21:27 EDT by Paul Johnson
Modified: 2007-04-18 12:33 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-05-24 21:58:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Paul Johnson 2001-05-20 21:27:41 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.2-2 i686)

Description of problem:
This code builds with gcc 2.95.3 and 2.96.69, but not with gcc in RH 7.1. 
The swarm codebase was prepared by the Swarm Development Group, mainly by
Marcus Daniels.  It is important to our users that this be fixed because
the gcc issues on RH 7.0/7.1 systems are confusing/disappointing.


I gave the URL above where you can get the tarball with the code, spec
file, and image.  

The build ends like this:
gcc -DHAVE_CONFIG_H -I.
-I/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.69.20010514/src/ac
tivity -I../.. -I../.. -I..
-I/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.69.20010514/sr
c/activity/.. -I../../libobjc
-I/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.69.20010514/
libobjc
-I/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.69.20010514/src/activity/../collections
-I/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.69.20010514/src/activity/../defobj
-I/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.69.20010514/src/activity/../misc
-I/usr/local/jdk1.3/include -I/usr/local/jdk1.3/include/linux
-I../../avcall -D_GNU_SOURCE -DBUILDING_SWARM -g -O2 -march=i686 -Wall
-Wno-import -Wno-protocol -Werror -Wno-unknown-pragmas -c  -fPIC -DPIC
/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.69.20010514/src/activity/activity.m
-o .libs
/activity.lo
In file included from
/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.69.20010514/src/activity/activity.m:12:
/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.69.20010514/src/activity/activity.h:530:2:
invalid preprocessing directive #&
/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.69.20010514/src/activity/activity.h:569:2:
invalid preprocessing directive #"493"
make[3]: *** [activity.lo] Error 1
make[3]: Leaving directory
`/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.69.20010514/=wit
h-hdf/src/activity'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory
`/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.69.20010514/=wit
h-hdf/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory
`/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.69.20010514/=wit
h-hdf'
make: *** [all-recursive-am] Error 2


How reproducible:
Always

Steps to Reproduce:
1. Open tarball:
http://lark.cc.ukans.edu/~pauljohn/Swarm/Swarm-2.x_RPMSforRH7/swarm-2.1.69.tar.gz
2. move spec file to your SPEC dir, others to SOURCES	
3. In SPEC dir, do  rpm -ba swarm-hdf5-jdk-RH7-2.1.69.spec --target=i686
	

Actual Results:  make fails. I pasted the screen dump under "Description"

Expected Results:  clean build!

Additional info:

I have submitted a couple of these gcc bugs before and JB has always fixed
them, so I have a lot of confidence in you folks.
Comment 1 Peter H. Jones 2001-05-24 21:58:52 EDT
When I first tried compiling one of the test versions of swarm at ftp://ftp.swarm.org/pub/swarm/src/testing/, I got similar diagnostics. I subscribed to the 
swarm support discussion list (swarm-support at santafe.edu), reported being unable to compile the latest tar file, under RedHat 7.1, and was told that 
2.96 was not a supported version of gcc, and that I should get hold of gcc 2.95.3. 

I have observed the "invalid preprocessor" message  with the swarm version at ftp://ftp.swarm.org/pub/swarm/src/testing/swarm-2001-05-21.tar.gz .
(This directory contains development versions of swarm.) In other words:
1. Download and unpack with "tar -zxvf swarm-2001-05-21.tar.gz" to create source directory 2001-05-21 .
2. Create a workng directory and cd to it: "mkdir work; cd work"
3. Configure and make: "../2001-05-21/configure; make"
Soon, I got the invalid preprocessing directive.

Following the suggestion to try gcc-2.95.3, I obtained gcc from ftp://ftp.gnu.org/gnu/gcc, and installed to a special directory.
Making a work directory as above and cd-ing to it, I did:
a) "../gcc2.95.3/configure --prefix=/gcc2953 --languages=objc"
b) "make bootstrap-lean" (plus other flags suggested in the install/BUILD file in gcc-2.95.3.tar.gz)
c) (As root) "make install",

Rebuilding swarm, I replaced Step 3 above with:
"CC=/gcc2953/bin/gcc ../configure; make"
This time, compilation got further along, but complained about the lack of a JDK (beyond the scope of this bug report)

Comparing the two runs, differing only in gcc version, I observed that file src/activity/activity.xm was different. If one cd's to 
src/activity in the work directory, removes activity.xm and types "make", one gets the diagnostic again. Further analysis
showed the two versions of gcc, invoked here with "gcc -E", don't behave the same way. The invalid preprocessor diagnostics
occur only with gcc-2.96 (supplied by RedHat).

Have the specifications of pre-processing changed between 2.95 and 2.96? I could not find any documentation at RedHat.

Peter Jones

PS Should changes to this bug report be echoed to the swarm discussion list?
Comment 2 Jakub Jelinek 2001-06-06 08:52:50 EDT
This is a bug in swarm, not gcc. They are relying on preprocessor to add
empty lines where they want, but the new preprocessor in gcc-2.96-RH and up
does not emit unneeded space without a reason.
Particularly, where old preprocessor output:
externvar id <Symbol> Concurrent, Sequential, Randomized;

...21 empty lines...
typedef unsigned long timeval_t;
new preprocessor now outputs:
externvar id <Symbol> Concurrent, Sequential, Randomized;
# 493 "./activity.h"
typedef unsigned long timeval_t;
(the line directive moves the source position 21 lines down).
make-h2x script which works on preprocessed source is not flexible enough though.
The patch below seems to fix this, in addition to removing #import keywords
first, because the new preprocessor correctly expands #import directives
while the old did not and thus even if the first bug in make-h2x is fixed,
it generates far bigger .xm file.
--- swarm-2.1.69.20010514/src/defobj/make-h2x.jj        Wed Jun  6 14:34:07 2001
+++ swarm-2.1.69.20010514/src/defobj/make-h2x   Wed Jun  6 14:39:48 2001
@@ -37,15 +37,17 @@ echo \
 # note that we identify Symbol, Warning, Error and Event
 # *only* in the context of `extern', and we use a second
 # sed script to remove the `extern' after identification
-sh -c "$OBJC $OBJCFLAGS -Ddisable_externvar -E $srcdir/$m.h" | \
+grep -v '^#import' $srcdir/$m.h | \
+sh -c "$OBJC $OBJCFLAGS -Ddisable_externvar -x objective-c -E -" | \
 sed -n \
   -e 's@//.*$@@' \
   -e 's/       //g' \
   -e 's/[ ][ ]*//g'  -e 's/L//g' \
-  -e '/externvarid<Symbol>/,/^$/p' \
-  -e '/externvarid<Warning>/,/^$/p' \
-  -e '/externvarid<Error>/,/^$/p' \
-  -e '/externvarid<Event>/,/^$/p' | sed -e 's/externvar/externvardef /g' >$m.xm+
+  -e '/externvarid<Symbol>/,/^\($\|#[0-9]\)/p' \
+  -e '/externvarid<Warning>/,/^\($\|#[0-9]\)/p' \
+  -e '/externvarid<Error>/,/^\($\|#[0-9]\)/p' \
+  -e '/externvarid<Event>/,/^\($\|#[0-9]\)/p' | \
+sed -e '/^#[0-9]/d;s/externvar/externvardef /g' >$m.xm+

 # define symbol identifiers in generated file

Note You need to log in before you can comment on or make changes to this bug.