public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Strange gcc #include behavior when compiling multiple source files at once
@ 2011-12-06 14:07 Alfred von Campe
  2011-12-06 14:19 ` Jonathan Wakely
  2011-12-08 15:03 ` Alfred von Campe
  0 siblings, 2 replies; 4+ messages in thread
From: Alfred von Campe @ 2011-12-06 14:07 UTC (permalink / raw)
  To: gcc-help

I have a shell script which is run as root (with sudo) that contains the following line
(split here for readability):

    $STTOOLPATH/sh4-linux-gcc -O2 $EXTRA_PREPROCESSOR_DEFINE $RELEASE_DEFINE \
    -I../../../../Components/Messaging -I../AvRouting/AVRD/Main -I../IPC/common_files \
    -I../OSAbstraction -I../IPC/LPMLib -I../../Drivers/LPM -I../../Drivers/AVRDriver \
    -I../../Drivers/Diagnostics -I../../../LPM/share -I../../../LPM/LPMcode \
    -I$KERNELSOURCES/include ../IPC/LPMLib/*.c  ./xxxx_init.c ./init_frame_buffer.c \
    ./init_v4l.c -o $FILESYSTEM_TARGET/sbin/xxxx_init || cleanup 1

Recently, we moved some header files from ../../../LPM/LPMcode to ../../../LPM/share,
both of which are listed with -I in the compile line above.  When the driver tries to
compile the init_frame_buffer.c file, it complains that it cannot find a particular
include file that was moved from LPMcode to share.  Here is the strange part: when
I add -save-temps to the above line, the resulting init_frame_buffer.i file clearly
shows the contents of the missing include file.  If I cut and past the above line in
the script, pre-pend "echo" and remove the trailing "|| cleanup 1" so I can capture
the command line, and then cut & paste that command line into my xterm window, it works
just fine.  If I copy the troublesome include file from share to LPMcode it also works.

I've tried messing with the order of things on the gcc command line to no avail.  How
can I debug this further?  Why is gcc getting confused?  In case it matters, here is
the compiler version, which I am stuck with since it's delivered by our chip vendor:

    sh4-linux-gcc (GCC) 4.2.4 (snapshot) (STMicroelectronics/Linux Base 4.2.4-54)
    Copyright (C) 2007 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And for completeness' sake, here is the actual command line from the echo command
and (truncated) compiler output of the error:

    /opt/STM/STLinux-2.3/devkit/sh4/bin/sh4-linux-gcc -save-temps -O2 \
    -I../../../../Components/Messaging -I../AvRouting/AVRD/Main -I../IPC/common_files \
    -I../OSAbstraction -I../IPC/LPMLib -I../../Drivers/LPM -I../../Drivers/AVRDriver \
    -I../../Drivers/Diagnostics -I../../../LPM/share -I../../../LPM/LPMcode \
    -I/opt/STM/STLinux-2.3/devkit/sources/kernel/havana-linux-sh4/include ../IPC/LPMLib/*.c  \
    ./xxxx_init.c ./init_frame_buffer.c ./init_v4l.c -o /dev/shm/usb_update.10255/filesystem/sbin/xxxx_init

    ./init_frame_buffer.c:27:25: error: ipc_defines.h: No such file or directory
    ./init_frame_buffer.c: In function ‘init_frame_buffer’:

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-08 15:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-06 14:07 Strange gcc #include behavior when compiling multiple source files at once Alfred von Campe
2011-12-06 14:19 ` Jonathan Wakely
2011-12-06 14:39   ` Alfred von Campe
2011-12-08 15:03 ` Alfred von Campe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).