Re: gcc -m32 option on amd64.

2007-08-10 Thread Sharad Chandra
On Friday 27 Jul 2007 3:50 pm, Peter Jeremy wrote:
> On 2007-Jul-27 15:13:48 +0530, Sharad Chandra <[EMAIL PROTECTED]> wrote:
> >I am trying gcc -m32 on freebsd 6.1 amd64 env, but it does not seems to be
> >working. i also installed /usr/port/lang/linux-libgcc/ but did not help
> >what i did is=>
> >echo "main () {}" > t.c; gcc -m32 t.c
> >/usr/bin/ld: skipping
> >incompatible
> > /usr/local/lib/gcc/x86_64-portbld-freebsd6.1/4.2.0/gcc/x86_64-portbld-fre
> >ebsd6.1/4.2.0/libgcc.a when searching for -lgcc
> >/usr/bin/ld: cannot find -lgcc
> >collect2: ld returned 1 exit status
> >
> >how can we make this working?
>
> You are using gcc 4.2 from ports.  I suspect this only includes the
> 64-bit libraries.  gcc in the base system includes both 32-bit and
> 64-bit libraries by default but it still suffers the same problem.

Yes, gcc looks for library in /usr/lib, whereas libraries for 32 is 
in /usr/lib32, and there is a switch -B in gcc which tells from where to pick 
the library, I did 
gcc -m32 -B /usr/lib32 t.c
and this is working now.

> I had a go at fixing the problem in amd64/112215 but this has other
> problems and needs more work.  Note that non-trivial code will break
> because  points at amd64 headers whilst the -m32
> compiler needs i386 headers in many cases.  There's a non-trivial
> amount of work needed to actually get cross-building working.  I
> suggest you look throught the FreeBSD-amd64 archives.

Thanks
Sharad Chandra
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: gcc -m32 option on amd64.

2007-07-30 Thread Giorgos Keramidas
On 2007-07-30 09:24, Tom Evans <[EMAIL PROTECTED]> wrote:
>On Sat, 2007-07-28 at 17:55 +1000, Peter Jeremy wrote:
>> On 2007-Jul-27 17:32:35 +0100, Tom Evans <[EMAIL PROTECTED]> wrote:
>> >gcc on amd64 is capable of generating i386 code, but ld on amd64 is
>> >incapable of linking i386 code together without serious amounts of work.
>> 
>> Can you elaborate on what you mean by "incapable of linking i386 code"?
>> The stock ld can definitely link i386 code:
>> turion% ld -V
>> GNU ld version 2.15 [FreeBSD] 2004-05-23
>>   Supported emulations:
>>elf_i386_fbsd
>>elf_x86_64_fbsd
>> turion% 
>> 
>> There is a problem that the 32-bit pathnames on FreeBSD/amd64 are
>> different to the 32-bit pathnames on FreeBSD/i386 (ie an i386
>> executable built on amd64 will point to /libexec/ld-elf32.so.1,
>> rather than /libexec/ld-elf.so.1) so the result won't execute on a
>> FreeBSD/i386 box - but I don't see that as a problem with ld, rather
>> the configuration.
> 
> Sure. By 'incapable of linking i386 code' I mean that the default
> toolchain of gcc invoking ld to assemble libraries and object files
> into executables is incapable of doing so when compiling i386 code. I
> say without serious amounts of work because, as you point out, it is
> possible to do.

The default toolchain can link 32-bit code with -B /usr/lib32 path
options.  This should work fine for the base system binaries.

I expect ports compiled without -B will not cooperate very 'smoothly'
with 32-bit port builds, but that's a different thing from being
completely incapable, I guess.

> Any other english sentences you need explaining?

That's a bit too harsh.  The FreeBSD people are known for their
civilized manners, so can we tone things down a bit everyone? :-)

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: gcc -m32 option on amd64.

2007-07-30 Thread Tom Evans
On Sat, 2007-07-28 at 17:55 +1000, Peter Jeremy wrote:
> On 2007-Jul-27 17:32:35 +0100, Tom Evans <[EMAIL PROTECTED]> wrote:
> >gcc on amd64 is capable of generating i386 code, but ld on amd64 is
> >incapable of linking i386 code together without serious amounts of work.
> 
> Can you elaborate on what you mean by "incapable of linking i386 code"?
> The stock ld can definitely link i386 code:
> turion% ld -V
> GNU ld version 2.15 [FreeBSD] 2004-05-23
>   Supported emulations:
>elf_i386_fbsd
>elf_x86_64_fbsd
> turion% 
> 
> There is a problem that the 32-bit pathnames on FreeBSD/amd64 are
> different to the 32-bit pathnames on FreeBSD/i386 (ie an i386
> executable built on amd64 will point to /libexec/ld-elf32.so.1, rather
> than /libexec/ld-elf.so.1) so the result won't execute on a
> FreeBSD/i386 box - but I don't see that as a problem with ld, rather
> the configuration.
> 

Sure. By 'incapable of linking i386 code' I mean that the default
toolchain of gcc invoking ld to assemble libraries and object files into
executables is incapable of doing so when compiling i386 code. I say
without serious amounts of work because, as you point out, it is
possible to do.

Any other english sentences you need explaining?


signature.asc
Description: This is a digitally signed message part


Re: gcc -m32 option on amd64.

2007-07-28 Thread Peter Jeremy
On 2007-Jul-27 17:32:35 +0100, Tom Evans <[EMAIL PROTECTED]> wrote:
>gcc on amd64 is capable of generating i386 code, but ld on amd64 is
>incapable of linking i386 code together without serious amounts of work.

Can you elaborate on what you mean by "incapable of linking i386 code"?
The stock ld can definitely link i386 code:
turion% ld -V
GNU ld version 2.15 [FreeBSD] 2004-05-23
  Supported emulations:
   elf_i386_fbsd
   elf_x86_64_fbsd
turion% 

There is a problem that the 32-bit pathnames on FreeBSD/amd64 are
different to the 32-bit pathnames on FreeBSD/i386 (ie an i386
executable built on amd64 will point to /libexec/ld-elf32.so.1, rather
than /libexec/ld-elf.so.1) so the result won't execute on a
FreeBSD/i386 box - but I don't see that as a problem with ld, rather
the configuration.

-- 
Peter Jeremy


pgplaH2VDcPfe.pgp
Description: PGP signature


Re: gcc -m32 option on amd64.

2007-07-27 Thread Tom Evans
On Fri, 2007-07-27 at 20:20 +1000, Peter Jeremy wrote:
> On 2007-Jul-27 15:13:48 +0530, Sharad Chandra <[EMAIL PROTECTED]> wrote:
> >I am trying gcc -m32 on freebsd 6.1 amd64 env, but it does not seems to be 
> >working. i also installed /usr/port/lang/linux-libgcc/ but did not help
> >what i did is=>
> >echo "main () {}" > t.c; gcc -m32 t.c
> >/usr/bin/ld: skipping 
> >incompatible 
> >/usr/local/lib/gcc/x86_64-portbld-freebsd6.1/4.2.0/gcc/x86_64-portbld-freebsd6.1/4.2.0/libgcc.a
> > 
> >when searching for -lgcc
> >/usr/bin/ld: cannot find -lgcc
> >collect2: ld returned 1 exit status
> >
> >how can we make this working?
> 
> You are using gcc 4.2 from ports.  I suspect this only includes the
> 64-bit libraries.  gcc in the base system includes both 32-bit and
> 64-bit libraries by default but it still suffers the same problem.
> 
> I had a go at fixing the problem in amd64/112215 but this has other
> problems and needs more work.  Note that non-trivial code will break
> because  points at amd64 headers whilst the -m32
> compiler needs i386 headers in many cases.  There's a non-trivial
> amount of work needed to actually get cross-building working.  I
> suggest you look throught the FreeBSD-amd64 archives.
> 

gcc on amd64 is capable of generating i386 code, but ld on amd64 is
incapable of linking i386 code together without serious amounts of work.

At work, we use a large number of amd64 boxes as compile farm servers
for i386 development, using distcc and a wrapper to invoke gcc correctly
on the external boxes.

To verify that it works (it compiles to i386 code), do this:
$ uname -a; echo "main() { } " > t.c ; gcc -c -m32 -o t.o t.c; file t.o
FreeBSD chef.mintel.co.uk 6.1-STABLE FreeBSD 6.1-STABLE #1: Fri Jun 23
12:48:28 BST 2006
[EMAIL PROTECTED]:/usr/obj/usr/src/sys/CHEF  amd64
t.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (FreeBSD), not
stripped



signature.asc
Description: This is a digitally signed message part


Re: gcc -m32 option on amd64.

2007-07-27 Thread Peter Jeremy
On 2007-Jul-27 15:13:48 +0530, Sharad Chandra <[EMAIL PROTECTED]> wrote:
>I am trying gcc -m32 on freebsd 6.1 amd64 env, but it does not seems to be 
>working. i also installed /usr/port/lang/linux-libgcc/ but did not help
>what i did is=>
>echo "main () {}" > t.c; gcc -m32 t.c
>/usr/bin/ld: skipping 
>incompatible 
>/usr/local/lib/gcc/x86_64-portbld-freebsd6.1/4.2.0/gcc/x86_64-portbld-freebsd6.1/4.2.0/libgcc.a
> 
>when searching for -lgcc
>/usr/bin/ld: cannot find -lgcc
>collect2: ld returned 1 exit status
>
>how can we make this working?

You are using gcc 4.2 from ports.  I suspect this only includes the
64-bit libraries.  gcc in the base system includes both 32-bit and
64-bit libraries by default but it still suffers the same problem.

I had a go at fixing the problem in amd64/112215 but this has other
problems and needs more work.  Note that non-trivial code will break
because  points at amd64 headers whilst the -m32
compiler needs i386 headers in many cases.  There's a non-trivial
amount of work needed to actually get cross-building working.  I
suggest you look throught the FreeBSD-amd64 archives.

-- 
Peter Jeremy


pgp0amIJul1Bq.pgp
Description: PGP signature


gcc -m32 option on amd64.

2007-07-27 Thread Sharad Chandra
Hi guys,

I am trying gcc -m32 on freebsd 6.1 amd64 env, but it does not seems to be 
working. i also installed /usr/port/lang/linux-libgcc/ but did not help
what i did is=>
echo "main () {}" > t.c; gcc -m32 t.c
/usr/bin/ld: skipping 
incompatible 
/usr/local/lib/gcc/x86_64-portbld-freebsd6.1/4.2.0/gcc/x86_64-portbld-freebsd6.1/4.2.0/libgcc.a
 
when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
collect2: ld returned 1 exit status

how can we make this working?

Thanks
Sharad Chandra
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"