February 17, 2010 Re: DMD on x86_64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lutger | On 17/02/10 11:06, Lutger wrote:
> If you manage to find the proper 32 bit libraries, there is a configuration
> file for ld where you can specify the search paths, should be:
> /etc/ld.so.conf
>
> The 64-bit distro's I have used fail to add the 32-bit lib paths to this
> file, even if you install the right packages.
>
>
The paths to my 32bit libs seem to be in there, thanks :)
|
February 17, 2010 Re: DMD on x86_64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | On 17/02/10 08:48, BCS wrote:
> Hello Brad,
>
>> The other thing you could try is to take dmd out of the loop. Can you
>> build a 32 bit c/c++ app with gcc/g++ directly? If you can't get that
>> to work, it's unlikely that dmd will we successful either, given that
>> it relies on gcc to invoke the linker, picking up all the right c
>> library pieces.
>
>
> if all else fails, you could use "dmd -c" and invoke the linker directly.
>
I tried that, can't manage to get it to link though, even after changing every library and file mentioned to the 32 bit versions and passing in the right -m :s
|
February 17, 2010 Re: DMD on x86_64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brad Roberts | On 17/02/10 06:20, Brad Roberts wrote:
> On 2/16/2010 10:05 PM, Jesse Phillips wrote:
>> Robert Clipsham wrote:
>>
>>> On 16/02/10 15:20, Jesse Phillips wrote:
>>>> Robert Clipsham wrote:
>>>>
>>>>> I don't use ubuntu, so those instructions don't apply to me.
>>>>
>>>> I don't either, but the instructions still apply to me. What distro are
>>>> you using? If you figure it out, write up some instructions for it.
>>>>
>>>
>>> I'm using Arch Linux. I've found a gcc-multilib package in AUR (
>>> http://aur.archlinux.org/packages.php?ID=28545 ), it's out of date and
>>> doesn't build for me though, it seems to require the de_DE locale too
>>> for some unknown reason. I'm hoping when this package is updated it'll
>>> do what I need, I'm not holding my breath though.
>>
>> Oh, yeah Arch dropped most efforts to support 32bit didn't they. This
>> probably won't help but maybe trying
>>
>> dmd test.d -L-L/opt/lib32/lib -L-melf_i386
>>
>> I'd hope that would at least stop it complaining about libpthread. (but
>> so should have your gcc -m32
>
> The other thing you could try is to take dmd out of the loop. Can you build a
> 32 bit c/c++ app with gcc/g++ directly? If you can't get that to work, it's
> unlikely that dmd will we successful either, given that it relies on gcc to
> invoke the linker, picking up all the right c library pieces.
I haven't tried that yet, I'll give it a shot and see how it goes, thanks :) I suspect that won't work either, at least that gives me some insight into where I'm going wrong though.
|
February 17, 2010 Re: DMD on x86_64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | On 17/02/10 06:05, Jesse Phillips wrote: > Oh, yeah Arch dropped most efforts to support 32bit didn't they. This I'm pretty sure they didn't... maybe they did on x86_64, I don't know. > probably won't help but maybe trying > > dmd test.d -L-L/opt/lib32/lib -L-melf_i386 Already tried this, no luck :( > > I'd hope that would at least stop it complaining about libpthread. (but > so should have your gcc -m32 No luck unfortunately with either method :s |
February 17, 2010 Re: DMD on x86_64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brad Roberts | On 17/02/10 06:20, Brad Roberts wrote: > On 2/16/2010 10:05 PM, Jesse Phillips wrote: >> Robert Clipsham wrote: >> >>> On 16/02/10 15:20, Jesse Phillips wrote: >>>> Robert Clipsham wrote: >>>> >>>>> I don't use ubuntu, so those instructions don't apply to me. >>>> >>>> I don't either, but the instructions still apply to me. What distro are >>>> you using? If you figure it out, write up some instructions for it. >>>> >>> >>> I'm using Arch Linux. I've found a gcc-multilib package in AUR ( >>> http://aur.archlinux.org/packages.php?ID=28545 ), it's out of date and >>> doesn't build for me though, it seems to require the de_DE locale too >>> for some unknown reason. I'm hoping when this package is updated it'll >>> do what I need, I'm not holding my breath though. >> >> Oh, yeah Arch dropped most efforts to support 32bit didn't they. This >> probably won't help but maybe trying >> >> dmd test.d -L-L/opt/lib32/lib -L-melf_i386 >> >> I'd hope that would at least stop it complaining about libpthread. (but >> so should have your gcc -m32 > > The other thing you could try is to take dmd out of the loop. Can you build a > 32 bit c/c++ app with gcc/g++ directly? If you can't get that to work, it's > unlikely that dmd will we successful either, given that it relies on gcc to > invoke the linker, picking up all the right c library pieces. # Compile normally % gcc hello.c % ./a.out Hello World! # Compile as 32 bit % gcc -m32 hello.c In file included from /usr/include/features.h:371, from /usr/include/stdio.h:28, from hello.c:1: /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory # Stop #including and extern printf directly % gcc -m32 hello.c /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.3/libgcc.a when searching for -lgcc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.3/libgcc.a when searching for -lgcc /usr/bin/ld: cannot find -lgcc collect2: ld returned 1 exit status # Add some -L's % gcc -m32 hello.c -L/opt/lib32/lib -L/opt/lib32/usr/lib /usr/bin/ld: skipping incompatible /lib/libc.so.6 when searching for /lib/libc.so.6 /usr/bin/ld: cannot find /lib/libc.so.6 collect2: ld returned 1 exit status # As a side note, libc.so.6 can be found in /opt/lib32/lib. # I don't feel like symlinking that to make it work as it'll # break 64 bit builds :) Seems the path is hard coded there, # there might be an option to fix that, I don't know it though |
February 17, 2010 Re: DMD on x86_64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert Clipsham | Robert Clipsham wrote:
> I've been wanting to try D2 properly for a while now, but as I use linux x86-64 I've had to resort to using a virtual machine, which is really off putting when I just want to play around with it. I've read multiple threads about getting dmd working with a multilib system, but I still can't get it working, here's what I've tried:
>
> test.d:
> import std.stdio;
>
> void main()
> {
> writeln( "Hello World!" );
> }
>
> % dmd -v test.d
> -- snip --
> gcc test.o -o test -m32 -Xlinker -L./../lib -lphobos2 -lpthread -lm
> /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.3/../../../libpthread.so when searching for -lpthread
> /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.3/../../../libpthread.a when searching for -lpthread
> /usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread
> /usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread
> /usr/bin/ld: cannot find -lpthread
> collect2: ld returned 1 exit status
> --- errorlevel 1
>
> I have a 32 bit version of libpthread in /opt/lib32/lib, so I then tried:
>
> % dmd test.d -L-L/opt/lib32/lib
> /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.3/../../../libpthread.so when searching for -lpthread
> /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.3/../../../libpthread.a when searching for -lpthread
> /usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread
> /usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread
> /usr/bin/ld: cannot find -lpthread
> collect2: ld returned 1 exit status
> --- errorlevel 1
>
> ld still seems to be trying to use the 64 bit version. Trying to link manually with gcc (some options tweaked):
>
> % gcc test.o -o test -m32 -Xlinker -L./../lib -L/opt/lib32/lib -L/opt/lib32/usr/lib -lphobos2 -lpthread -lm
> /usr/bin/ld: skipping incompatible /lib/libpthread.so.0 when searching for /lib/libpthread.so.0
> /usr/bin/ld: cannot find /lib/libpthread.so.0
> collect2: ld returned 1 exit status
>
> This seemed to get less errors than before. When I specified the path to libpthread manually it started complaining about libgcc. Using -v with the above command I found the linking command, then adapted that and tried manually again, but was left with the error:
>
> /usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000008048c90
>
> When editing the linking command I had to remove a selection of gcc libraries that I don't have 32 bit versions of, which could be the issue, however according to nm none of the other .o's or .a's that are meant to get linked contain _start. Does anyone have any idea how I can get dmd working with a multi lib x86-64 system? I'm using Arch Linux, if you could point me in the right direction to get the missing libraries or whatever's needed to get dmd working let me know, thanks.
>
> Robert
Try typing:
export LD_LIBRARY_PATH="/opt/lib32"
before compiling.
-Lars
|
February 17, 2010 Re: DMD on x86_64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars T. Kyllingstad | On 17/02/10 16:58, Lars T. Kyllingstad wrote:
> Try typing:
>
> export LD_LIBRARY_PATH="/opt/lib32"
>
> before compiling.
>
> -Lars
No luck unfortunately, I get all the same errors as when I use -L, (I believe -L is checked first anyway, not sure though).
|
February 17, 2010 Re: DMD on x86_64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert Clipsham Attachments:
| Don't forget that gcc adds a couple of system libraries (like
libgcc) to the linker command. You need to give the right path for
those too (you might want to try with --sysroot, or use --nostdlib
and specify -lgcc manually)
Jerome
--
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr
|
February 17, 2010 Re: DMD on x86_64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert Clipsham | Robert Clipsham Wrote: > On 17/02/10 06:05, Jesse Phillips wrote: > > Oh, yeah Arch dropped most efforts to support 32bit didn't they. This > > I'm pretty sure they didn't... maybe they did on x86_64, I don't know. > > > probably won't help but maybe trying > > > > dmd test.d -L-L/opt/lib32/lib -L-melf_i386 > > Already tried this, no luck :( > > > > > I'd hope that would at least stop it complaining about libpthread. (but so should have your gcc -m32 > > No luck unfortunately with either method :s My understanding was that all you had was x86_64 Arch http://www.archlinux.org/news/440/ And I found this, "I don't think that the default arch64 gcc is a cross-compiler so you won't be able to compile 32-bit apps with it" But isn't really related to linking so... http://bbs.archlinux.org/viewtopic.php?id=64979 |
February 18, 2010 Re: DMD on x86_64 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert Clipsham | On 15/02/10 15:54, Robert Clipsham wrote: > I've been wanting to try D2 properly for a while now, but as I use linux > x86-64 I've had to resort to using a virtual machine, which is really > off putting when I just want to play around with it. I've read multiple > threads about getting dmd working with a multilib system, but I still > can't get it working, here's what I've tried: I managed to get it working! Took a lot of effort, but in short: % yaourt -S lib32-glibc-multilib # The next step should be yaourt -S gcc-multilib, but the package # is broken currently, and I suspect most people don't really want # to install another locale and wait over an hour for gcc to compile # only to find you forgot something and have to start again, so... % cd /tmp # I've uploaded my precompiled version of gcc-multilib with the tweaks # I needed to compile already done, removing the need to install new # locales and wait for gcc to compile, aren't I nice? # I might even post newer versions here when the package is updated on # AUR :) % wget http://omploader.org/vM2w4cw # I know this step looks questionable, it's needed though (try skipping # it if you want a reason) % sudo pacman -Rd gcc lib32-glibc lib32-glibc-multilib lib32-gcc-libs # And install gcc-multilib % sudo pacman -U gcc-multilib-4.4.2-10-x86_64.pkg.tar.gz # You should now be able to use dmd :) % cat > hello.d <<EOF import std.stdio; void main() { writeln( "Hello World!" ); } EOF % dmd hello.d % ./hello Hello World! Hope this helps anyone having trouble getting dmd working on Arch Linux x86-64 :) Thanks to everyone who helped me, I probably wouldn't have managed without your help :) Robert |
Copyright © 1999-2021 by the D Language Foundation