Thread overview
Link failed release-0.11.0 - FreeBSD x64
Jul 07, 2013
Sumit Raja
Jul 07, 2013
Kai Nacke
Jul 08, 2013
Sumit Raja
Jul 10, 2013
Kai Nacke
Jul 10, 2013
Sumit Raja
Jul 11, 2013
Sumit Raja
July 07, 2013
Linking CXX executable bin/ldc2
lib/libldc.so: undefined reference to `HtmlNamedEntity(unsigned char*, int)'
lib/libldc.so: undefined reference to `memicmp(char const*, char const*, int)'

FreeBSD pcbsd-8352 9.1-RELEASE-p4 FreeBSD 9.1-RELEASE-p4

FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
Target: x86_64-unknown-freebsd9.0

LLVm - 3.2

Makefile references port.c.o correctly. Any ideas?

Thanks

Sumit
July 07, 2013
On Sunday, 7 July 2013 at 10:41:42 UTC, Sumit Raja wrote:
> Linking CXX executable bin/ldc2
> lib/libldc.so: undefined reference to `HtmlNamedEntity(unsigned char*, int)'
> lib/libldc.so: undefined reference to `memicmp(char const*, char const*, int)'
>
> FreeBSD pcbsd-8352 9.1-RELEASE-p4 FreeBSD 9.1-RELEASE-p4
>
> FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
> Target: x86_64-unknown-freebsd9.0
>
> LLVm - 3.2
>
> Makefile references port.c.o correctly. Any ideas?
>
> Thanks
>
> Sumit

Hi Sumit!

I really have no idea what's going on here.

memicmp() should not be called on FreeBSD. Instead an implementation is provided in dmd/root.c, line 793.

HtmlNamedEntity is defined in dmd2/entity.c. It looks like the entire file is missing.

How do you compile ldc?

Regards
Kai
July 08, 2013
On Sunday, 7 July 2013 at 12:47:01 UTC, Kai Nacke wrote:
>
> How do you compile ldc?

Stupidly it would appear. Had cmake trying to build shared. All good now, sorry about the noise

- Sumit

July 10, 2013
On Monday, 8 July 2013 at 22:04:32 UTC, Sumit Raja wrote:
> On Sunday, 7 July 2013 at 12:47:01 UTC, Kai Nacke wrote:
>>
>> How do you compile ldc?
>
> Stupidly it would appear. Had cmake trying to build shared. All good now, sorry about the noise
>
> - Sumit

Yeah, shared libs do not work yet.

Kai
July 10, 2013
On Wednesday, 10 July 2013 at 05:27:40 UTC, Kai Nacke wrote:
>
> Yeah, shared libs do not work yet.
>
> Kai

Made more progress with the build and install but now I am seeing issues with linking libphobos.

import std.stdio;

void main() {
writeln("hello");
}


Fails to link on FreeBSD with

/usr/local/lib/libphobos-ldc.a(runtime.o): In function `_D4core7runtime19defaultTraceHandlerFPvZC6object9Throwable9TraceInfo':
/usr/home/mediabag/ldc/runtime/druntime/src/core/runtime.d:(.text+0x2d0): undefined reference to `_D4core3sys7freebsd8execinfo17backtrace_symbolsFPxPviZPPa'
/usr/local/lib/libphobos-ldc.a(runtime.o): In function `_D4core7runtime18runModuleUnitTestsUZb19unittestSegvHandlerUiPS4core3sys5posix6signal9siginfo_tPvZv':
/usr/home/mediabag/ldc/runtime/druntime/src/core/runtime.d:(.text+0x314): undefined reference to `_D4core3sys7freebsd8execinfo9backtraceFPPviZi'
/usr/home/mediabag/ldc/runtime/druntime/src/core/runtime.d:(.text+0x323): undefined reference to `_D4core3sys7freebsd8execinfo20backtrace_symbols_fdFPxPviiZv'
/usr/local/lib/libphobos-ldc.a(runtime.o): In function `_D4core7runtime19defaultTraceHandlerFPvZC6object9Throwable9TraceInfo16DefaultTraceInfo6__ctorMFZC4core7runtime19defaultTraceHandlerFPvZC6object9Throwable9TraceInfo16DefaultTraceInfo':
/usr/home/mediabag/ldc/runtime/druntime/src/core/runtime.d:(.text+0x6fd): undefined reference to `_D4core3sys7freebsd8execinfo17backtrace_symbolsFPxPviZPPa'
/usr/local/lib/libphobos-ldc.a(runtime.o):(.data+0xb8): undefined reference to `_D4core3sys7freebsd8execinfo8__ModuleZ'
Error: /usr/bin/gcc failed with status: 1


nm /usr/local/lib/libphobos-ldc.a | grep "backtrace_symbols"

U _D4core3sys7freebsd8execinfo17backtrace_symbolsFPxPviZPPa
U _D4core3sys7freebsd8execinfo20backtrace_symbols_fdFPxPviiZv

I see it here:
execinfo.d:42:extern (D) char** backtrace_symbols(const(void*)* buffer, int size)

Has druntime linked correctly in the phobos build? Would really like some guidance on how to debug this further.

Thanks

Sumit


July 11, 2013
On Wednesday, 10 July 2013 at 22:02:51 UTC, Sumit Raja wrote:
> Has druntime linked correctly in the phobos build? Would really like some guidance on how to debug this further.

That should read "would really appreciate some guidance on how to debug this further" ;-).

Early mornings eh...