March 24, 2012
Hi:

I found that SCons now supports D, but when I tried to build a helloworld program, error occurred: "undefined reference to `clock_gettime'".

It seemed that adding -lrt after -lphobos2 would do the job, so I tried to add this in SConstruct:

  env = Environment()
  env.Append(LIBS = 'rt')
  env.Program('helloworld.d')

But when it build and links, I got this line

  gcc -o hello -m32 hello.o -L/usr/lib -lrt -lphobos2 -lpthread -lm

-lrt was not Appended to the right, but went before -lphobos2, which did not solve the problem.

So my question is, what can I do to tell Scons to run this linking?

  gcc -o hello -m32 hello.o -L/usr/lib  -lphobos2 -lpthread -lm -lrt

Or is -lrt not the solution?