From bb487d0f54c5a7256109685cc6c878054484d31f Mon Sep 17 00:00:00 2001 From: Kornel Date: Mon, 11 Sep 2023 00:13:05 +0100 Subject: [PATCH] Warn about additional libraries needed for static linking #111 --- imagequant-sys/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/imagequant-sys/Makefile b/imagequant-sys/Makefile index 115a43d..23d1455 100644 --- a/imagequant-sys/Makefile +++ b/imagequant-sys/Makefile @@ -27,6 +27,7 @@ $(STATICLIB): Cargo.toml cp ../target/release/libimagequant_sys.a $(STATICLIB) $(JNILIB): $(JAVAHEADERS) $(STATICLIB) org/pngquant/PngQuant.c + # You may need to set LDFLAGS env var. See: cargo rustc -- --print native-static-libs $(CC) -g $(CFLAGS) $(LDFLAGS) $(JAVAINCLUDE) -shared -o $@ org/pngquant/PngQuant.c $(STATICLIB) $(JAVACLASSES): %.class: %.java @@ -36,7 +37,10 @@ $(JAVAHEADERS): %.h: %.class javah -o $@ $(subst /,., $(patsubst %.class,%,$<)) && touch $@ example: example.c lodepng.h lodepng.c $(STATICLIB) - $(CC) -g $(CFLAGS) -Wall example.c $(STATICLIB) -lm -o example + # remove -lpthread on Windows + # add -ldl on Linux + # You may need to set LDFLAGS env var. See: cargo rustc -- --print native-static-libs + $(CC) -g $(CFLAGS) -Wall example.c $(STATICLIB) -lm -lpthread $(LDFLAGS) -o example lodepng.h: curl -o lodepng.h -L https://raw.githubusercontent.com/lvandeve/lodepng/master/lodepng.h