www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - dmd2 on Ubuntu

reply Brian Myers <tarkawebfoot gmail.com> writes:
Hello all,

It's been a while since I've worked with D, but I'm coming back to it now since
it has 64 bit support for Windows, Linux and Mac. I'm developing on
64 bit Ubuntu. Here's the output of uname -a:


GNU/Linux

I've done a partial installation leaving the source libraries in my user
directory, but moving phobos and the executables to /usr/local/bin and
/usr/lib. dmd seems to run fine. I was able to compile some old projects I had
into libraries. Now I'm trying to build the executable to use them.
When I issue:

dmd -ofbin/Debug/d_txtflt obj/Debug/d_txtflt.o
../d_libcsv/bin/Debug/libd_libcsv.a
../strptime/internalDate/bin/Debug/libinternalDate.a

I get /usr/bin/ld: cannot find -lphobos2. Here is the contents of my dmd.conf
file which is in /etc:

[Environment]

DFLAGS=-I/home/tarka/dmd2/src/phobos -I/home/tarka/dmd2/src/druntime/import
-L-L/usr/lib -L--no-warn-search-mismatch -L--
export-dynamic -L-lrt

The compilation seems to work fine; it's the link that fails. When I tried to
run ld directly with:

ld -o bin/Debug/d_txtflt obj/Debug/d_txtflt.o -l
:../strptime/internalDate/bin/libinternalDate.a -l
:../d_libcsv/bin/Debug/libd_libcsv.a -l
:/usr/lib/libphobos2.a -E -lrt -lc

I get a warning:

ld: warning: cannot find entry symbol _start; defaulting to 00000000004562d0

But it does generate output that the file commands claims is a 64 bit
executable. The file will not run however.

Any ideas what's going on here?

Thanx

Brian
May 06 2011
next sibling parent "Nick Sabalausky" <a a.a> writes:
"Brian Myers" <tarkawebfoot gmail.com> wrote in message 
news:iq1if2$2d6g$1 digitalmars.com...
 Hello all,

 It's been a while since I've worked with D, but I'm coming back to it now 
 since it has 64 bit support for Windows, Linux and Mac.
For linux. 64 on Win/Mac is still to come.
May 06 2011
prev sibling next sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
put dmd.conf in the same directory as dmd.
May 06 2011
parent reply Brian Myers <tarkawebfoot gmail.com> writes:
So I removed the executables from /usr/local/bin and rather than adding them to
my path, I sym linked them to the dmd2/linux/bin directory in
my home directory. I did this because I'd like to have the compiler and tools
available system wide. I then moved the dmd.conf file from /etc to
the linux/bin directory where dmd resides.

When I do this I get different messages from dmd, but it still can't make ld
find -lphobos2. The two messages I get, however, are:

/usr/bin/ld: skipping incompatible /usr/lib/libphobos2.a when searching for
-lphobos2

The other message is also about libphobos2.a, it's just finding it relative to
the gcc library path.

I even extracted all the object files from libphobos2.a and verified that they
were 64 bit ELF format. Is it really that libphobos2.a is messed up, or
is this message a red herring?

Thanx again

Brian
May 07 2011
parent Walter Bright <newshound2 digitalmars.com> writes:
On 5/7/2011 12:03 PM, Brian Myers wrote:
 So I removed the executables from /usr/local/bin and rather than adding them
 to my path, I sym linked them to the dmd2/linux/bin directory in my home
 directory. I did this because I'd like to have the compiler and tools
 available system wide. I then moved the dmd.conf file from /etc to the
 linux/bin directory where dmd resides.

 When I do this I get different messages from dmd, but it still can't make ld
 find -lphobos2. The two messages I get, however, are:

 /usr/bin/ld: skipping incompatible /usr/lib/libphobos2.a when searching for
 -lphobos2

 The other message is also about libphobos2.a, it's just finding it relative
 to the gcc library path.

 I even extracted all the object files from libphobos2.a and verified that
 they were 64 bit ELF format. Is it really that libphobos2.a is messed up, or
 is this message a red herring?
There is a libphobos2.a that is 32 bit, and one that is 64 bit. Make sure that you're using one that is compatible with the -m32 or -m64 settings you're using with the compiler. Also, please use dmd.conf, which contains a switch to shut off undesired warning messages from ld. I strongly suggest trying the default install, making sure that works, before modifying it for your own needs.
May 07 2011
prev sibling next sibling parent Jesse Phillips <jessekphillips+D gmail.com> writes:
Brian Myers Wrote:

 Hello all,
dmd generates 64 bit only for Linux, GDC should work though. What is the error when you compile with dmd? The error you are getting from ld is saying that you have no main function. You know you can/should put your libraries in /usr/local/lib and your source (phobos, druntime) in /usr/local/src, but nothing indicates to me that you've incorrectly set up dmd.conf.
May 06 2011
prev sibling parent "Jonathan M Davis" <jmdavisProg gmx.com> writes:
 Hello all,
 
 It's been a while since I've worked with D, but I'm coming back to it now
 since it has 64 bit support for Windows, Linux and Mac. I'm developing on
 64 bit Ubuntu. Here's the output of uname -a:
 

 x86_64 GNU/Linux
 
 I've done a partial installation leaving the source libraries in my user
 directory, but moving phobos and the executables to /usr/local/bin and
 /usr/lib. dmd seems to run fine. I was able to compile some old projects I
 had into libraries. Now I'm trying to build the executable to use them.
 When I issue:
 
 dmd -ofbin/Debug/d_txtflt obj/Debug/d_txtflt.o
 ../d_libcsv/bin/Debug/libd_libcsv.a
 ../strptime/internalDate/bin/Debug/libinternalDate.a
 
 I get /usr/bin/ld: cannot find -lphobos2. Here is the contents of my
 dmd.conf file which is in /etc:
 
 [Environment]
 
 DFLAGS=-I/home/tarka/dmd2/src/phobos -I/home/tarka/dmd2/src/druntime/import
 -L-L/usr/lib -L--no-warn-search-mismatch -L-- export-dynamic -L-lrt
 
 The compilation seems to work fine; it's the link that fails. When I tried
 to run ld directly with:
 
 ld -o bin/Debug/d_txtflt obj/Debug/d_txtflt.o -l
 :../strptime/internalDate/bin/libinternalDate.a -l
 :../d_libcsv/bin/Debug/libd_libcsv.a -l
 
 :/usr/lib/libphobos2.a -E -lrt -lc
 
 I get a warning:
 
 ld: warning: cannot find entry symbol _start; defaulting to
 00000000004562d0
 
 But it does generate output that the file commands claims is a 64 bit
 executable. The file will not run however.
 
 Any ideas what's going on here?
 
 Thanx
 
 Brian
Personally, I'd advise to not even try "installing" dmd. I'd suggest that you simply unzip the dmd zip file somewhere in your home directory and then add /path/to/unzipped/dmd2/linux/bin to your PATH. That generally works great. It makes it incredibly easy to swap it out when a new version is released, and you don't really have to worry about setting it up correctly. - Jonathan M Davis
May 06 2011