Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Aug 2011 06:28:18 -0700 (PDT)
From:      noel beck <nbeck@hobsoft.com.mt>
To:        freebsd-stable@freebsd.org
Subject:   FreeBSD 8.2r amd 64  problem when compiling 32bit applications
Message-ID:  <1314278898818-4734497.post@n5.nabble.com>

next in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1314278898818-4734497.post>