www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - build 32-bit library on 64-bit OS

reply DFTW <jckj33 gmail.com> writes:
So I need to build a 32-bit version of a library on 64-bit 
system. I got some errors, which I get rid of after installing 
the gcc 32-bit tools (and gcc -m32 ran fine) but I still get 
errors about libraries not compatible.

the command:
dub --arch=x86

yield erros such:

/usr/bin/ld: skiping 
//usr/lib/x86_64-linux-gnu/libphobos2-ldc-shared.so incompatible 
to -lphobos2-ldc-shared
/usr/bin/ld: couldn't find -lphobos2-ldc-shared
//....
collect2: error: ld returned 1 exit status
Error: /usr/bin/gcc failed with status: 1
/usr/bin/ldc2 failed with exit code 1.

How do I fix this?
Mar 19 2019
parent reply kinke <noone nowhere.com> writes:
On Tuesday, 19 March 2019 at 17:23:21 UTC, DFTW wrote:
 /usr/bin/ld: skiping 
 //usr/lib/x86_64-linux-gnu/libphobos2-ldc-shared.so 
 incompatible to -lphobos2-ldc-shared
 /usr/bin/ld: couldn't find -lphobos2-ldc-shared
If possible, use an official package (https://github.com/ldc-developers/ldc/releases). What distro are you using? The packager apparently didn't create a multilib package.
Mar 19 2019
parent reply DFTW <jckj33 gmail.com> writes:
On Tuesday, 19 March 2019 at 20:31:46 UTC, kinke wrote:
 On Tuesday, 19 March 2019 at 17:23:21 UTC, DFTW wrote:
 /usr/bin/ld: skiping 
 //usr/lib/x86_64-linux-gnu/libphobos2-ldc-shared.so 
 incompatible to -lphobos2-ldc-shared
 /usr/bin/ld: couldn't find -lphobos2-ldc-shared
If possible, use an official package (https://github.com/ldc-developers/ldc/releases). What distro are you using? The packager apparently didn't create a multilib package.
What package did you mean? that libphobos2 on the error messages from the ld? I'm using dmd/dub on Ubuntu 18. I'll give a try to ldc, does it still is binary compatible with C?
Mar 19 2019
parent reply kinke <noone nowhere.com> writes:
On Tuesday, 19 March 2019 at 20:56:47 UTC, DFTW wrote:
 What package did you mean? that libphobos2 on the error 
 messages from the ld?
 I'm using dmd/dub on Ubuntu 18.
libphobos2-ldc-shared.so is definitely from LDC.
 I'll give a try to ldc, does it still is binary compatible with 
 C?
It's better suited for C(++) interop than DMD (ABI issues).
Mar 19 2019
parent DFTW <jckj33 gmail.com> writes:
On Tuesday, 19 March 2019 at 21:20:24 UTC, kinke wrote:
 On Tuesday, 19 March 2019 at 20:56:47 UTC, DFTW wrote:
 What package did you mean? that libphobos2 on the error 
 messages from the ld?
 I'm using dmd/dub on Ubuntu 18.
libphobos2-ldc-shared.so is definitely from LDC.
I hadn't noticied it was a ldc's library actually. I didn't set any compiler explicitly with dub so I assumed it was usind dmd and its libraries.
 I'll give a try to ldc, does it still is binary compatible 
 with C?
It's better suited for C(++) interop than DMD (ABI issues).
Only with ldc (downloaed from repo) I managed to build a 32-bit version successfully. Thanks!
Mar 20 2019