Thread overview
std.container.array linker error on OS X
Sep 09, 2014
Etienne
Sep 09, 2014
Etienne
Sep 09, 2014
Etienne
Sep 09, 2014
Etienne
September 09, 2014
Hello,

Can anyone help me? Maybe someone has seen this before. I'm getting a (strange) error when testing on OSX with dmd 2.066, the build works with the same compiler/library versions on linux x64 and windows x86 but for some reason it's not working here.

The repos are:

https://github.com/etcimon/event.d
https://github.com/etcimon/vibe.d

Both repos must be cloned in the same directory, and I use `dub run` in `vibe.d/examples/http_server`

Thanks in advance

Here's the error:

Linking...
Undefined symbols for architecture x86_64:
"_D3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range7opSliceMFZS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range", referenced from:
_D4vibe4core7drivers6native17NativeManualEvent6__dtorMFZv in libvibe-d.a(native_31a0_6c7.o)
_D4vibe4core7drivers6native17NativeManualEvent4emitMFZv in libvibe-d.a(native_31a0_6c7.o)
"_D3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range7opSliceMFmmZS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range", referenced from:
_D3std9algorithm157__T4copyTS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5RangeTS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5RangeZ4copyFS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5RangeS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5RangeZ11genericImplFS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5RangeS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5RangeZS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range in libvibe-d.a(algorithm_f43_653.o)
"_D3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array7opSliceMFZS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range", referenced from:
_D4vibe4core7drivers6native17NativeManualEvent6__dtorMFZv in libvibe-d.a(native_31a0_6c7.o)
_D4vibe4core7drivers6native17NativeManualEvent4emitMFZv in libvibe-d.a(native_31a0_6c7.o)
_D4vibe4core7drivers6native17NativeManualEvent14removeMySignalMFZv in libvibe-d.a(native_31a0_6c7.o)
"_D3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array7opSliceMFmmZS3std9container5array38__T5ArrayTC5event6signal11AsyncSignalZ5Array5Range", referenced from:
_D4vibe4core7drivers6native17NativeManualEvent14removeMySignalMFZv in libvibe-d.a(native_31a0_6c7.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- errorlevel 1
FAIL .dub/build/application-debug-posix.osx-x86_64-dmd-8B9608AA5A28F1D92DA07A70A9BFD1B2/ http-server-example executable
September 09, 2014
I have to specify that AsyncSignal is defined as a "final shared class", and the array is defined as a Array!AsyncSignal

I'm not sure if the compiler on OSX could act different and add the shared symbols there?
September 09, 2014
On 2014-09-09 3:58 PM, Etienne wrote:
> I have to specify that AsyncSignal is defined as a "final shared class",
> and the array is defined as a Array!AsyncSignal
>
> I'm not sure if the compiler on OSX could act different and add the
> shared symbols there?

Meh, I answered my own question. Substituting it from Array!AsyncSignal to Array!(void*) and casting away worked. Looks like dmd-osx has templating problems with shared declarations.
September 09, 2014
On 2014-09-09 4:11 PM, Etienne wrote:
> On 2014-09-09 3:58 PM, Etienne wrote:
>> I have to specify that AsyncSignal is defined as a "final shared class",
>> and the array is defined as a Array!AsyncSignal
>>
>> I'm not sure if the compiler on OSX could act different and add the
>> shared symbols there?
>
> Meh, I answered my own question. Substituting it from Array!AsyncSignal
> to Array!(void*) and casting away worked. Looks like dmd-osx has
> templating problems with shared declarations.

I really had to Think Different on that one.