This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Append system library paths to environment for testprograms


Hi,

A bunch of tests fail on my system due to not being able to find some
libraries (libgcc_s.so, libstdc++.so). I found that this is because I
have a 64-bit Fedora install, which puts these libraries in /lib64
and /usr/lib64 instead of the usual /lib and /usr/lib. The current
--library-path for ld.so in the test cases ends up including only the
libraries in the build and those that may have been mentioned in
LDFLAGS.

To fix these tests on my box, I have written a small fix to Makeconfig
that appends search paths used by gcc (if we are using gcc) to the
--library-path of the dynamic linker command that invokes the tests.

I have verified that the libc libraries being tested are not being
overridden by the default paths. An example of a test that fails with
this is dlfcn/bug-atexit3.c. There are many more similar tests that
fail without this fix:

./nptl/tst-cancelx20:
./nptl/tst-cancelx12:
./nptl/tst-cancelx5:
./nptl/tst-cleanupx3:
./nptl/tst-cancelx18:
./nptl/tst-cancelx11:
./nptl/tst-oncex3:
./nptl/tst-cancelx9:
./nptl/tst-cleanupx1:
./nptl/tst-oncex4:
./nptl/tst-cancelx8:
./nptl/tst-cancelx17:
./nptl/tst-cancelx15:
./nptl/tst-cancelx16:
./nptl/tst-cancelx4:
./nptl/tst-cleanupx4:
./nptl/tst-cancel24:
./nptl/tst-cleanupx0:
./nptl/tst-cancelx21:
./nptl/tst-cancelx13:
./nptl/tst-cancelx10:
./nptl/tst-cancelx14:
./rt/tst-mqueue8x:

Regards,
Siddhesh

ChangeLog:

2012-04-02  Siddhesh Poyarekar  <siddhesh@redhat.com>

	* Makeconfig: Add paths searched by gcc to --library-path of
	dynamic linker when running built programs from within the
	search directory.
diff --git a/Makeconfig b/Makeconfig
index 4fc1141..ecb9f4c 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -559,10 +559,17 @@ elf-objpfx = $(common-objpfx)elf/
 built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
 ifeq (yes,$(build-shared))
 comma = ,
-sysdep-library-path = \
+sysdep-library-path := \
 $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
 				       $(filter -Wl$(comma)-rpath-link=%,\
 						$(sysdep-LDFLAGS)))))
+# Also add search directories that gcc searched to build programs.
+# This is useful for test cases that link against libstdc++ and/or libgcc_s
+ifeq ($(CC),gcc)
+gcc-search-path = $(shell gcc --print-search-dirs | grep libraries | cut -d '=' -f 2)
+sysdep-library-path := $(sysdep-library-path):$(gcc-search-path)
+endif
+
 run-program-prefix = $(if $(filter $(notdir $(built-program-file)),\
 				   $(tests-static) $(xtests-static)),, \
 			  $(elf-objpfx)$(rtld-installed-name) \
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]