Date: Fri, 11 Apr 2003 22:35:11 +0200 From: Gianmarco Giovannelli <gmarco@giovannelli.it> To: Terry Lambert <tlambert2@mindspring.com> Cc: hackers@freebsd.org Subject: Re: gcc iussue or ... ? Message-ID: <5.2.0.9.2.20030411221904.011c5ec8@194.184.65.4> In-Reply-To: <3E96E351.DB4A4AB@mindspring.com> References: <5.2.0.9.2.20030411082040.02604e90@194.184.65.4>
next in thread | previous in thread | raw e-mail | index | archive | help
At 11/04/2003, you wrote: >Gianmarco Giovannelli wrote: > > The problem is very simple. > > I mantain a unix/linux port of a UO emulator which works really fine > > natively under FreeBSD. > > > > The problem is that if I compile it under FreeBSD it is a binary of 19M, > > while on linux (debian 3.0), same Makefile, is only 2MB. FreeBSD 5.0 and > > OpenBSD 3.1 produce the (about) 19M file. > > Mingw compiler under windows act like Linux. Hi Terry, first of all thanks for your kind reply. >There are three possibilities. > >The first, and least likely, since the same compiler and linker >is used on both FreeBSD and Linux, is that the uninitialized BSS >handling for some large static/global declarations is being handled >differently between the platforms. Ok... I think it could not be related to the problem ... the same gcc on debian 3.0 and FreeBSD 4.8 (2.95.x) and the same on mingw and FreeBSD 5.0 (3.2.x) produce differents size code (linux vs 4.8 and mingw vs 5.0). >The second, which is more likely, is that there are some large >static/global declaractions that get initialized on FreeBSD, but >not on Linux. The way to find this is to search for platform >"#ifdef"'s in the code. There are none of them ... I have tried to search but there aren't or afaik I was not able to find them :-) >The third, and most likely, is that you are linking with dynamic >libraries on Linux, but static libraries on FreeBSD; in other >words, you have a FreeBSD Makefile error. To determine if this >is the case, you should run "ldd" against the binaries on both >platforms. The paths to the libraries are unimportant; the number, >and which libraries you *don't* see on FreeBSD, are the important >parts. freebsd:> ldd lonewolf libstdc++.so.3 => /usr/lib/libstdc++.so.3 (0x282be000) libm.so.2 => /usr/lib/libm.so.2 (0x28303000) libc.so.4 => /usr/lib/libc.so.4 (0x2831e000) linux:>ldd lonewolf libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0x40016000) libm.so.6 => /lib/libm.so.6 (0x4005f000) libc.so.6 => /lib/libc.so.6 (0x40081000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) Uhm... I am not able to interpret this data. Are they ok ? FreeBSD is missing one lib, the last one... The problem of Makefile is not related IMHO, infact the Makefile.unix is the same for Linux and FreeBSD ... the most relevant part of it are: [...] CC = gcc CXX = g++ CFLAGS = -pipe -Wall -W -O2 CXXFLAGS= -funsigned-char -O2 INCPATH = LINK = g++ LFLAGS = LIBS = $(SUBLIBS) MOC = $(QTDIR)/bin/moc UIC = $(QTDIR)/bin/uic TAR = tar -cf GZIP = gzip -9f [...] OBJMOC = DIST = TARGET = lonewolf INTERFACE_DECL_PATH = . ####### Implicit rules .SUFFIXES: .cpp .cxx .cc .C .c .cpp.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .cxx.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .cc.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .C.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .c.o: $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< ####### Build rules all: $(TARGET) $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) moc: $(SRCMOC) tmake: Makefile Makefile: lonewolf.pro tmake lonewolf.pro -o Makefile dist: $(TAR) Lonewolf Emu.tar Lonewolf Emu.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) $(GZIP) Lonewolf Emu.tar clean: -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) -rm -f *~ core ####### Sub-libraries ###### Combined headers ####### Compile [...] So they should act in the same way ... The thing is so strange ... Best Regards, Gianmarco Giovannelli , "Unix expert since yesterday" http://www.gufi.org/~gmarco
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.2.0.9.2.20030411221904.011c5ec8>