www.digitalmars.com         C & C++   DMDScript  

D - problem compiling dli : undefined reference to `errno'

reply Giles Constant <gilesc hyperlink-interactive.co.uk> writes:
Hi there,

Is this a problem with gcc3.2, or with the dli sources?  I've heard there's
problems in libc with gcc3.2 relating to errno, but didn't really
understand the thread :-)


make -C phobos
make[1]: Entering directory `/usr/local/src/dli-0.1.2/phobos'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/local/src/dli-0.1.2/phobos'
./dli test.d -unittest
phobos/libphobos.so: undefined reference to `errno'
collect2: ld returned 1 exit status
./test hello arguments
make: ./test: Command not found
make: *** [testfoo] Error 127


BST 2003 i686 Pentium III (Coppermine) GenuineIntel GNU/Linux

gcc (GCC) 3.2.2
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Thanks for any help,

Giles
May 19 2003
parent reply "Walter" <walter digitalmars.com> writes:
Since errno is implemented as a macro on many C compiler systems,
referencing "errno" from D code will rarely work. Therefore, use instead the
function getErrno() which is defined in phobos/errno.c, which essentially
translates the macro into something usable by D.
May 19 2003
parent reply Giles Constant <gilesc hyperlink-interactive.co.uk> writes:
Walter wrote:

 Since errno is implemented as a macro on many C compiler systems,
 referencing "errno" from D code will rarely work. Therefore, use instead
 the function getErrno() which is defined in phobos/errno.c, which
 essentially translates the macro into something usable by D.
**I** didn't use errno! :-) It doesn't appear in the source either.. it appears to be a linker error when compiling with dli itself - even if I try to compile "hello_world.d" without referencing 'errno' at all, it pops up with a complaint about errno. See the original comment - I got the error immediately after typing "make" within the dli sources.
May 20 2003
parent reply Giles Constant <gilesc hyperlink-interactive.co.uk> writes:
I wrote:

 **I** didn't use errno! :-)  It doesn't appear in the source either.. it
 appears to be a linker error when compiling with dli itself - even if I
 try to compile "hello_world.d" without referencing 'errno' at all, it pops
 up
 with a complaint about errno.  See the original comment - I got the error
 immediately after typing "make" within the dli sources.
eg: import string; int main(char[][] args) { printf("Hello world!\n"); return 0; } phobos/libphobos.so: undefined reference to `errno' collect2: ld returned 1 exit status /usr/local/src/dli-0.1.2
May 20 2003
parent reply "Walter" <walter digitalmars.com> writes:
I suggest switching to the DMD linux version.
May 20 2003
parent reply Giles Constant <gilesc hyperlink-interactive.co.uk> writes:
ah.. now i'm getting results.. thanks :-)

Quick question - how does one build it from source?  There don't appear to
be any makefiles or anything.  I'd be interested in creating a gentoo
package out of it.

Walter wrote:

 I suggest switching to the DMD linux version.
May 21 2003
parent reply John Reimer <jjreimer telus.net> writes:
Giles Constant wrote:
 ah.. now i'm getting results.. thanks :-)
 
 Quick question - how does one build it from source?  There don't appear to
 be any makefiles or anything.  I'd be interested in creating a gentoo
 package out of it.
 
So far as I know, Walter has released DMD Linux in binary form only (except for the front end?). I think a gentoo ebuild would be great too, but it would have to be a binary only package (which is completely feasible). A future Redhat RPM and Gentoo ebuild (and perhaps other distribution packages) would be a great form of publicity for the D language, I think. I really hope this happens soon. By the way, has anyone tried DMD Linux on FreeBSD yet (using the linux compatibility layer)? Later, John
May 21 2003
parent reply "Walter" <walter digitalmars.com> writes:
"John Reimer" <jjreimer telus.net> wrote in message
news:bag9mn$2lio$1 digitaldaemon.com...
 So far as I know, Walter has released DMD Linux in binary form only
 (except for the front end?).
That's correct.
 A future Redhat RPM and Gentoo ebuild (and perhaps other distribution
 packages) would be a great form of publicity for the D language, I
 think.  I really hope this happens soon.
I fully support the D community integrating D in with GCC!
 By the way, has anyone tried DMD Linux on FreeBSD yet (using the linux
 compatibility layer)?
Not yet that I know of.
May 22 2003
parent reply Mark T <Mark_member pathlink.com> writes:
In article <baj0m1$2e0e$1 digitaldaemon.com>, Walter says...
"John Reimer" <jjreimer telus.net> wrote in message
news:bag9mn$2lio$1 digitaldaemon.com...
 So far as I know, Walter has released DMD Linux in binary form only
 (except for the front end?).
That's correct.
 A future Redhat RPM and Gentoo ebuild (and perhaps other distribution
 packages) would be a great form of publicity for the D language, I
 think.  I really hope this happens soon.
I fully support the D community integrating D in with GCC!
I think he really met packaging up your binary etc as a RPM for ease of installation. RPM is one of the standard install techniques for Linux, it is separate from GCC etc. For an Alpha/Beta product I'm not sure if this is necessary, I found DMD linux to be very easy to get working. If someday in the future, you sell a commercial DMD Linux distribution you would really need to address this. I'm sure many of the smart folks in this forum would be glad to give their assistance with this.
May 23 2003
parent "Walter" <walter digitalmars.com> writes:
"Mark T" <Mark_member pathlink.com> wrote in message
news:baldfn$2lag$1 digitaldaemon.com...
 I think he really met packaging up your binary etc as a RPM for ease of
 installation.
 RPM is one of the standard install techniques for Linux, it is separate
from GCC
 etc.  For an Alpha/Beta product I'm not sure if this is necessary, I found
DMD
 linux to be very easy to get working.
 If someday in the future, you sell a commercial DMD Linux distribution you
would
 really need to address this. I'm sure many of the smart folks in this
forum
 would be glad to give their assistance with this.
Ok, I see.
May 23 2003