Possible build problem
Mart Kelder <[email protected]> Tue, 16 Dec 2008 11:08:41 +0100
| Newsgroups | gmane.games.torcs.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all, I discovered a problem in the current release candidate with the build system for Linux. Steps to reproduce: We want to build a robot with the name foo with exactly one source file: foo.cpp. Make a directory src/drivers/foo and src/drivers/foo/compile. Put foo.cpp in src/drivers/foo and the Makefile which should compile it in src/drivers/foo/compile. The SOURCES variable in that Makefile is thus ../foo.cpp. Go to src/drivers/foo/compile and try to compile it. You see the robot is compiled correctly. Expected result: The robot also is linked correctly Actual result: A linking error occures: can't find file ../foo.o Problem: foo.cpp is compiled, but the object is in src/drivers/foo/compile/foo.o, and during linking it expects it to be in src/drivers/foo/foo.o. Possible solution: Make sure gcc puts the object in the right place by adding a -o $@ option to gcc. A patch doing this is attached. Actual occurence: Although this problem looks very theoretical, it can occur if the robot developer would use the same code for more then one robot. It then uses src/drivers/foo to place the code and src/drivers/foo/foo_trb1 and src/drivers/foo/foo_trb2 to produce the robots. This way, it is not neccesairy to compile everything twice: only linking have to be done twice. Regards, Mart ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Torcs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/torcs-devel
make_default.diff
(text/x-diff, 660 B)
Index: Make-default.mk
===================================================================
RCS file: /cvsroot/torcs/torcs/torcs/Make-default.mk,v
retrieving revision 1.33
diff -u -r1.33 Make-default.mk
--- Make-default.mk 7 Sep 2003 08:13:56 -0000 1.33
+++ Make-default.mk 16 Dec 2008 10:00:18 -0000
@@ -237,12 +237,12 @@
.SUFFIXES: .cpp
.cpp.o:
- ${CXX} $(INCFLAGS) $(CXXFLAGS) $(COMPILFLAGS) -c $<
+ ${CXX} $(INCFLAGS) $(CXXFLAGS) $(COMPILFLAGS) -c $< -o $@
.SUFFIXES: .c
.c.o:
- ${CXX} $(INCFLAGS) $(CXXFLAGS) $(COMPILFLAGS) -c $<
+ ${CXX} $(INCFLAGS) $(CXXFLAGS) $(COMPILFLAGS) -c $< -o $@
# ${CC} $(INCFLAGS) $(CFLAGS) $(COMPILFLAGS) -c $<