www.digitalmars.com         C & C++   DMDScript  

D - How use dmd under linux?

reply Manfred Hansen <manfred toppoint.de> writes:
Hello,

this is what i have done:


hansen hansen-lx:~/d/dmd/src> ./dmd hello.d   
Linker is not yet completed for this version of DMD Linux

hansen hansen-lx:~/d/dmd/src> gcc -o hello hello.o phobos.a -lpthread 
/usr/i486-suse-linux/bin/ld: phobos.a(moduleinit.o): bad relocation section 
name `.rel.data'
/usr/i486-suse-linux/bin/ld: phobos.a(array.o): bad relocation section name 
`.rel.data'
/usr/i486-suse-linux/bin/ld: phobos.a(gcx.o): bad relocation section name 
`.rel.data'
/usr/i486-suse-linux/bin/ld: phobos.a(gcbits.o): bad relocation section name 
`.rel.data'

hello.d is from samples.
After this i have a working hello programm.
But a lot of messages from the linker.

The phobos.a have i copied to /usr/lib
gcc version 2.95.3

Regards Manfred
May 10 2003
next sibling parent reply "Walter" <walter digitalmars.com> writes:
This is the kind of thing I was afraid of. I built this thing under Red Hat
Linux, and I hoped that all the various linkers would be compatible. I
haven't got a clue why that linker complains about the section name. You're
saying the result works anyway?

"Manfred Hansen" <manfred toppoint.de> wrote in message
news:b9j706$3d6$1 digitaldaemon.com...
 Hello,

 this is what i have done:


 hansen hansen-lx:~/d/dmd/src> ./dmd hello.d
 Linker is not yet completed for this version of DMD Linux

 hansen hansen-lx:~/d/dmd/src> gcc -o hello hello.o phobos.a -lpthread
 /usr/i486-suse-linux/bin/ld: phobos.a(moduleinit.o): bad relocation

 name `.rel.data'
 /usr/i486-suse-linux/bin/ld: phobos.a(array.o): bad relocation section

 `.rel.data'
 /usr/i486-suse-linux/bin/ld: phobos.a(gcx.o): bad relocation section name
 `.rel.data'
 /usr/i486-suse-linux/bin/ld: phobos.a(gcbits.o): bad relocation section

 `.rel.data'

 hello.d is from samples.
 After this i have a working hello programm.
 But a lot of messages from the linker.

 The phobos.a have i copied to /usr/lib
 gcc version 2.95.3

 Regards Manfred

May 10 2003
next sibling parent "Carlos Santander B." <carlos8294 msn.com> writes:
"Walter" <walter digitalmars.com> escribi๓ en el mensaje
news:b9jhna$d5r$1 digitaldaemon.com...
| This is the kind of thing I was afraid of. I built this thing under Red
Hat
| Linux, and I hoped that all the various linkers would be compatible. I
| haven't got a clue why that linker complains about the section name.
You're
| saying the result works anyway?
|
| "Manfred Hansen" <manfred toppoint.de> wrote in message
| news:b9j706$3d6$1 digitaldaemon.com...
| > Hello,
| >
| > this is what i have done:
| >
| >
| > hansen hansen-lx:~/d/dmd/src> ./dmd hello.d
| > Linker is not yet completed for this version of DMD Linux
| >
| > hansen hansen-lx:~/d/dmd/src> gcc -o hello hello.o phobos.a -lpthread
| > /usr/i486-suse-linux/bin/ld: phobos.a(moduleinit.o): bad relocation
| section
| > name `.rel.data'
| > /usr/i486-suse-linux/bin/ld: phobos.a(array.o): bad relocation section
| name
| > `.rel.data'
| > /usr/i486-suse-linux/bin/ld: phobos.a(gcx.o): bad relocation section
name
| > `.rel.data'
| > /usr/i486-suse-linux/bin/ld: phobos.a(gcbits.o): bad relocation section
| name
| > `.rel.data'
| >
| > hello.d is from samples.
| > After this i have a working hello programm.
| > But a lot of messages from the linker.
| >
| > The phobos.a have i copied to /usr/lib
| > gcc version 2.95.3
| >
| > Regards Manfred
|
|

I got exactly the same (gcc 3.. I don't remember, Mandrake 9) but it works
fine.

—————————————————————————
Carlos Santander
"Walter" <walter digitalmars.com> escribi๓ en el mensaje
news:b9jhna$d5r$1 digitaldaemon.com...
| This is the kind of thing I was afraid of. I built this thing under Red
Hat
| Linux, and I hoped that all the various linkers would be compatible. I
| haven't got a clue why that linker complains about the section name.
You're
| saying the result works anyway?
|
| "Manfred Hansen" <manfred toppoint.de> wrote in message
| news:b9j706$3d6$1 digitaldaemon.com...
| > Hello,
| >
| > this is what i have done:
| >
| >
| > hansen hansen-lx:~/d/dmd/src> ./dmd hello.d
| > Linker is not yet completed for this version of DMD Linux
| >
| > hansen hansen-lx:~/d/dmd/src> gcc -o hello hello.o phobos.a -lpthread
| > /usr/i486-suse-linux/bin/ld: phobos.a(moduleinit.o): bad relocation
| section
| > name `.rel.data'
| > /usr/i486-suse-linux/bin/ld: phobos.a(array.o): bad relocation section
| name
| > `.rel.data'
| > /usr/i486-suse-linux/bin/ld: phobos.a(gcx.o): bad relocation section
name
| > `.rel.data'
| > /usr/i486-suse-linux/bin/ld: phobos.a(gcbits.o): bad relocation section
| name
| > `.rel.data'
| >
| > hello.d is from samples.
| > After this i have a working hello programm.
| > But a lot of messages from the linker.
| >
| > The phobos.a have i copied to /usr/lib
| > gcc version 2.95.3
| >
| > Regards Manfred
|
|

I got exactly the same (gcc 3.. I don't remember, Mandrake 9) but it works
fine.

—————————————————————————
Carlos Santander
May 10 2003
prev sibling next sibling parent reply John Reimer <jjreimer telus.net> writes:
On Sat, 10 May 2003 11:48:10 -0700, Walter wrote:

 This is the kind of thing I was afraid of. I built this thing under Red Hat
 Linux, and I hoped that all the various linkers would be compatible. I
 haven't got a clue why that linker complains about the section name. You're
 saying the result works anyway?
 
 "Manfred Hansen" <manfred toppoint.de> wrote in message
 news:b9j706$3d6$1 digitaldaemon.com...
 Hello,

 this is what i have done:


 hansen hansen-lx:~/d/dmd/src> ./dmd hello.d
 Linker is not yet completed for this version of DMD Linux

 hansen hansen-lx:~/d/dmd/src> gcc -o hello hello.o phobos.a -lpthread
 /usr/i486-suse-linux/bin/ld: phobos.a(moduleinit.o): bad relocation

 name `.rel.data'
 /usr/i486-suse-linux/bin/ld: phobos.a(array.o): bad relocation section

 `.rel.data'
 /usr/i486-suse-linux/bin/ld: phobos.a(gcx.o): bad relocation section name
 `.rel.data'
 /usr/i486-suse-linux/bin/ld: phobos.a(gcbits.o): bad relocation section

 `.rel.data'

 hello.d is from samples.
 After this i have a working hello programm.
 But a lot of messages from the linker.

 The phobos.a have i copied to /usr/lib
 gcc version 2.95.3

 Regards Manfred


Ouch, this could be tough getting this to work on different linux distributions. But Redhat Linux was a wise choice to start with, I think. Unfortunately multiple Linux distributions are difficult to support with a single binary package without a fair amount of work. Redhat uses RPMs and Gentoo uses portage ebuilds to sort out dependency issues. I'll give it a try on Gentoo soon. Manfred appears to be using Suse Linux. Later, John
May 10 2003
next sibling parent reply John Reimer <jjreimer telus.net> writes:
I should mention, though, that the above problem doesn't look like a
dependency issue, I guess.
May 10 2003
parent reply "Walter" <walter digitalmars.com> writes:
"John Reimer" <jjreimer telus.net> wrote in message
news:pan.2003.05.10.19.13.15.368645 telus.net...
 I should mention, though, that the above problem doesn't look like a
 dependency issue, I guess.

I'm a newbee with linux, so any clues you guys can come up will help. I tried googling on the error message, but didn't come up with much.
May 10 2003
parent reply John Reimer <jjreimer telus.net> writes:
On Sat, 10 May 2003 12:23:43 -0700, Walter wrote:

 
 "John Reimer" <jjreimer telus.net> wrote in message
 news:pan.2003.05.10.19.13.15.368645 telus.net...
 I should mention, though, that the above problem doesn't look like a
 dependency issue, I guess.

I'm a newbee with linux, so any clues you guys can come up will help. I tried googling on the error message, but didn't come up with much.

Well, you can count on that. I'm sure many people want to see it on linux enough to help wherever possible. I know I do. I'm no Linux expert, but I love messing with it. There was one thing I was wondering. If you are using Redhat Linux, it's likely you are using a more recent version, correct? Maybe 8.0 or 9.0? If so, it's very unlikely that you compiled dmd or phobos using gcc 2.95.3. your probably using gcc 3.1 or 3.2. Manfred's gcc 2.95.3 probably didn't like linking to your gcc 3 compiled phobos (2.95.3 and 3 have a completely different and incompatible ABI). If this is the case, I'd stick to supporting the new gcc 3 compiler. Although this is a little over my head, so I'm not quite sure. I may be just confusing the issue. I think there are some gcc experts on this list, so I had better lay low on this issue. Later, John
May 10 2003
next sibling parent John Reimer <jjreimer telus.net> writes:
On Sat, 10 May 2003 12:43:23 -0700, John Reimer wrote:

 On Sat, 10 May 2003 12:23:43 -0700, Walter wrote:
 
 
 "John Reimer" <jjreimer telus.net> wrote in message
 news:pan.2003.05.10.19.13.15.368645 telus.net...
 I should mention, though, that the above problem doesn't look like a
 dependency issue, I guess.

I'm a newbee with linux, so any clues you guys can come up will help. I tried googling on the error message, but didn't come up with much.

Well, you can count on that. I'm sure many people want to see it on linux enough to help wherever possible. I know I do. I'm no Linux expert, but I love messing with it. There was one thing I was wondering. If you are using Redhat Linux, it's likely you are using a more recent version, correct? Maybe 8.0 or 9.0? If so, it's very unlikely that you compiled dmd or phobos using gcc 2.95.3. your probably using gcc 3.1 or 3.2. Manfred's gcc 2.95.3 probably didn't like linking to your gcc 3 compiled phobos (2.95.3 and 3 have a completely different and incompatible ABI). If this is the case, I'd stick to supporting the new gcc 3 compiler. Although this is a little over my head, so I'm not quite sure. I may be just confusing the issue. I think there are some gcc experts on this list, so I had better lay low on this issue. Later, John

Oops, perhaps that isn't it after all. Looks like Carlos is using gcc 3.x and he appears to have the same problem. Later, John
May 10 2003
prev sibling next sibling parent reply John Reimer <jjreimer telus.net> writes:
On Sat, 10 May 2003 12:43:23 -0700, John Reimer wrote:

 On Sat, 10 May 2003 12:23:43 -0700, Walter wrote:
 
 
 "John Reimer" <jjreimer telus.net> wrote in message

likely you are using a more recent version, correct? Maybe 8.0 or 9.0? If so, it's very unlikely that you compiled dmd or phobos using gcc 2.95.3. your probably using gcc 3.1 or 3.2. Manfred's gcc 2.95.3 probably didn't like linking to your gcc 3 compiled phobos (2.95.3 and 3 have a completely different and incompatible ABI). If this is the case, I'd stick to supporting the new gcc 3 compiler.

*sigh*, I really don't know what I was thinking -- gcc compiling phobos (not!) Obviously I don't have a clue of what I'm talking about. Anyway, so far, I've had just a little success on Gentoo Linux. At first dmd wouldn't run with the error that it couldn't find "libstdc++-libc6.2-2.so.3" so I did a evil thing and sym-linked it to my libc2.3.2.so in /lib. This seemed to fix that problem. Now dmd runs and displays the startup message properly. I then tried compiling hello.d. But now it complains that it can't open "object.d." This is in the dmd/src/phobos directory. Apparently it can't reach it. I'll fiddle with this a little more I guess. maybe the dmd.conf setting is taking hold? Later, John
May 10 2003
parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
"John Reimer" <jjreimer telus.net> escribi๓ en el mensaje
news:pan.2003.05.10.21.00.55.185697 telus.net...
|
| I then tried compiling hello.d.  But now it complains that it can't open
| "object.d."  This is in the dmd/src/phobos directory.  Apparently it can't
| reach it.  I'll fiddle with this a little more I guess. maybe the dmd.conf
| setting is taking hold?
|
| Later,
|
| John
|

I had the same problem. First, dmd.conf looks for dmd/src/phobos under ~, so
I had to first change that. Then it didn't work anyway. So I copied dmd.conf
to the directory where I was working and it compiled just fine. So I think
dmd is looking for dmd.conf in the current directory instead of where it's
located.
I hated that (and the fact of having separate linking) so I added /dmd/bin
to my path, and set DMD to be /dmd. Then I created a small program that,
using DMD, called dmd and after that gcc. It's working fine now.

-------------------------
Carlos Santander
"John Reimer" <jjreimer telus.net> escribi๓ en el mensaje
news:pan.2003.05.10.21.00.55.185697 telus.net...
|
| I then tried compiling hello.d.  But now it complains that it can't open
| "object.d."  This is in the dmd/src/phobos directory.  Apparently it can't
| reach it.  I'll fiddle with this a little more I guess. maybe the dmd.conf
| setting is taking hold?
|
| Later,
|
| John
|

I had the same problem. First, dmd.conf looks for dmd/src/phobos under ~, so
I had to first change that. Then it didn't work anyway. So I copied dmd.conf
to the directory where I was working and it compiled just fine. So I think
dmd is looking for dmd.conf in the current directory instead of where it's
located.
I hated that (and the fact of having separate linking) so I added /dmd/bin
to my path, and set DMD to be /dmd. Then I created a small program that,
using DMD, called dmd and after that gcc. It's working fine now.

-------------------------
Carlos Santander
May 10 2003
next sibling parent John Reimer <jjreimer telus.net> writes:
 
 I had the same problem. First, dmd.conf looks for dmd/src/phobos under ~, so
 I had to first change that. Then it didn't work anyway. So I copied dmd.conf
 to the directory where I was working and it compiled just fine. So I think
 dmd is looking for dmd.conf in the current directory instead of where it's
 located.
 I hated that (and the fact of having separate linking) so I added /dmd/bin
 to my path, and set DMD to be /dmd. Then I created a small program that,
 using DMD, called dmd and after that gcc. It's working fine now.
 
 -------------------------

Thanks Carlos, I think that's the problem. I'll try moving the dmd.conf for now. Later, John
May 10 2003
prev sibling parent reply John Reimer <jjreimer telus.net> writes:
 
 I had the same problem. First, dmd.conf looks for dmd/src/phobos under ~, so
 I had to first change that. Then it didn't work anyway. So I copied dmd.conf
 to the directory where I was working and it compiled just fine. So I think
 dmd is looking for dmd.conf in the current directory instead of where it's
 located.
 I hated that (and the fact of having separate linking) so I added /dmd/bin
 to my path, and set DMD to be /dmd. Then I created a small program that,
 using DMD, called dmd and after that gcc. It's working fine now.
 
 -------------------------
 Carlos Santander

Actually, moving the dmd.conf didn't work either. I had to give up on dmd.conf and directly reference the location of the phobos in the dmd command with -I. Apparently, the environment variable can't be set by dmd.conf or read by dmd (correct permissions are in place). Perhaps this is an indirect result of my sym-linking to the libc library? A few bugs to work out, but it's a start :D. Later, John
May 10 2003
parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
"John Reimer" <jjreimer telus.net> escribi๓ en el mensaje
news:pan.2003.05.10.23.21.04.95800 telus.net...
|
|
| Actually, moving the dmd.conf didn't work either. I had to give up on
| dmd.conf and directly reference the location of the phobos in the dmd
| command with -I. Apparently, the environment variable can't be set by
| dmd.conf or read by dmd (correct permissions are in place).  Perhaps this
| is an indirect result of my sym-linking to the libc library?
|
| A few bugs to work out, but it's a start :D.
|
| Later,
| John
|

Like I said: dmd.conf has "-I~/dmd/src/phobos", so you have to change that
to where you copied dmd.

-------------------------
Carlos Santander
"John Reimer" <jjreimer telus.net> escribi๓ en el mensaje
news:pan.2003.05.10.23.21.04.95800 telus.net...
|
|
| Actually, moving the dmd.conf didn't work either. I had to give up on
| dmd.conf and directly reference the location of the phobos in the dmd
| command with -I. Apparently, the environment variable can't be set by
| dmd.conf or read by dmd (correct permissions are in place).  Perhaps this
| is an indirect result of my sym-linking to the libc library?
|
| A few bugs to work out, but it's a start :D.
|
| Later,
| John
|

Like I said: dmd.conf has "-I~/dmd/src/phobos", so you have to change that
to where you copied dmd.

-------------------------
Carlos Santander
May 10 2003
parent reply John Reimer <jjreimer telus.net> writes:
 Like I said: dmd.conf has "-I~/dmd/src/phobos", so you have to change that
 to where you copied dmd.

Well, actually, no, I shouldn't have to because that's where I installed DMD. You probably know this already, but the shell replaces the '~' with the home directory; so, in my case, the tilde should have been automatically replaced by /home/john for a complete /home/john/dmd/src/phobos. And I did try replacing the tilde with the absolute directory, and that didn't work. So that's why I concluded there were problems with dmd reading the environment variable (moving dmd.conf around didn't work either). Later, John
May 10 2003
parent "Carlos Santander B." <carlos8294 msn.com> writes:
"John Reimer" <jjreimer telus.net> escribi๓ en el mensaje
news:pan.2003.05.10.23.57.43.27056 telus.net...
|
| > Like I said: dmd.conf has "-I~/dmd/src/phobos", so you have to change
that
| > to where you copied dmd.
|
| Well, actually, no, I shouldn't have to because that's where I installed
| DMD. You probably know this already, but the shell replaces the '~' with
| the home directory; so, in my case, the tilde should have been
| automatically replaced by /home/john for a complete
/home/john/dmd/src/phobos.
|
| And I did try replacing the tilde with the absolute directory, and that
| didn't work.  So that's why I concluded there were problems with dmd
| reading the environment variable (moving dmd.conf around didn't work
| either).
|
| Later,
|
| John
|

Then I'm clueless.... lol.

-------------------------
Carlos Santander


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.478 / Virus Database: 275 - Release Date: 2003-05-06
May 10 2003
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
"John Reimer" <jjreimer telus.net> wrote in message
news:pan.2003.05.10.19.43.23.101335 telus.net...
 There was one thing I was wondering.  If you are using Redhat Linux, it's
 likely you are using a more recent version, correct? Maybe 8.0 or 9.0? If
 so, it's very unlikely that you compiled dmd or phobos using gcc 2.95.3.
 your probably using gcc 3.1 or 3.2. Manfred's gcc 2.95.3 probably didn't
 like linking to your gcc 3 compiled phobos (2.95.3 and 3 have a completely
 different and incompatible ABI).  If this is the case, I'd stick to
 supporting the new gcc 3 compiler.

I'm using redhat 7.2 and gcc 2.96.
May 11 2003
parent reply John Reimer <jjreimer telus.net> writes:
 
 I'm using redhat 7.2 and gcc 2.96.

Heh, well, I totally miss-guessed. I thought it would be a more recent version. Got to get up to date, Walter, if you're going to be a true Linux convert. ;-D
May 11 2003
parent "Walter" <walter digitalmars.com> writes:
"John Reimer" <jjreimer telus.net> wrote in message
news:pan.2003.05.11.12.18.45.149273 telus.net...
 I'm using redhat 7.2 and gcc 2.96.

Heh, well, I totally miss-guessed. I thought it would be a more recent version. Got to get up to date, Walter, if you're going to be a true

 convert. ;-D

The linux box I'm using is a cast-off from an old project.
May 11 2003
prev sibling next sibling parent reply John Reimer <jjreimer telus.net> writes:
OK, I got dmd working on gentoo linux.

Basically, I get the same error messages as everyone else with a
valid/runnable program "hello":

the command:

gcc -o hello hello.o /home/john/dmd/lib/phobos.a -lpthread -lm

the output:

/usr/bin/ld: /home/john/dmd/lib/phobos.a(moduleinit.o): bad relocation section
name `.rel.data'
/usr/bin/ld: /home/john/dmd/lib/phobos.a(array.o): bad relocation section name
`.rel.data'
/usr/bin/ld: /home/john/dmd/lib/phobos.a(gcx.o): bad relocation section name
`.rel.data'
/usr/bin/ld: /home/john/dmd/lib/phobos.a(gcbits.o): bad relocation section name
`.rel.data'

Platform:

Gentoo Linux 1.4rc4: Gaming-kernel-2.4.20-r2

ld -V:

GNU ld version 2.14.90.0.1 20030508
  Supported emulations:
   elf_i386
   i386linux
   elf_i386_glibc21

gcc --version:

gcc (GCC) 3.2.2

Later,

John
May 10 2003
parent reply "Walter" <walter digitalmars.com> writes:
So, the question is, why is that a bad name? And why does the linker even
care what the section name is?

"John Reimer" <jjreimer telus.net> wrote in message
news:pan.2003.05.10.23.06.44.700990 telus.net...
 OK, I got dmd working on gentoo linux.

 Basically, I get the same error messages as everyone else with a
 valid/runnable program "hello":

 the command:

 gcc -o hello hello.o /home/john/dmd/lib/phobos.a -lpthread -lm

 the output:

 /usr/bin/ld: /home/john/dmd/lib/phobos.a(moduleinit.o): bad relocation

 /usr/bin/ld: /home/john/dmd/lib/phobos.a(array.o): bad relocation section

 /usr/bin/ld: /home/john/dmd/lib/phobos.a(gcx.o): bad relocation section

 /usr/bin/ld: /home/john/dmd/lib/phobos.a(gcbits.o): bad relocation section

 Platform:

 Gentoo Linux 1.4rc4: Gaming-kernel-2.4.20-r2

 ld -V:

 GNU ld version 2.14.90.0.1 20030508
   Supported emulations:
    elf_i386
    i386linux
    elf_i386_glibc21

 gcc --version:

 gcc (GCC) 3.2.2

 Later,

 John

May 11 2003
next sibling parent John Reimer <jjreimer telus.net> writes:
On Sun, 11 May 2003 01:36:25 -0700, Walter wrote:

 So, the question is, why is that a bad name? And why does the linker even
 care what the section name is?
 

I'll have to take this opportunity to study how the linker works. I know very little about this as of now. I couldn't find anything in the 'ld' documents about the proper format for the relocation section name. It did say that certain formats (a.out and elf) require specific names in order to be valid, though. Later, John
May 11 2003
prev sibling parent John Reimer <jjreimer telus.net> writes:
On Sun, 11 May 2003 01:36:25 -0700, Walter wrote:

 So, the question is, why is that a bad name? And why does the linker even
 care what the section name is?

I guess in the long run, since the program actually links, the linker doesn't really care what the section name is, but just complains about it for some weird reason, then links away. Strange that my ld complains and yours doesn't. I guess newer ld's have added some "features". I think this has something to do with the linker BFD (which stands for?). Maybe changes to the ld code in newer versions are causing this. http://sources.redhat.com/ml/binutils/2001-01/msg00301.html I guess the BFD libraries are the linkers method for accessing objects and archives in a standard manner across different object formats. http://www.gnu.org/manual/ld-2.9.1/html_chapter/ld_5.html Perhaps you found these links already. I wish I could simply try running your ld on my linux to see how that works. What version of ld are you using? (ld -V) Thanks, John
May 11 2003
prev sibling next sibling parent Manfred Hansen <manfred toppoint.de> writes:
John Reimer wrote:

 On Sat, 10 May 2003 11:48:10 -0700, Walter wrote:
 
 This is the kind of thing I was afraid of. I built this thing under Red
 Hat Linux, and I hoped that all the various linkers would be compatible.
 I haven't got a clue why that linker complains about the section name.
 You're saying the result works anyway?
 
 "Manfred Hansen" <manfred toppoint.de> wrote in message
 news:b9j706$3d6$1 digitaldaemon.com...
 Hello,

 this is what i have done:


 hansen hansen-lx:~/d/dmd/src> ./dmd hello.d
 Linker is not yet completed for this version of DMD Linux

 hansen hansen-lx:~/d/dmd/src> gcc -o hello hello.o phobos.a -lpthread
 /usr/i486-suse-linux/bin/ld: phobos.a(moduleinit.o): bad relocation

 name `.rel.data'
 /usr/i486-suse-linux/bin/ld: phobos.a(array.o): bad relocation section

 `.rel.data'
 /usr/i486-suse-linux/bin/ld: phobos.a(gcx.o): bad relocation section
 name `.rel.data'
 /usr/i486-suse-linux/bin/ld: phobos.a(gcbits.o): bad relocation section

 `.rel.data'

 hello.d is from samples.
 After this i have a working hello programm.
 But a lot of messages from the linker.

 The phobos.a have i copied to /usr/lib
 gcc version 2.95.3

 Regards Manfred


Ouch, this could be tough getting this to work on different linux distributions. But Redhat Linux was a wise choice to start with, I think. Unfortunately multiple Linux distributions are difficult to support with a single binary package without a fair amount of work. Redhat uses RPMs and Gentoo uses portage ebuilds to sort out dependency issues. I'll give it a try on Gentoo soon. Manfred appears to be using Suse Linux.

Yes that's true Suse 8.0
 
 Later,
 
 John

May 11 2003
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
"John Reimer" <jjreimer telus.net> wrote in message
news:pan.2003.05.10.19.09.23.63543 telus.net...
 Ouch, this could be tough getting this to work on different linux
 distributions.  But Redhat Linux was a wise choice to start with, I think.
 Unfortunately multiple Linux distributions are difficult to support with
 a single binary package without a fair amount of work.  Redhat uses RPMs
 and Gentoo uses portage ebuilds to sort out dependency issues.

At least the binaries themselves seem to execute fine.
May 10 2003
parent John Reimer <jjreimer telus.net> writes:
 
 At least the binaries themselves seem to execute fine.

Very true. It seems they are all runnable, which is truly excellent.
May 11 2003
prev sibling next sibling parent reply Garen Parham <nospam garen.net> writes:
Walter wrote:

 This is the kind of thing I was afraid of. I built this thing under Red Hat
 Linux, and I hoped that all the various linkers would be compatible. I
 haven't got a clue why that linker complains about the section name. You're
 saying the result works anyway?
 

Works for me: $ gcc -o hello hello.o phobos.a -lpthread /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld: phobos.a(moduleinit.o): bad relocation section name `.rel.data' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld: phobos.a(array.o): bad relocation section name `.rel.data' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld: phobos.a(gcx.o): bad relocation section name `.rel.data' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld: phobos.a(gcbits.o): bad relocation section name `.rel.data' $ ./hello hello world args.length = 1 args[0] = './hello' Using: $ ld -V GNU ld version 2.13.90.0.20 20030409 Supported emulations: elf_i386 i386linux elf_i386_glibc21
May 10 2003
parent Helmut Leitner <helmut.leitner chello.at> writes:
Garen Parham wrote:
 
 Walter wrote:
 
 This is the kind of thing I was afraid of. I built this thing under Red Hat
 Linux, and I hoped that all the various linkers would be compatible. I
 haven't got a clue why that linker complains about the section name. You're
 saying the result works anyway?

Works for me: $ gcc -o hello hello.o phobos.a -lpthread /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld: phobos.a(moduleinit.o): bad relocation section name `.rel.data' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld: phobos.a(array.o): bad relocation section name `.rel.data' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld: phobos.a(gcx.o): bad relocation section name `.rel.data' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld: phobos.a(gcbits.o): bad relocation section name `.rel.data' $ ./hello hello world args.length = 1 args[0] = './hello' Using: $ ld -V GNU ld version 2.13.90.0.20 20030409 Supported emulations: elf_i386 i386linux elf_i386_glibc21

It's exactly the same with me. I'm using - Suse Linux 8.0 - gcc 2.95.3 - GNU ld version 2.11.92.0.10 20011021 (SuSE) Supported emulations: elf_i386 i386linux I googled this (don't no nothing about Unix linking) <http://www.cs.utah.edu/classes/cs4400/lectures/new-L15x2.pdf> <http://www.linuxjournal.com/article.php?sid=6463> -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
May 10 2003
prev sibling parent Mark T <Mark_member pathlink.com> writes:
In article <b9jhna$d5r$1 digitaldaemon.com>, Walter says...
This is the kind of thing I was afraid of. I built this thing under Red Hat
Linux, and I hoped that all the various linkers would be compatible. 

Could you $ ld -V $ gcc --version on your Redhat system and publish here What version of Redhat ?
May 10 2003
prev sibling parent Bill Cox <bill viasic.com> writes:
Here's just a simple summary if the minor problems I ran into.  I'm 
using RedHat Linux 7.3, and gcc version 2.96.  I put the dmd
directory in my home directory (/home/bill/dmd).

- The linux executables neede a chmod +x to execute.

- I also got the "can't open object.d" error that results from not 
finding the dmd.conf file.  This went away when I made a local copy.

- I also got the bad relocation section name `.rel.data' problem, but 
also succeeded in linking hello.

It took me about 1/2 hour to get through the problems, given the 
discussion already posted here.  Not bad.

Bill

Manfred Hansen wrote:
 Hello,

 this is what i have done:


 hansen hansen-lx:~/d/dmd/src> ./dmd hello.d
 Linker is not yet completed for this version of DMD Linux

 hansen hansen-lx:~/d/dmd/src> gcc -o hello hello.o phobos.a -lpthread
 /usr/i486-suse-linux/bin/ld: phobos.a(moduleinit.o): bad relocation 

 name `.rel.data'
 /usr/i486-suse-linux/bin/ld: phobos.a(array.o): bad relocation 

 `.rel.data'
 /usr/i486-suse-linux/bin/ld: phobos.a(gcx.o): bad relocation section 

 `.rel.data'
 /usr/i486-suse-linux/bin/ld: phobos.a(gcbits.o): bad relocation 

 `.rel.data'

 hello.d is from samples.
 After this i have a working hello programm.
 But a lot of messages from the linker.

 The phobos.a have i copied to /usr/lib
 gcc version 2.95.3

 Regards Manfred

May 10 2003