[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for build failure on OS X (under review)

From: Andrew Schwartzmeyer
Subject: Patch for build failure on OS X (under review)
Date: Mon, 5 May 2014 19:39:41 -0700

When building under Homebrew with the options 'brew install emacs 
--use-git-head --HEAD --cocoa --srgb --with-gnutls' (that is, build off master 
as of Mon May  5 19:31:51 PDT 2014, Cocoa build with sRGB colors, link to 
GnuTLS library, the following build error was encountered:

> gcc-4.8 -std=gnu99 -c  -Demacs  -I. -I. -I../lib -I./../lib   
> -I/usr/X11/include      -I/usr/include/libxml2          -MMD -MF deps/image.d 
> -MP -I/usr/local/Cellar/libtasn1/3.4/include 
> -I/usr/local/Cellar/nettle/2.7.1/include 
> -I/usr/local/Cellar/gnutls/3.2.13/include     -g3 -O2  image.c
> image.c: In function 'png_load_body':
> image.c:5919:37: error: 'frame_background' undeclared (first use in this 
> function)
>     fn_png_set_background (png_ptr, &frame_background,
>                                      ^
> image.c:5919:37: note: each undeclared identifier is reported only once for 
> each function it appears in
> make[1]: *** [image.o] Error 1
> make: *** [src] Error 2
> ==> Configuration
> HEAD: b10c09b1746cd5673bff4e40c4485cb266b1932b
> CPU: quad-core 64-bit ivybridge
> OS X: 10.9.2-x86_64
> Xcode: 5.1.1
> CLT:
> X11: 2.7.5 => /opt/X11
> ==> ENV
> HOMEBREW_CC: gcc-4.8
> HOMEBREW_CXX: g++-4.8
> CMAKE_PREFIX_PATH: /usr/local
> /usr/include/libxml2:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
> /System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
> /usr/local/opt/libtasn1/lib/pkgconfig:/usr/local/opt/nettle/lib/pkgconfig:/usr/local/opt/gnutls/lib/pkgconfig
> PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.9
> ACLOCAL_PATH: /usr/local/share/aclocal
> PATH: 
> /usr/local/Library/ENV/4.3:/usr/local/opt/autoconf/bin:/usr/local/opt/automake/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtasn1/bin:/usr/local/opt/nettle/bin:/usr/local/opt/gnutls/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/gcc/bin
> Error: emacs HEAD did not build

Note that the exact same error happens when building with the system clang 

Inspection of src/image.c revealed that in certain cases, an undefined variable 
reference occurred. This was due to a preprocessor #if/endif block (lines 5906 
to 5917) in which the variable (png_color_16 frame_background;) was created, 
and a function (fn_png_set_background) after said block that needed used said 
variable. Here is where I am unsure: should the function be called after the 
block (necessitating making the variable before the block), or should the 
function be called inside the block? This patch does the former, as I assumed.

> diff --git a/src/image.c b/src/image.c
> index c26c0db..b4582d2 100644
> --- a/src/image.c
> +++ b/src/image.c
> @@ -5903,9 +5903,11 @@ png_load_body (struct frame *f, struct image *img, 
> struct png_load_context *c)
>       {
>         /* We use the current frame background, ignoring any default
>            background color set by the image.  */
> +
> +       png_color_16 frame_background;
> +
>  #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
>         XColor color;
> -       png_color_16 frame_background;
>         color.pixel = FRAME_BACKGROUND_PIXEL (f);
>         x_query_color (f, &color);

I made this from a git diff; if need be, I can figure out Bazaar and send a 
patch in the documented format. If there’s a better way to do this, please let 
me know.


Andrew Schwartzmeyer

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

reply via email to

[Prev in Thread] Current Thread [Next in Thread]