From a11d16d8f5888aee56f129ddbd54c6130a881d2c Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 12 May 2013 16:42:30 +0200 Subject: [PATCH] build: make `make test` link against .a again Commit 3eb6eb3 links the .so with -Wl,-soname which breaks the `make test` target: run-tests is linked against (for example) libuv.so.0.11 while the actual file name is libuv.so. That's relatively easy to fix by getting creative with rpaths but it's even easier to fix by simply linking statically. It also means I no longer have to remember to set LD_BIND_NOW when profiling the benchmarks. --- build.mk | 4 ++-- config-unix.mk | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.mk b/build.mk index ee01de7d..5ff713e0 100644 --- a/build.mk +++ b/build.mk @@ -144,10 +144,10 @@ TESTS= \ all: libuv.a -run-tests$(E): test/run-tests.o test/runner.o $(RUNNER_SRC) $(TESTS) libuv.$(SOEXT) +run-tests$(E): test/run-tests.o test/runner.o $(RUNNER_SRC) $(TESTS) libuv.a $(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) -o $@ $^ $(RUNNER_LIBS) $(RUNNER_LDFLAGS) -run-benchmarks$(E): test/run-benchmarks.o test/runner.o $(RUNNER_SRC) $(BENCHMARKS) libuv.$(SOEXT) +run-benchmarks$(E): test/run-benchmarks.o test/runner.o $(RUNNER_SRC) $(BENCHMARKS) libuv.a $(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) -o $@ $^ $(RUNNER_LIBS) $(RUNNER_LDFLAGS) test/echo.o: test/echo.c test/echo.h diff --git a/config-unix.mk b/config-unix.mk index 90798760..10e8b6cb 100644 --- a/config-unix.mk +++ b/config-unix.mk @@ -29,7 +29,7 @@ CPPFLAGS += -D_FILE_OFFSET_BITS=64 RUNNER_SRC=test/runner-unix.c RUNNER_CFLAGS=$(CFLAGS) -I$(SRCDIR)/test -RUNNER_LDFLAGS=-L"$(CURDIR)" -luv -Xlinker -rpath -Xlinker "$(CURDIR)" +RUNNER_LDFLAGS=-L"$(CURDIR)" -luv HAVE_DTRACE= DTRACE_OBJS= @@ -64,7 +64,6 @@ HAVE_DTRACE=1 CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 LDFLAGS+=-lkstat -lnsl -lsendfile -lsocket # Library dependencies are not transitive. -RUNNER_LDFLAGS += $(LDFLAGS) OBJS += src/unix/sunos.o OBJS += src/unix/dtrace.o DTRACE_OBJS += src/unix/core.o @@ -87,8 +86,7 @@ endif CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1 LDFLAGS += -framework Foundation \ -framework CoreServices \ - -framework ApplicationServices \ - -dynamiclib -install_name "@rpath/libuv.dylib" + -framework ApplicationServices SOEXT = dylib OBJS += src/unix/darwin.o OBJS += src/unix/kqueue.o @@ -156,6 +154,8 @@ ifneq (darwin,$(PLATFORM)) LDFLAGS += -Wl,-soname,libuv.so.0.10 endif +RUNNER_LDFLAGS += $(LDFLAGS) + libuv.a: $(OBJS) $(AR) rcs $@ $^