[OT?] Web NG archives updates (FreeBSD)

Anders F Björklund afb at algonet.se
Tue Apr 28 01:15:27 PDT 2009


Walter Bright wrote:

>>> Doing it once a day means getting the archiving program on the 
>>> server, which is FreeBSD64. Unfortunately, that platform isn't 
>>> supported by D yet!
>>
>> FreeBSD can't run 32-bit binaries on 64-bit systems?
> 
> I tried it, but there's some missing library problem. The FreeBSD 
> developers make it difficult to develop/run 32 bits on 64, and I wasn't 
> up to spending the effort getting past that.

The missing libraries are easy enough to install:

sysinstall -> Configure -> Distributions -> lib32
               "32-bit runtime compatibility libraries"

But the linker seems confused about the -m32 flag:

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching 
for -lpthread

Fails even when giving -L-L/usr/lib32 explicitly:

/usr/bin/ld: warning: i386:x86-64 architecture of input file 
`/usr/lib/crt1.o' is incompatible with i386 output

Looks a lot like these old bugs, maybe still around:

http://www.freebsd.org/cgi/query-pr.cgi?pr=76224
http://www.freebsd.org/cgi/query-pr.cgi?pr=112215

So it (cross-compilation) is not supported it seems,
and one needs to build on a "real" i386 FreeBSD host.
But it (the binary) should run just fine on amd64 too,
assuming that compatibility libraries are installed ?


If one jumps through the hoops and make gcc use
"/libexec/ld-elf32.so.1" instead of ld-elf.so.1
and "/usr/lib32" instead of /usr/lib, it runs...

hello: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), for 
FreeBSD 7.0 (700055), dynamically linked (uses shared libs), 
FreeBSD-style, not stripped

That would be in the last linker "expansion" of:

./freebsd/bin/dmd ./samples/d/hello.d -v

gcc hello.o -o hello -m32 -Xlinker -L./freebsd/bin/../lib -lphobos 
-lpthread -lm -v

  /usr/bin/ld --eh-frame-hdr -m elf_i386_fbsd -V -dynamic-linker 
/libexec/ld-elf.so.1 -o hello /usr/lib/crt1.o /usr/lib/crti.o 
/usr/lib/crtbegin.o -L/usr/lib -L/usr/lib hello.o -L./freebsd/bin/../lib 
-lphobos -lpthread -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc 
-lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o

The matching binary from GDC 0.24 would instead be:

hello: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), for 
FreeBSD 7.0 (700055), dynamically linked (uses shared libs), 
FreeBSD-style, not stripped

And yes, it seems that I need to upgrade my BSD :-)

--anders



More information about the Digitalmars-d mailing list