From owner-freebsd-hackers@FreeBSD.ORG Fri Apr 11 13:33:41 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 695B637B401 for ; Fri, 11 Apr 2003 13:33:41 -0700 (PDT) Received: from freebsd.giovannelli.com (freebsd.giovannelli.com [194.184.65.139]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8A30A43FD7 for ; Fri, 11 Apr 2003 13:33:39 -0700 (PDT) (envelope-from gmarco@giovannelli.it) Received: from usul.giovannelli.it (usul.giovannelli.com [10.254.254.4]) h3BKWA2I021816; Fri, 11 Apr 2003 22:32:11 +0200 (CEST) (envelope-from gmarco@giovannelli.it) Message-Id: <5.2.0.9.2.20030411221904.011c5ec8@194.184.65.4> X-Sender: gmarco@194.184.65.4 (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 5.2.0.9 Date: Fri, 11 Apr 2003 22:35:11 +0200 To: Terry Lambert From: Gianmarco Giovannelli In-Reply-To: <3E96E351.DB4A4AB@mindspring.com> References: <5.2.0.9.2.20030411082040.02604e90@194.184.65.4> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed cc: hackers@freebsd.org Subject: Re: gcc iussue or ... ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Apr 2003 20:33:41 -0000 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