undefined reference to 'deflateEnd'

Andre Pany andre at s-e-a-p.de
Mon May 18 05:01:45 UTC 2020


Hi,

I have some issues, the get this program working on ubuntu:

``` Dockerfile
FROM ubuntu:focal

RUN apt-get update && apt-get upgrade -y \
     && apt-get install --no-install-recommends -y build-essential 
ldc dub zlib1g-dev

COPY app.d /tmp/
RUN dub build --single /tmp/app.d -v
```

``` app.d
/+ dub.sdl:
     name "app"
     lflags "-lz" "-ldl"
     dflags "-static"
+/
import std;
void main(){}
```

Linker fails with error messages like these:
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libphobos2-ldc.a(zlib.o):function _D3std4zlib8Compress5errorMFiZv: error: undefined reference to 'deflateEnd'
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libphobos2-ldc.a(zlib.o):function _D3std4zlib8Compress6__dtorMFZv: error: undefined reference to 'deflateEnd'

The actual link command looks right:
/usr/bin/ldc2 
-oftmp/.dub/build/application-debug-linux.posix-x86_64-ldc_2090-ED4668B88284A40FA4668246697CB2B5/app tmp/.dub/build/application-debug-linux.posix-x86_64-ldc_2090-ED4668B88284A40FA4668246697CB2B5/app.o -L--no-as-needed -L-lz -L-ldl -static -g

Do you have an idea?

Kind regards
André


More information about the Digitalmars-d-learn mailing list