Skip to content

Commit

Permalink
Warn about additional libraries needed for static linking
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Sep 10, 2023
1 parent b3f3e80 commit bb487d0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion imagequant-sys/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit bb487d0

Please sign in to comment.