all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#25268: 25.1; configure.ac libpng search error
@ 2016-12-24 21:31 James K. Lowden
  2016-12-25  1:08 ` Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: James K. Lowden @ 2016-12-24 21:31 UTC (permalink / raw)
  To: 25268



configure.ac uses libpng-config, if installed, to determine the include
directive for the PNG library.  Unfortuately, it does not correctly use
libpng-config for the linker flags.  Consequently, it may mismatch the
header file to the library.  In my case, configure misdiagnosed my
setup, and recommended --no-png.

On my system, a libpng-config was installed by the Anaconda scientific
Python package distribution.  Because I had allowed Anaconda to place
itself earlier in the path than /usr/bin, that is the version configure
used.  I suspect the error I describe below has not been detected before
because my setup is unusual.

First, let's see what libpng-config has to say on my system: 

$ for opt in cflags ldflags libs
do
        cmd="libpng-config --$opt"
        printf "%-25s: %-s\n" "$cmd" "$($cmd)"
done
libpng-config --cflags   : -I/usr/local/anaconda/include/libpng16
libpng-config --ldflags  : -L/usr/local/anaconda/lib -lpng16
libpng-config --libs     : -lpng16

Now, let's look at how libpng-config is used in configure.ac:

$ grep -n libpng-config configure.ac
3412:    png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` &&
3413:    png_libs=`(libpng-config --libs) 2>&AS_MESSAGE_LOG_FD` || {
3414:      # libpng-config does not work; configure by hand.

As you can see, png_libs relies on

   libpng-config --libs

not

   libpng-config --ldflags

The produced configure script therefore finds an include file under
ananconda, but does not provide the associated -L option to the
linker.  The configure test fails because a symbol declared in the
header file is not supplied by the (older) libpng found by the linker.  

I believe the fix is to change line 3413 of configure.ac to read:

    png_libs=`(libpng-config --ldflags) 2>&AS_MESSAGE_LOG_FD` || {

although IMO that's not quite sufficient, because it doesn't set RPATH.  

I worked around the problem before completely diagnosing it simply by
renaming /usr/local/anaconda to /usr/local/.anaconda, taking it out of
the PATH and causing configure not to find it.  The outputs are:

    $ /usr/bin/libpng-config --cflags --libs
    -I/usr/include/libpng12
    -lpng12

which worked just fine.  In fact, I used report-emacs-bug in the newly
built emacs to send this message.

The rest of this message was produced by report-emacs-bug.  I include it
in case there are details you can use.

Humbly submitted,

--jkl




In GNU Emacs 25.1.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
 of 2016-12-17 built on willow.schemamania.org
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:	Ubuntu 16.04.1 LTS

Configured using:
 'configure --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 --without-dbus --without-gconf --without-gsettings'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM NOTIFY ACL LIBSELINUX
GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: GNUmakefile

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  recentf-mode: t
  global-ede-mode: t
  ede-minor-mode: t
  global-semanticdb-minor-mode: t
  global-semantic-idle-scheduler-mode: t
  semantic-idle-scheduler-mode: t
  semantic-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-auto-complete-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
[yas] Loading for `makefile-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/jklowden/.emacs.d/elpa/yasnippet-20160416.831/snippets/makefile-mode) (quote makefile-mode)))!
[yas] Loading snippet files from /home/jklowden/.emacs.d/elpa/yasnippet-20160416.831/snippets/makefile-mode
Parsing Makefile (LL)...
[yas] Loading for `text-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/jklowden/.emacs.d/elpa/yasnippet-20160416.831/snippets/text-mode) (quote text-mode)))!
[yas] Loading snippet files from /home/jklowden/.emacs.d/elpa/yasnippet-20160416.831/snippets/text-mode
[yas] Loading for `c-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/jklowden/.emacs.d/elpa/yasnippet-20160416.831/snippets/c-mode) (quote c-mode)))!
[yas] Loading snippet files from /home/jklowden/.emacs.d/elpa/yasnippet-20160416.831/snippets/c-mode
[yas] Loading for `cc-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/jklowden/.emacs.d/elpa/yasnippet-20160416.831/snippets/cc-mode) (quote cc-mode)))!
[yas] Loading snippet files from /home/jklowden/.emacs.d/elpa/yasnippet-20160416.831/snippets/cc-mode
Parsing prim-workalike/Makefile (LL)...done

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired rfc822 mml mml-sec epg
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils
semantic/tag-file semantic/bovine/c hideif semantic/bovine/c-by
semantic/lex-spp semantic/bovine/gcc semantic/analyze/refs
auto-complete-c-headers tramp tramp-compat auth-source gnus-util mm-util
help-fns mail-prsvr password-cache tramp-loaddefs trampver ucs-normalize
shell pcomplete format-spec cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs nroff-mode vc-git diff-mode
easy-mmode semantic/db-file data-debug cedet-files semantic/bovine/make
semantic/decorate/include semantic/db-find semantic/db-ref
semantic/decorate/mode semantic/decorate pulse semantic/dep
semantic/analyze semantic/sort semantic/scope semantic/analyze/fcn
semantic/bovine/make-by semantic/bovine make-mode pp server time-date
recentf tree-widget ede/speedbar ede/files ede ede/detect ede/base
ede/auto ede/source eieio-speedbar speedbar sb-image dframe eieio-custom
wid-edit semantic/db-mode semantic/db eieio-base semantic/idle
semantic/format ezimage semantic/tag-ls semantic/find semantic/ctxt
semantic/util-modes semantic/util semantic semantic/tag semantic/lex
semantic/fw eieio eieio-core mode-local find-func cedet yasnippet advice
flymake compile comint ansi-color ring auto-complete-config
auto-complete popup finder-inf ac-c-headers-autoloads
auto-complete-c-headers-autoloads auto-complete-autoloads avy-autoloads
format-sql-autoloads popup-autoloads sql-indent-autoloads
unbound-autoloads xcscope-autoloads xkcd-autoloads yasnippet-autoloads
package epg-config seq byte-opt bytecomp byte-compile cl-extra help-mode
easymenu cconv cobol-mode derived cl-macs skeleton cl-seq cl gv edmacro
kmacro cl-loaddefs pcase cl-lib mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
inotify dynamic-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 459597 15119)
 (symbols 48 34093 0)
 (miscs 40 840 561)
 (strings 32 79645 25011)
 (string-bytes 1 2027516)
 (vectors 16 60451)
 (vector-slots 8 1036169 7841)
 (floats 8 1072 263)
 (intervals 56 1709 70)
 (buffers 976 29)
 (heap 1024 69942 1543))





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#25268: 25.1; configure.ac libpng search error
  2016-12-24 21:31 bug#25268: 25.1; configure.ac libpng search error James K. Lowden
@ 2016-12-25  1:08 ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2016-12-25  1:08 UTC (permalink / raw)
  To: James K. Lowden; +Cc: 25268-done

[-- Attachment #1: Type: text/plain, Size: 486 bytes --]

> I believe the fix is to change line 3413 of configure.ac to read:
>
>     png_libs=`(libpng-config --ldflags) 2>&AS_MESSAGE_LOG_FD` || {

Thanks, I did something along those lines by installing the attached patch into 
master, and I'm boldly marking the bug report as done.

> although IMO that's not quite sufficient, because it doesn't set RPATH.

--ldflags is supposed to output any -R options needed, no? If it's not, it 
sounds like the libpng-config configuration is incorrect.

[-- Attachment #2: 0001-Use-libpng-config-ldflags-not-libs.patch --]
[-- Type: text/x-diff, Size: 1777 bytes --]

From 5bdbbe3e89adbb2a2092cc73586ffc38ddbb95d9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 24 Dec 2016 17:03:22 -0800
Subject: [PATCH] Use libpng-config --ldflags, not --libs

Problem reported by James K. Lowden (Bug#25268).
* configure.ac (LIBPNG): Pass --ldflags, not --libs, to libpng-config.
---
 configure.ac | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5aaf006..cd6c689 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3476,7 +3476,7 @@ AC_DEFUN
   elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
     AC_MSG_CHECKING([for png])
     png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` &&
-    png_libs=`(libpng-config --libs) 2>&AS_MESSAGE_LOG_FD` || {
+    png_ldflags=`(libpng-config --ldflags) 2>&AS_MESSAGE_LOG_FD` || {
       # libpng-config does not work; configure by hand.
       # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
       # in /usr/include/libpng.
@@ -3486,18 +3486,18 @@ AC_DEFUN
       else
 	png_cflags=
       fi
-      png_libs='-lpng'
+      png_ldflags='-lpng'
     }
     SAVE_CFLAGS=$CFLAGS
     SAVE_LIBS=$LIBS
     CFLAGS="$CFLAGS $png_cflags"
-    LIBS="$png_libs -lz -lm $LIBS"
+    LIBS="$png_ldflags -lz -lm $LIBS"
     AC_LINK_IFELSE(
       [AC_LANG_PROGRAM([[#include <png.h>]],
 	 [[return !png_get_channels (0, 0);]])],
       [HAVE_PNG=yes
        PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"`
-       LIBPNG=$png_libs
+       LIBPNG=$png_ldflags
        # $LIBPNG requires explicit -lz in some cases.
        # We don't know what those cases are, exactly, so play it safe and
        # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ.
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-25  1:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-24 21:31 bug#25268: 25.1; configure.ac libpng search error James K. Lowden
2016-12-25  1:08 ` Paul Eggert

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.