Commit d3080ad4 authored by Vincent Pelletier's avatar Vincent Pelletier

Fix linker errors.

Build failure reported on kubuntu 14.04:
$ make
cc  -O2 -s -Wall -fPIE -pie  -ldl -o userhosts userhosts.c
/tmp/ccVLIqoI.o: In function `dlsym_or_abort.part.0':
userhosts.c:(.text.startup+0x5): undefined reference to `dlerror'
/tmp/ccVLIqoI.o: In function `init':
userhosts.c:(.text.startup+0x42): undefined reference to `dlerror'
userhosts.c:(.text.startup+0x55): undefined reference to `dlsym'
userhosts.c:(.text.startup+0x69): undefined reference to `dlerror'
userhosts.c:(.text.startup+0x7c): undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make: *** [userhosts] Error 1

Fix's rationale seems to be provide -ldl *after* symbol need becomes known,
so after source code is provided & built.
parent 78df5c62
...@@ -8,7 +8,7 @@ PREFIX = /usr/local ...@@ -8,7 +8,7 @@ PREFIX = /usr/local
all: userhosts all: userhosts
userhosts: userhosts.c userhosts: userhosts.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ $< $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
install: all install: all
install -Dp userhosts $(DESTDIR)$(PREFIX)/bin/userhosts install -Dp userhosts $(DESTDIR)$(PREFIX)/bin/userhosts
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment