noel beck
2011-Aug-25 13:28 UTC
FreeBSD 8.2r amd 64 problem when compiling 32bit applications
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 <stdio.h> 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 -- View this message in context: http://freebsd.1045724.n5.nabble.com/FreeBSD-8-2r-amd-64-problem-when-compiling-32bit-applications-tp4734497p4734497.html Sent from the freebsd-stable mailing list archive at Nabble.com.
Ivan Voras
2011-Aug-25 13:43 UTC
FreeBSD 8.2r amd 64 problem when compiling 32bit applications
On 25/08/2011 15:28, noel beck wrote:> 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.cI don't think "-m32" is supported at all.
Tom Evans
2011-Aug-25 13:55 UTC
FreeBSD 8.2r amd 64 problem when compiling 32bit applications
On Thu, Aug 25, 2011 at 2:28 PM, noel beck <nbeck@hobsoft.com.mt> 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.Didn't you ask the precise same question yesterday? My reply to that question, and Kostik's explanation of why even that will not work properly are relevant here. Cheers Tom
Jeremy Chadwick
2011-Aug-25 14:07 UTC
FreeBSD 8.2r amd 64 problem when compiling 32bit applications
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 <stdio.h> > > 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_bcmpPlease 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 |