www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Incompatible libphobos2.a?

reply Andre Tampubolon <andre lc.vlsm.org> writes:
I just built both 32 & 64 bit DMD.
The 32 bit works fine, but the 64 bit not.

I always get this:
/usr/bin/ld: skipping incompatible
/home/anta40/Digital-Mars/dmd-dev/lib64/libphobos2.a when searching for
-lphobos2

Every time I build 64 bit phobos, I always make sure that it is the 64
bit dmd that is being invoked, and I use this command to build:
make -f posix.mak MODEL=64

The strange thing is if I just grab 64 bit libphobos2.a from the
official DMD distribution, then it'll go fine.
Jan 02 2012
next sibling parent reply mta`chrono <chrono mta-international.net> writes:
 I just built both 32&  64 bit DMD.
 The 32 bit works fine, but the 64 bit not.

 I always get this:
 /usr/bin/ld: skipping incompatible
 /home/anta40/Digital-Mars/dmd-dev/lib64/libphobos2.a when searching for
 -lphobos2

Did you compile druntime for 64 bit, too? As libphobos2.a is just an archive file, you're able to extract it and check if all containing objs are 64 bit. have a look at the linux "file" command.
Jan 03 2012
parent Andre Tampubolon <andre lc.vlsm.org> writes:
Ah OK. After I built druntime (both for 32 & 64), dmd works fine.
But previously I didn't build druntime, only dmd and phobos, yet it
worked (32 only though).

I am confused.

On 01/03/2012 05:10 PM, mta`chrono wrote:
 I just built both 32&  64 bit DMD.
 The 32 bit works fine, but the 64 bit not.

 I always get this:
 /usr/bin/ld: skipping incompatible
 /home/anta40/Digital-Mars/dmd-dev/lib64/libphobos2.a when searching for
 -lphobos2

Did you compile druntime for 64 bit, too? As libphobos2.a is just an archive file, you're able to extract it and check if all containing objs are 64 bit. have a look at the linux "file" command.

Jan 03 2012
prev sibling parent reply Trass3r <un known.com> writes:
There's another recent thread about this.
The makefile is a mess. it doesn't build separate libs.

Here's a Linux patch for druntime:

diff --git a/posix.mak b/posix.mak
index 5fd7fee..9ed2004 100644
--- a/posix.mak
+++ b/posix.mak
   -32,9 +32,9    UDFLAGS=-m$(MODEL) -O -release -nofloat -w -d -Isrc  
-Iimport -property

  CFLAGS=-m$(MODEL) -O

-OBJDIR=obj
+OBJDIR=obj$(MODEL)
  DRUNTIME_BASE=druntime
-DRUNTIME=lib/lib$(DRUNTIME_BASE).a
+DRUNTIME=lib/$(MODEL)/lib$(DRUNTIME_BASE).a

  DOCFMT=


and phobos:


diff --git a/posix.mak b/posix.mak
index e43df37..021fff3 100644
--- a/posix.mak
+++ b/posix.mak
   -75,9 +75,9    MAKEFILE:=$(lastword $(MAKEFILE_LIST))

  # Set DRUNTIME name and full path
  ifeq (,$(findstring win,$(OS)))
-       DRUNTIME = $(DRUNTIME_PATH)/lib/libdruntime.a
+       DRUNTIME = $(DRUNTIME_PATH)/lib/$(MODEL)/libdruntime.a
  else
-       DRUNTIME = $(DRUNTIME_PATH)/lib/druntime.lib
+       DRUNTIME = $(DRUNTIME_PATH)/lib/$(MODEL)/druntime.lib
  endif

  # Set CC and DMD
Jan 03 2012
next sibling parent mta`chrono <chrono mta-international.net> writes:
Am 03.01.2012 12:10, schrieb Trass3r:
 There's another recent thread about this.
 The makefile is a mess. it doesn't build separate libs.

 Here's a Linux patch for druntime:

Is this going to be official? I'd like to see that in druntime.
Jan 03 2012
prev sibling parent "Trass3r" <un known.com> writes:
On Tuesday, 3 January 2012 at 12:17:06 UTC, mta`chrono wrote:
 Am 03.01.2012 12:10, schrieb Trass3r:
 There's another recent thread about this.
 The makefile is a mess. it doesn't build separate libs.

 Here's a Linux patch for druntime:

Is this going to be official? I'd like to see that in druntime.

A pull request would need to be prepared. However it's just a quick n dirty fix. And other platforms need to be fixed too.
Jan 03 2012