On Monday, 18 May 2020 at 05:01:45 UTC, Andre Pany wrote:
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é
NAME="Ubuntu"
VERSION="18.04.4 LTS (Bionic Beaver)"
Works for me on ubuntu when changed dflags to lflags:
/+ dub.sdl:
name "app"
lflags "-lz" "-ldl"
lflags "-static"
+/
import std;
void main(){}
/usr/bin/dmd -c
-of.dub/build/application-debug-linux.posix-x86_64-dmd_2089-1D31FAC5109A6D2373EAB3139BEB0877/app.o -debug -g -w -version=Have_app t.d -vcolumns
Linking...
/usr/bin/dmd
-of.dub/build/application-debug-linux.posix-x86_64-dmd_2089-1D31FAC5109A6D2373EAB3139BEB0877/app .dub/build/application-debug-linux.posix-x86_64-dmd_2089-1D31FAC5109A6D2373EAB3139BEB0877/app.o -L--no-as-needed -L-lz -L-ldl -L-static -g
Copying target from
/tmp/test/.dub/build/application-debug-linux.posix-x86_64-dmd_2089-1D31FAC5109A6D2373EAB3139BEB0877/app to /tmp/test
Running ./app