www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Cannot find libphobos2.a ?

reply Andre Tampubolon <andre lc.vlsm.org> writes:
I just successfully built dmd, druntime, and phobos from the git tree.

Later I tried using this command to build a simple D program, and failed:
~/Digital-Mars/dmd/src/dmd -I~/Digital-Mars/druntime/import
-I~/DigitalMars/phobos
-L-L~/Digital-Mars/phobos/generated/linux/release/32/lib/libphobos2.a test.d

The error is:
collect2: ld returned 1 exit status
--- errorlevel 1

Yet it's obvious that libphobos2.a is in
~/Digital-Mars/phobos/generated/linux/release/32. But if I didn't use
the linker flag, and instead put libphobos2.a in /usr/lib, that command
would work.

So how to use specify the linker flag correctly?
Dec 27 2011
next sibling parent reply "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
On Tue, 27 Dec 2011 21:29:26 +0700, Andre Tampubolon wrote:

 I just successfully built dmd, druntime, and phobos from the git tree.
 
 Later I tried using this command to build a simple D program, and
 failed: ~/Digital-Mars/dmd/src/dmd -I~/Digital-Mars/druntime/import
 -I~/DigitalMars/phobos
 -L-L~/Digital-Mars/phobos/generated/linux/release/32/lib/libphobos2.a
 test.d
 
 The error is:
 collect2: ld returned 1 exit status
 --- errorlevel 1
 
 Yet it's obvious that libphobos2.a is in
 ~/Digital-Mars/phobos/generated/linux/release/32. But if I didn't use
 the linker flag, and instead put libphobos2.a in /usr/lib, that command
 would work.
 
 So how to use specify the linker flag correctly?

I think the -L option should only be used to specify a directory in which to search for libraries, while you put the full path to the library there. DMD already knows it should look for a file named libphobos2.a, so try -L-L~/Digital-Mars/phobos/generated/linux/release/32/lib Lars
Dec 27 2011
parent Andre Tampubolon <andre lc.vlsm.org> writes:
Sorry, there was a typo. The actuall full path is:
~/Digital-Mars/phobos/generated/linux/release/32/libphobos2.a

So I changed to command into:
~/Digital-Mars/dmd/src/dmd -I~/Digital-Mars/druntime/import
-I~/Digital-Mars/phobos
-L-L~/Digital-Mars/phobos/generated/linux/release/32 test.d

And the same error still happens


On 12/27/2011 10:08 PM, Lars T. Kyllingstad wrote:
 On Tue, 27 Dec 2011 21:29:26 +0700, Andre Tampubolon wrote:
 
 I just successfully built dmd, druntime, and phobos from the git tree.

 Later I tried using this command to build a simple D program, and
 failed: ~/Digital-Mars/dmd/src/dmd -I~/Digital-Mars/druntime/import
 -I~/DigitalMars/phobos
 -L-L~/Digital-Mars/phobos/generated/linux/release/32/lib/libphobos2.a
 test.d

 The error is:
 collect2: ld returned 1 exit status
 --- errorlevel 1

 Yet it's obvious that libphobos2.a is in
 ~/Digital-Mars/phobos/generated/linux/release/32. But if I didn't use
 the linker flag, and instead put libphobos2.a in /usr/lib, that command
 would work.

 So how to use specify the linker flag correctly?

I think the -L option should only be used to specify a directory in which to search for libraries, while you put the full path to the library there. DMD already knows it should look for a file named libphobos2.a, so try -L-L~/Digital-Mars/phobos/generated/linux/release/32/lib Lars

Dec 27 2011
prev sibling parent reply Jesse Phillips <jessekphillips+d gmail.com> writes:
On Tue, 27 Dec 2011 21:29:26 +0700, Andre Tampubolon wrote:

 I just successfully built dmd, druntime, and phobos from the git tree.
 
 Later I tried using this command to build a simple D program, and
 failed: ~/Digital-Mars/dmd/src/dmd -I~/Digital-Mars/druntime/import
 -I~/DigitalMars/phobos
 -L-L~/Digital-Mars/phobos/generated/linux/release/32/lib/libphobos2.a
 test.d
 
 The error is:
 collect2: ld returned 1 exit status --- errorlevel 1
 
 Yet it's obvious that libphobos2.a is in
 ~/Digital-Mars/phobos/generated/linux/release/32. But if I didn't use
 the linker flag, and instead put libphobos2.a in /usr/lib, that command
 would work.
 
 So how to use specify the linker flag correctly?

Maybe you are through with this, as your more recent message might suggest. A few more statements from ld would be nice. And be sure dmd is compiling a 32 bit binary (you likely built a 32bit binary so probably not the case).
Jan 02 2012
parent Andre Tampubolon <andre lc.vlsm.org> writes:
Yes, I already figured it out. I have to specify the full path manually,
like this:
-L-L/home/anta40/Digital-Mars/dmd-dev/lib64

Previously I used -L-L~/Digital-Mars/dmd-dev/lib64 and this didn't work.

On 01/03/2012 11:32 AM, Jesse Phillips wrote:
 On Tue, 27 Dec 2011 21:29:26 +0700, Andre Tampubolon wrote:
 
 I just successfully built dmd, druntime, and phobos from the git tree.

 Later I tried using this command to build a simple D program, and
 failed: ~/Digital-Mars/dmd/src/dmd -I~/Digital-Mars/druntime/import
 -I~/DigitalMars/phobos
 -L-L~/Digital-Mars/phobos/generated/linux/release/32/lib/libphobos2.a
 test.d

 The error is:
 collect2: ld returned 1 exit status --- errorlevel 1

 Yet it's obvious that libphobos2.a is in
 ~/Digital-Mars/phobos/generated/linux/release/32. But if I didn't use
 the linker flag, and instead put libphobos2.a in /usr/lib, that command
 would work.

 So how to use specify the linker flag correctly?

Maybe you are through with this, as your more recent message might suggest. A few more statements from ld would be nice. And be sure dmd is compiling a 32 bit binary (you likely built a 32bit binary so probably not the case).

Jan 03 2012