Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libpng-config should filter out -L/usr/lib (or -L/usr/lib64) #206

lemzwerg opened this issue Feb 10, 2018 · 0 comments


None yet
1 participant
Copy link

commented Feb 10, 2018

Calling libpng-config --ldflags unconditionally emits -Lxxx, which is problematic. Consider a standard Unix installation with libraries in /usr/lib (or /usr/lib64), and local packages in /usr/local/lib (or /usr/local/lib64). It is quite common that the linker is set up to first look into /usr/local, then into /usr – this allows to provide newer, self-compiled library versions in the /usr/local tree.

If libpng-config installed in /usr is now called by a configure script, it emits -L/usr/lib (or -L/usr/lib64). Since -L prepends directories to the library search path, the linker no longer looks into /usr/local first for all libraries that follow, effectively hiding all newer library versions in /usr/local.

For this reason, /usr/lib and /usr/lib64 should always be filtered out. In case you want to stay with libpng-config at all (Debian gets rid of all *-config scripts soon), here is a possible patch.

--- libpng16-config.orig        2017-05-10 01:26:17.000000000 +0200
+++ libpng16-config     2018-02-10 20:30:06.195253267 +0100
@@ -25,6 +25,12 @@
+if test "${libdir}" = "/usr/lib" ||
+   test "${libdir}" = "/usr/lib64"; then
+  L_opts=""
     cat <<EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.