Package: an Version: 1.0-1 Severity: normal Tags: patch User: debian-...@lists.debian.org Usertags: ld-as-needed
an fails to build with LDFLAGS=-Wl,--as-needed http://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2 -D_REENTRANT -I/usr/include -D_BSD_SOURCE=1 -D_GNU_SOURCE=1 -c -o words.o words.c gcc -Wl,-z,relro -Wl,--as-needed -fPIE -pie -Wl,-z,relro -Wl,-z,now -ldl -lm -L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata -ldl -lm an.o bitfield.o malloc.o unicode.o words.o -o an an.o: In function `main': /build/an-JEOYyR/an-1.0/an.c:185: undefined reference to `u_strlen_48' /build/an-JEOYyR/an-1.0/an.c:188: undefined reference to `u_strlen_48' /build/an-JEOYyR/an-1.0/an.c:199: undefined reference to `u_strlen_48' bitfield.o: In function `make_bitfield': /build/an-JEOYyR/an-1.0/bitfield.c:31: undefined reference to `u_strlen_48' bitfield.o: In function `make_alphabet': /build/an-JEOYyR/an-1.0/bitfield.c:163: undefined reference to `u_strlen_48' /build/an-JEOYyR/an-1.0/bitfield.c:168: undefined reference to `u_strcpy_48' unicode.o: In function `utf8tointernal': /build/an-JEOYyR/an-1.0/unicode.c:61: undefined reference to `ucnv_toUChars_48' /build/an-JEOYyR/an-1.0/unicode.c:79: undefined reference to `unorm2_normalize_48' /build/an-JEOYyR/an-1.0/unicode.c:99: undefined reference to `u_isalpha_48' unicode.o: In function `initializeunicode': /build/an-JEOYyR/an-1.0/unicode.c:44: undefined reference to `unorm2_getInstance_48' /build/an-JEOYyR/an-1.0/unicode.c:39: undefined reference to `ucnv_open_48' unicode.o: In function `utf8tointernal': /build/an-JEOYyR/an-1.0/unicode.c:71: undefined reference to `u_errorName_48' /build/an-JEOYyR/an-1.0/unicode.c:90: undefined reference to `u_errorName_48' words.o: In function `add_word': /build/an-JEOYyR/an-1.0/words.c:83: undefined reference to `u_strlen_48' collect2: error: ld returned 1 exit status The attached patch should resolve the issue. SR
Description: Build with ld --as-needed icu-config includes libraries in --ldflags, but does provide a way to get at only the libraries. Author: Stefano Rivera <stefa...@debian.org> --- an-1.0.orig/Makefile +++ an-1.0/Makefile @@ -25,6 +25,7 @@ INSTALL:=install CFLAGS += $(shell icu-config --cflags) CPPFLAGS += $(shell icu-config --cppflags) -D_BSD_SOURCE=1 -D_GNU_SOURCE=1 LDFLAGS += $(shell icu-config --ldflags) +LIBS += $(shell icu-config --ldflags-libsonly) BIN=an MAN=an.6 @@ -37,6 +38,7 @@ all: $(BIN) $(OBJS): $(HEADERS) $(BIN): $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@ $(MAN):