Red Hat Bugzilla – Bug 494579
Attempt to centralize setjmp.h leads to confusing results
Last modified: 2013-07-02 23:22:06 EDT
Description of problem:
Compiling an application with PNG support leads to the inclusion of /usr/include/libpng12/pngconf.h.
In this file, the following snippet occurs:
#if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
# define PNG_SETJMP_SUPPORTED
/* This is an attempt to force a single setjmp behaviour on Linux. If
* the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
# ifdef __linux__
# ifdef _BSD_SOURCE
# define PNG_SAVE_BSD_SOURCE
# undef _BSD_SOURCE
# ifdef _SETJMP_H
/* If you encounter a compiler error here, see the explanation
* near the end of INSTALL.
__pngconf.h__ already includes setjmp.h;
__dont__ include it again.;
# endif /* __linux__ */
/* include setjmp.h for error handling */
# include <setjmp.h>
# ifdef __linux__
# ifdef PNG_SAVE_BSD_SOURCE
# ifndef _BSD_SOURCE
# define _BSD_SOURCE
# undef PNG_SAVE_BSD_SOURCE
# endif /* __linux__ */
#endif /* PNG_SETJMP_SUPPORTED */
This application I'm building (LGPLv3) includes many different header files from many different locations, including /usr/include/setjmp.h and /usr/include/bits/setjmp.h (glibc-headers). Other packages include setjmp.h as well, and.
It is wrong for the above snippet to check for _SETJMP_H being defined or not, as it is set by glibc-header's setjmp.h. I could not find a way to define PNG_NOT_SETJMP_SUPPORTED or PNG_SETJMP_NOT_SUPPORTED from within the external application I wanted to compile. If there is a way, please let me know ;-)
Maybe, libpng12/pngconf.h should use _LIBPNG_SETJMP_H such as /usr/include/bits/setjmp.h does in glibc-headers (using _BITS_SETJMP_H)
Version-Release number of selected component (if applicable):
Actually, that code is very intentionally trying to check whether you already included setjmp.h; the consequences of not doing this appear worse than those of doing it. I'd suggest doing what the comment tells you to, ie make sure you include png.h ahead of setjmp.h.
I've asked upstream whether they can't make this a little less painful in the next major release, but it will probably not be changing in the 1.2.x series because it'd break existing applications. The fundamental problem is that linux contains two incompatible versions of setjmp/longjmp, and if you use one while libpng is using the other, your code *will* fail.
You might be able to reduce your pain by including png.h only in one or a few modules (that also contain whatever code tries to catch longjmps out of libpng).
The code does include png.h which in turn includes setjmp.h. Fwiw, the software I'm attempting to compile is:
Download link: http://www.ecmwf.int/products/data/software/download/software_files/Magics++-2.6.4.tar.gz
The code including png.h is at:
Not including setjmp.h here:
[jmeeuwen@ghandalf OpenGL]$ grep -rin setjmp.h *
[jmeeuwen@ghandalf OpenGL]$ pwd
Or anyone else for that matter:
[jmeeuwen@ghandalf Magics++-2.6.4]$ grep -rin setjmp.h *
[jmeeuwen@ghandalf Magics++-2.6.4]$ pwd
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora
'version' of '10'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version prior to Fedora 10's end of life.
Bug Reporter: Thank you for reporting this issue and we are sorry that
we may not be able to fix it before Fedora 10 is end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora please change the 'version' of this
bug to the applicable version. If you are unable to change the version,
please add a comment here and someone will do it for you.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
The process we are following is described here:
Fedora 10 changed to end-of-life (EOL) status on 2009-12-17. Fedora 10 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version.
Thank you for reporting this bug and we are sorry it could not be fixed.