digitalmars.D.learn - Linker error under Ubuntu
- solidstate1991 (13/13) May 14 2020 When I try to compile my own project under Ubuntu with dub, I get
- evilrat (11/24) May 14 2020 Um, pardon the stupid question, but did you just forgot to link
- solidstate1991 (2/12) May 15 2020 Dub should do the linking by itself.
- evilrat (2/3) May 15 2020 How does it know what to link?
- kinke (7/16) May 15 2020 This sounds like a misconfigured distro-LDC. zlib is usually
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
May 14 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/pixelperfectengineUm, 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.
May 14 2020
On Friday, 15 May 2020 at 03:46:57 UTC, evilrat wrote: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.Dub should do the linking by itself.
May 15 2020
On Friday, 15 May 2020 at 23:49:37 UTC, solidstate1991 wrote:Dub should do the linking by itself.How does it know what to link?
May 15 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.This sounds like a misconfigured distro-LDC. zlib is usually integrated into libphobos, but distros tend to favor the distro's libz.so and patch it out. That must be handled in /etc/ldc2.conf though, with something like `-defaultlib=phobos2-ldc,z,druntime-ldc` (and possibly a zlib1g-dev package dependency).
May 15 2020