From owner-freebsd-stable@FreeBSD.ORG Thu Aug 25 14:07:38 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2F2A1065687 for ; Thu, 25 Aug 2011 14:07:38 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from qmta12.westchester.pa.mail.comcast.net (qmta12.westchester.pa.mail.comcast.net [76.96.59.227]) by mx1.freebsd.org (Postfix) with ESMTP id 80C1E8FC1A for ; Thu, 25 Aug 2011 14:07:34 +0000 (UTC) Received: from omta06.westchester.pa.mail.comcast.net ([76.96.62.51]) by qmta12.westchester.pa.mail.comcast.net with comcast id QdyZ1h00216LCl05Ce7bQ9; Thu, 25 Aug 2011 14:07:35 +0000 Received: from koitsu.dyndns.org ([67.180.84.87]) by omta06.westchester.pa.mail.comcast.net with comcast id Qe7Z1h01i1t3BNj3Se7aUN; Thu, 25 Aug 2011 14:07:35 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id 2B512102C36; Thu, 25 Aug 2011 07:07:32 -0700 (PDT) Date: Thu, 25 Aug 2011 07:07:32 -0700 From: Jeremy Chadwick To: noel beck Message-ID: <20110825140732.GA59487@icarus.home.lan> References: <1314278898818-4734497.post@n5.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1314278898818-4734497.post@n5.nabble.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-stable@freebsd.org Subject: Re: FreeBSD 8.2r amd 64 problem when compiling 32bit applications X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Aug 2011 14:07:39 -0000 On Thu, Aug 25, 2011 at 06:28:18AM -0700, noel beck wrote: > I installed FreeBSD 8.2 release on a 64-bit machine (amd64) and it has gcc > 4.2.1 built in. The library directories are lib, lib32 and lib64. When I > compiled for 64-bit the compilation was successful. > > However, the problem is when I am compiling for 32-bit on this 64-bit > machine. We are getting an error stating that libstdc++.so.6 is missing. > Other forums state that if you install compact6x or compact7x, the missing > libraries will be installed. I installed these but it did not solve my > problem. > > The following is the example of when compiling in 64-bit: > [gsaid@Bruno ~]$ ls > MyDocuments hello.c > [gsaid@Bruno ~]$ gcc -o hello hello.c > [gsaid@Bruno ~]$ ls > MyDocuments hello hello.c > [gsaid@Bruno ~]$ file hello > hello: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically > linked (uses shared libs), for FreeBSD 8.2, not stripped > [gsaid@Bruno ~]$ ./hello > Hello, World! > > The following is the example of the error when compiling in 32-bit on a > 64-bit machine: > > [gsaid@Bruno ~]$ gcc -m32 -o hello hello.c > /usr/bin/ld: skipping incompatible /usr/lib/libgcc.a when searching for > -lgcc > /usr/bin/ld: skipping incompatible /usr/lib/libgcc.a when searching for > -lgcc > /usr/bin/ld: cannot find -lgcc > > This is my Hello World script: > > [gsaid@Bruno ~]$ cat hello.c > #include > > int main(int argc, char **argv) > { > printf("Hello, World!\n"); > return 0; > } > > I have also tried adding "WITH_LIB32=yes" to /etc/make.conf and compiled and > installed the kernel again. > > When I locate for libgcc.a to see if there is a one for 32-bit, only one is > found and it is of 64-bit > > [gsaid@Bruno /]$ locate libgcc.a > /usr/lib/libgcc.a > [gsaid@Bruno /]$ nm /usr/lib/libgcc.a > > __gcc_bcmp.o: > 0000000000000000 T __gcc_bcmp Please see this thread from March: http://lists.freebsd.org/pipermail/freebsd-stable/2011-March/thread.html#61846 Though I believe you already have. Why do I say that? Because you started a thread a couple days ago which was actually a *reply* to the aforementioned thread in March (and all you did was change the Subject line). Here's how I know that: 1186 03/09 15:15 Thomas David Rivers (1.0K) bin/139146 still not right in FreeBSD 8.2 (-m32 on amd64)? 1187 03/09 12:52 Josh Carroll (0.8K) |-> 1188 03/09 22:44 Matthias Andree (1.0K) | `-> 1189 03/09 14:55 Mark Linimon (0.5K) |-> 1190 03/09 16:08 Thomas David Rivers (0.4K) | `-> 1191 03/15 00:16 Dimitry Andric (1.1K) |-> 1192 08/23 00:26 noel beck (0.7K) `->-m32 on freeBSD 8.2r amd64 1193 08/23 14:46 Edho Arief (0.6K) `-> 1194 08/24 13:11 Michael Hoffmann (1.4K) `-> 1195 08/24 13:57 Tom Evans (1.1K) `-> 1196 s 08/24 16:01 Kostik Belousov (1.6K) `-> Your mail on 08/23 has these lines in it, which act as validation that you replied to an earlier thread (from March) and tried to start your own: >> In-Reply-To: <201103092015.p29KFd0U077849@dave.dignus.com> >> References: <201103092015.p29KFd0U077849@dave.dignus.com> Anyway, did you read any of the replies from Edho, Michael, Tom, and Kostik? They all provide insights and answers to your question. Next: there is no WITH_LIB32. There is only WITHOUT_LIB32. Furthermore, that setting goes in /etc/src.conf not /etc/make.conf. Yes there is a difference (you need to familiarise yourself with 8.x and later; take the time. :-) ). man src.conf. Next, yet related: even if there was a WITH_LIB32, rebuilding the **kernel** would not solve anything. You would need to build world. But again, there is no WITH_LIB32. If you build world on amd64 it will, by default, attempt to build 32-bit versions of libraries so that you can compile i386 binaries on amd64. The kernel shims for 32-bit support on amd64 is a kernel option in your kernel config called COMPAT_FREEBSD32. This would allow the kernel to support 32-bit applications; it doesn't have anything to do with userland libraries (32-bit libc, etc.). -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, US | | Making life hard for others since 1977. PGP 4BD6C0CB |