Thread overview |
---|
April 26, 2019 DLL creation fails with undefined symbol error | ||||
---|---|---|---|---|
| ||||
I tried to build a DLL in a Windows 64bit environment. It works well if the compiler is DMD, but in the case of LDC, the build fails with a large number of undefined symbol errors. Is this a DUB or LDC bug? Or do I have to specify some additional arguments to the command? |
April 26, 2019 Re: DLL creation fails with undefined symbol error | ||||
---|---|---|---|---|
| ||||
Posted in reply to dokutoku | On Friday, 26 April 2019 at 05:08:32 UTC, dokutoku wrote:
> I tried to build a DLL in a Windows 64bit environment.
> It works well if the compiler is DMD, but in the case of LDC, the build fails with a large number of undefined symbol errors.
>
> Is this a DUB or LDC bug?
> Or do I have to specify some additional arguments to the command?
Seems like DMD links some system and/or runtime libs for you, while LDC doesn't.
What symbols are missing? It could be just msvcrt and some of the default system libs such as system32 and the like.
|
April 26, 2019 Re: DLL creation fails with undefined symbol error | ||||
---|---|---|---|---|
| ||||
Posted in reply to evilrat | On Friday, 26 April 2019 at 12:37:46 UTC, evilrat wrote: > On Friday, 26 April 2019 at 05:08:32 UTC, dokutoku wrote: >> I tried to build a DLL in a Windows 64bit environment. >> It works well if the compiler is DMD, but in the case of LDC, the build fails with a large number of undefined symbol errors. >> >> Is this a DUB or LDC bug? >> Or do I have to specify some additional arguments to the command? > > Seems like DMD links some system and/or runtime libs for you, while LDC doesn't. > > What symbols are missing? It could be just msvcrt and some of the default system libs such as system32 and the like. There was an error like this. ``` Performing "debug" build using C:\ldc\bin\ldc2.exe for x86_64. test ~master: building configuration "library"... lld-link: error: <root : undefined symbol: _DllMainCRTStartup lld-link: error: undefined symbol: strlen referenced by druntime-ldc.lib(exception.obj):(_d_assertp) referenced by druntime-ldc.lib(exception.obj):(_d_unittestp) referenced by druntime-ldc.lib(exception.obj):(_d_arrayboundsp) lld-link: error: undefined symbol: __acrt_iob_func referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) lld-link: error: undefined symbol: __stdio_common_vfwprintf referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) lld-link: error: undefined symbol: __stdio_common_vfwscanf referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) lld-link: error: undefined symbol: __stdio_common_vswprintf referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN5) lld-link: error: undefined symbol: __stdio_common_vswscanf referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) lld-link: error: undefined symbol: __stdio_common_vfprintf referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) lld-link: error: undefined symbol: __stdio_common_vfscanf referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) lld-link: error: undefined symbol: __stdio_common_vsprintf referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN5) referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN5) lld-link: error: undefined symbol: __stdio_common_vsscanf referenced by legacy_stdio_definitions.lib(legacy_stdio_definitions.obj):($LN3) lld-link: error: undefined symbol: strlen referenced by druntime-ldc.lib(object.obj):(_D6object10ModuleInfo4nameMxFNaNbNdNiZAya) lld-link: error: undefined symbol: malloc referenced by druntime-ldc.lib(lifetime.obj):(_d_newclass) referenced by druntime-ldc.lib(lifetime.obj):(_D2rt8lifetime__T11_d_newclassVbi1ZQsFNbxC14TypeInfo_ClassZC6Object) referenced by druntime-ldc.lib(lifetime.obj):(_d_allocclass) referenced by druntime-ldc.lib(lifetime.obj):(_D2rt8lifetime__T11_d_newclassVbi0ZQsFNbxC14TypeInfo_ClassZC6Object) referenced by druntime-ldc.lib(lifetime.obj):(_D2rt8lifetime10__blkcacheFNbNdZPS4core6memory8BlkInfo_) referenced by druntime-ldc.lib(lifetime.obj):(_D2rt8lifetime12__getBlkInfoFNbPvZPS4core6memory8BlkInfo_) referenced by druntime-ldc.lib(lifetime.obj):(_D2rt8lifetime20__insertBlkInfoCacheFNbS4core6memory8BlkInfo_PQxZv) referenced by druntime-ldc.lib(lifetime.obj):(_d_arrayshrinkfit) referenced by druntime-ldc.lib(lifetime.obj):(_d_arrayshrinkfit) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetcapacity) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetcapacity) referenced by druntime-ldc.lib(lifetime.obj):(_d_delarray_t) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetlengthT) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetlengthT) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetlengthT) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetlengthT) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetlengthT) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetlengthT) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetlengthiT) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetlengthiT) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetlengthiT) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetlengthiT) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetlengthiT) referenced by druntime-ldc.lib(lifetime.obj):(_d_arraysetlengthiT) referenced by druntime-ldc.lib(lifetime.obj):(_d_arrayappendcTX) referenced by druntime-ldc.lib(lifetime.obj):(_d_arrayappendcTX) referenced by druntime-ldc.lib(lifetime.obj):(_d_arrayappendcTX) referenced by druntime-ldc.lib(lifetime.obj):(_d_arrayappendcTX) referenced by druntime-ldc.lib(lifetime.obj):(_d_arrayappendcTX) lld-link: error: undefined symbol: free referenced by druntime-ldc.lib(lifetime.obj):(_D2rt8lifetime19_staticDtor_L532_C1FZv) lld-link: error: undefined symbol: fwrite referenced by druntime-ldc.lib(eh_msvc.obj):(fatalerror) lld-link: error: undefined symbol: fputc referenced by druntime-ldc.lib(eh_msvc.obj):(fatalerror) lld-link: error: undefined symbol: abort referenced by druntime-ldc.lib(eh_msvc.obj):(fatalerror) lld-link: error: undefined symbol: set_terminate referenced by druntime-ldc.lib(eh_msvc.obj):(_d_throw_exception) lld-link: error: undefined symbol: free referenced by druntime-ldc.lib(eh_msvc.obj):(_d_throw_exception) referenced by druntime-ldc.lib(eh_msvc.obj):(_D3ldc7eh_msvc14ExceptionStack4pushMFNbC6object9ThrowableZv) referenced by druntime-ldc.lib(eh_msvc.obj):(_D3ldc7eh_msvc14ExceptionStack6__dtorMFNbZv) referenced by druntime-ldc.lib(eh_msvc.obj):(_D3ldc7eh_msvc14ExceptionStack4growMFNbZv) referenced by druntime-ldc.lib(eh_msvc.obj):(_D3ldc7eh_msvc14ExceptionStack8opAssignMFNbNcNjSQBuQBtQBoZQl) referenced by druntime-ldc.lib(eh_msvc.obj):(_D3ldc7eh_msvc12FiberContext11__fieldDtorMFNbZv) referenced by druntime-ldc.lib(eh_msvc.obj):(_D3ldc7eh_msvc12FiberContext8opAssignMFNbNcNjSQBsQBrQBmZQl) referenced by druntime-ldc.lib(eh_msvc.obj):(_d_eh_swapContext) referenced by druntime-ldc.lib(eh_msvc.obj):(_D3ldc7eh_msvc19_staticDtor_L552_C1FZv) lld-link: error: undefined symbol: malloc referenced by druntime-ldc.lib(threadaux.obj):(_D4core3sys7windows9threadaux10thread_aux18enumProcessThreadsFkPFkPvZbQeZb) referenced by druntime-ldc.lib(threadaux.obj):(_D4core3sys7windows9threadaux10thread_aux18enumProcessThreadsFkPFkPvZbQeZb) lld-link: error: too many errors emitted, stopping now (use /errorlimit:0 to see all errors) Error: linking with LLD failed C:\ldc\bin\ldc2.exe failed with exit code 1. ``` |
April 27, 2019 Re: DLL creation fails with undefined symbol error | ||||
---|---|---|---|---|
| ||||
Posted in reply to dokutoku | On Friday, 26 April 2019 at 14:20:24 UTC, dokutoku wrote:
>
> Error: linking with LLD failed
> C:\ldc\bin\ldc2.exe failed with exit code 1.
>
Ok, I have Visual Studio and SDKs installed so it works for me without touching anything else.
In your case it is using lld linker instead, and I have no idea what libs it requires.
|
April 29, 2019 Re: DLL creation fails with undefined symbol error | ||||
---|---|---|---|---|
| ||||
Posted in reply to dokutoku | fwrite, fputc - that's missing C library. |
May 11, 2019 Re: DLL creation fails with undefined symbol error | ||||
---|---|---|---|---|
| ||||
Posted in reply to dokutoku | On Friday, 26 April 2019 at 05:08:32 UTC, dokutoku wrote: > Is this a DUB or LDC bug? It's a combination of at least 3 small bugs in the MinGW-w64 based libraries and should be fixed by https://github.com/ldc-developers/ldc/pull/3071. |
Copyright © 1999-2021 by the D Language Foundation