Linker error under Ubuntu

evilrat evilrat666 at gmail.com
Fri May 15 03:46:57 UTC 2020


On Thursday, 14 May 2020 at 16:09:16 UTC, solidstate1991 wrote:
> When I try to compile my own project under Ubuntu with dub, I 
> get the following linker error:
>
> /usr/bin/ld: .dub/obj/pixelperfectengine_pixelperfecteditor.o: 
> undefined reference to symbol 'inflateEnd'
> //lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO 
> missing from command line
> collect2: error: ld returned 1 exit status
> Error: /usr/bin/gcc failed with status: 1
> /usr/bin/ldc2 failed with exit code 1.
>
> I've checked for zlib and it was already preinstalled. I tried 
> to install LLD, but that didn't help.
>
> The latest version of my project found here: 
> https://github.com/ZILtoid1991/pixelperfectengine

Um, pardon the stupid question, but did you just forgot to link 
it? I can't see a mention of it anywhere in both the old json and 
dub.sdl, and I don't see subpackages either. (does it links 
implicitly by the compiler?)

Also if it's digged up somewhere, another possibility is the link 
order issue(you need to put libs in order that adds linker 
symbols for previous libs to consume, for circular dependencies 
you can specify libs multiple times). The MS linker and LLVM 
linkers(not sure about GNU gold) does some work for you so you 
don't have to reorder libs most of the time.


More information about the Digitalmars-d-learn mailing list