Thread overview
build 32-bit library on 64-bit OS
Mar 19, 2019
DFTW
Mar 19, 2019
kinke
Mar 19, 2019
DFTW
Mar 19, 2019
kinke
Mar 20, 2019
DFTW
March 19, 2019
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?

March 19, 2019
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.
March 19, 2019
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?
March 19, 2019
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).
March 20, 2019
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!