Failing cc -pipe nevertheless generates object file?

Volker Stolz vs at FreeBSD.org
Mon May 3 11:14:29 PDT 2004


A port compiles a program which, if build successfully,
serves as a kind of configuration-option. Therefore it uses a separate
CC and a LD-phase. If it doesn't build, the port
simply uses a different set of options. Additionally, the port checks
if the binary works. Now, if I compile with -pipe,
and since the port links with a library which provides it's own main(),
the following will happen: cc -pipe fails, but creates an object file,
LD will happily provide main() from the library and it looks as though
things worked!

Adapted sample:

work at menelaos [20:03:24]> rm foo
work at menelaos [20:03:27]> cc -pipe -c -O  -g -I/usr/local/include     -DMACHTYPE_ -I src/ -I build/FreeBSD/ -I external/src/    progs/taucs_cilk_test.c  -ofoo
progs/taucs_cilk_test.c:8: cilk.h: No such file or directory
progs/taucs_cilk_test.c:12: syntax error before `int'
progs/taucs_cilk_test.c:17: syntax error before `int'
progs/taucs_cilk_test.c: In function `main':
progs/taucs_cilk_test.c:22: `spawn' undeclared (first use in this function)
progs/taucs_cilk_test.c:22: (Each undeclared identifier is reported only once
progs/taucs_cilk_test.c:22: for each function it appears in.)
progs/taucs_cilk_test.c:22: syntax error before `f'
progs/taucs_cilk_test.c:24: `sync' undeclared (first use in this function)
work at menelaos [20:03:29]> file foo
foo: ELF 32-bit LSB relocatable, Intel 80386, version 1 (FreeBSD), not stripped
work at menelaos [20:03:30]> rm foo
work at menelaos [20:03:35]> cc  -c -O  -g -I/usr/local/include     -DMACHTYPE_ -I src/ -I build/FreeBSD/ -I external/src/    progs/taucs_cilk_test.c  -ofoo
progs/taucs_cilk_test.c:8: cilk.h: No such file or directory
work at menelaos [20:03:40]> file foo
foo: can't stat `foo' (No such file or directory).

Is this expected behaviour? I'm currently working around this by
adding " || rm foo" to the offending invocation so that LD will fail.
-- 
http://www-i2.informatik.rwth-aachen.de/stolz/ *** PGP *** S/MIME
Neu! Ändern Sie den Anfangstag Ihrer Woche


More information about the freebsd-ports mailing list