On Friday, September 16, 2011 12:47 Kiith-Sa wrote:
> I've just installed a new system - Ubuntu 11.10 beta x64 and can't get
> dmd/phobos 2.055 to work.
> 
> When I try to compile file hello.d with the following content:
> 
> import std.stdio;
> 
> void main()
> {
> writeln("Hello World!");
> }
> 
> 
> I get this error:
> 
> /usr/lib/gcc/x86_64-linux-
> gnu/4.6.1/../../../../lib/libphobos2.a(datetime_48b_1ec.o): In function
> `_D3std8datetime5Clock11currStdTimeFNdNeZl':
> std/datetime.d:(.text._D3std8datetime5Clock11currStdTimeFNdNeZl+0x1d):
> undefined reference to `clock_gettime'
> /usr/lib/gcc/x86_64-linux-
> gnu/4.6.1/../../../../lib/libphobos2.a(time_c0_4d1.o): In function
> `_D4core4time12TickDuration12_staticCtor7OFNeZv':
> src/core/time.d:(.text._D4core4time12TickDuration12_staticCtor7OFNeZv+0x1f)
> : undefined reference to `clock_getres'
> /usr/lib/gcc/x86_64-linux-
> gnu/4.6.1/../../../../lib/libphobos2.a(time_c0_4d1.o): In function
> `_D4core4time12TickDuration14currSystemTickFNdNeZS4core4time12TickDuration'
> : src/core/time.d:
> (.text._D4core4time12TickDuration14currSystemTickFNdNeZS4core4time12TickDur
> ation+0x1f): undefined reference to `clock_gettime'
> collect2: ld returned 1 exit status
> --- errorlevel 1
> 
> 
> Nothing else using Phobos compiles either.
> 
> I've seen previous related threads. Tried -L-lrt, didn't work.
> I tried the .deb package for Ubuntu, the binaries shipped
> in the source archive, as well as compiling Phobos myself (removing
> DMD/Phobos every time to make sure no files persisted), but nothing helped.
> 
> 
> Has anyone encountered this problem? Did anyone get it to work on Ubuntu
> (especially 11.10)?

It's clearly an issue where it can't find librt, since clock_gettime is in 
librt. As long as you didn't mess with dmd.conf, -L-lrt should already be 
given to the compiler, but regardless, if you passed it yourself, it should 
work.

Are you using a 64-bit binary of dmd or a 32-bit binary? If you're using a 32-
bit binary (or building for 32-bit with a 64-bit binary), then you're going to 
need the 32-bit libraries for glibc, pthreads, and librt (I don't know what 
packages those are on Ubuntu, but if you have the 32-bit libraries installed 
at all, odds are that those ones are there).

- Jonathan M Davis

Reply via email to