1 From a2076079a409141704701ec17a205d89e5b24052 Mon Sep 17 00:00:00 2001
2 From: Romain Naour <romain.naour@gmail.com>
3 Date: Sat, 28 May 2016 20:45:02 +0200
4 Subject: [PATCH] Makefile: fix static linking issue with lintl
6 When net-tools are build with uClibc-ng and statically linked,
7 some tools like hostname and route needs to link with -lintl.
9 Adding -lintl in LDFLAGS place the library before object files:
10 arm-linux-gcc -O2 -g -Wall -fno-strict-aliasing -static -lintl -Llib -o hostname hostname.o
12 Add $(LIBS) after object files in the Makefile to place -lintl correctly.
15 http://autobuild.buildroot.net/results/134/1345b6d366125320b89512e7ce7f142f1a03acf8
18 http://lists.busybox.net/pipermail/buildroot/2016-May/162216.html
20 Signed-off-by: Romain Naour <romain.naour@gmail.com>
22 Makefile | 20 ++++++++++----------
23 1 file changed, 10 insertions(+), 10 deletions(-)
25 diff --git a/Makefile b/Makefile
26 index 171123d..a2baf79 100644
29 @@ -158,37 +158,37 @@ subdirs: libdir
30 @for i in $(SUBDIRS:$(NET_LIB_PATH)/=); do $(MAKE) -C $$i || exit $$? ; done
32 ifconfig: $(NET_LIB) ifconfig.o
33 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ifconfig.o $(NLIB)
34 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ifconfig.o $(LIBS) $(NLIB)
36 nameif: $(NET_LIB) nameif.o
37 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ nameif.o $(NLIB)
40 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ hostname.o $(DNLIB)
41 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ hostname.o $(LIBS) $(DNLIB)
43 route: $(NET_LIB) route.o
44 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ route.o $(NLIB)
45 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ route.o $(LIBS) $(NLIB)
48 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ arp.o $(NLIB)
49 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ arp.o $(LIBS) $(NLIB)
51 rarp: $(NET_LIB) rarp.o
52 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ rarp.o $(NLIB)
53 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ rarp.o $(LIBS) $(NLIB)
55 slattach: $(NET_LIB) slattach.o
56 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ slattach.o $(NLIB)
57 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ slattach.o $(LIBS) $(NLIB)
59 plipconfig: $(NET_LIB) plipconfig.o
60 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ plipconfig.o $(NLIB)
61 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ plipconfig.o $(LIBS) $(NLIB)
63 netstat: $(NET_LIB) netstat.o statistics.o
64 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ netstat.o statistics.o $(NLIB) $(SELIB)
65 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ netstat.o statistics.o $(LIBS) $(NLIB) $(SELIB)
67 iptunnel: $(NET_LIB) iptunnel.o
68 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ iptunnel.o $(NLIB)
69 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ iptunnel.o $(LIBS) $(NLIB)
71 ipmaddr: $(NET_LIB) ipmaddr.o
72 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ipmaddr.o $(NLIB)
73 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ipmaddr.o $(LIBS) $(NLIB)
75 mii-tool: $(NET_LIB) mii-tool.o
76 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mii-tool.o $(NLIB)