I tried to start using D with ldc and got a link error on osx 64 bit

17 views
Skip to first unread message

skenizen

unread,
Oct 19, 2012, 2:18:49 PM10/19/12
to ldc...@googlegroups.com
  1. Hello, I'm finally starting to code with D and as I wish to target sooner or later ARM platform I want to use llvm directly. So I compiled it yesterday on OSX Snow Leopard 64bit and got this problem while trying to compile the helloworld :

    test.d hello world :
    import std.stdio;
     
    void main()
    {
      writeln("Hello World!");
    }

    ldc2 test.d
  2. Undefined symbols for architecture x86_64:
  3.   "__tlv_bootstrap", referenced from:
  4.       __D2rt8lifetime18__blkcache_storagePS2rt8lifetime7BlkInfo in libphobos-ldc.a(lifetime.o)
  5.       __D2rt8lifetime12__nextBlkIdxi in libphobos-ldc.a(lifetime.o)
  6.       __D3ldc2eh10__inflightPS3ldc2eh8InFlight in libphobos-ldc.a(eh.o)
  7.       __D3ldc2eh18_d_exception_classG8a in libphobos-ldc.a(eh.o)
  8.       __D3ldc2eh18eh_exception_regnoi in libphobos-ldc.a(eh.o)
  9.       __D3ldc2eh17eh_selector_regnoi in libphobos-ldc.a(eh.o)
  10.       __D3ldc6memory9dataStartPv in libphobos-ldc.a(memory.o)
  11.       ...
  12. ld: symbol(s) not found for architecture x86_64
  13. collect2: ld returned 1 exit status
  14. Error: /usr/bin/gcc failed with status: 1

    I guess that I have a link problem with phobos, but as phobos was compiled during the build of ldc, I would expect it to work. Do I have to add additionnal arguments for linking my program with phobos ? So basically here, my question would be what should I do for correcting this problem ?

David Nadlinger

unread,
Oct 21, 2012, 4:16:10 PM10/21/12
to ldc...@googlegroups.com
Hi,

I cannot reproduce the problem on my OS X box, everything works
smoothly after running »make install«. I'm running OS X 10.7.5 with
Xcode 4.4.1, with LDC built against LLVM 3.1 compiled from sources
(using ./configure). "gcc" is "i686-apple-darwin11-llvm-gcc-4.2". What
is your environment?

The strange thing is that as far as I know, _tlv_bootstrap is just a
»marker« symbol picked up by the toolchain for programs which use TLS.
There should be no need to link to anything manually to get its
definition.

On a general note, GDC seems to be a bit further than LDC right now
w.r.t. ARM support. I definitely plan to look into it in the near
future, but getting a solid x86/x86_64 release out is the top priority
right now.

David
> --
>
>
Reply all
Reply to author
Forward
0 new messages