pkgsrc-Bugs archive

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

pkg/48334: graphics/gd uses "ceill()", silently succeeds on amd64-6.1_STABLE, undefined symbol on macppc-6.99.24



>Number:         48334
>Category:       pkg
>Synopsis:       graphics/gd uses "ceill()", silently succeeds on 
>amd64-6.1_STABLE, undefined symbol on macppc-6.99.24
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 23 12:20:01 +0000 2013
>Originator:     John D. Baker
>Release:        NetBSD/amd64-6.1_STABLE, macppc-6.99.24, pkgsrc-2013Q3
>Organization:
>Environment:
NetBSD skuld.technoskunk.fur 6.1_STABLE NetBSD 6.1_STABLE (SKULD) #45: Sun Oct 
20 15:22:36 CDT 2013  
sysop%skuld.technoskunk.fur@localhost:/d0/build/netbsd-6/obj/amd64/sys/arch/amd64/compile/SKULD
 amd64

NetBSD sawtooth.technoskunk.fur 6.99.24 NetBSD 6.99.24 (GENERIC_LOWRES) #36: 
Mon Oct 21 03:00:43 CDT 2013  
sysop%skuld.technoskunk.fur@localhost:/d0/build/current/obj/macppc/sys/arch/macppc/compile/GENERIC_LOWRES
 macppc

>Description:
While building dependencies leading up to print/teTeX on a
macppc-6.99.24 system, building "graphic/gd" failed with:

[...]
gcc -std=gnu99 -DHAVE_CONFIG_H -I.    -DPNG_NO_ASSEMBLER_CODE 
-I/usr/pkg/include -I/usr/include -I/usr/X11R7/include 
-I/usr/X11R7/include/freetype2 -I/usr/pkg/include/libpng16 
-I/usr/X11R7/include/freetype2 -I/usr/X11R7/include -I/usr/X11R7/include 
-I/usr/pkg/include -I/usr/pkg/include  -O2 -pthread -I/usr/pkg/include 
-I/usr/include -I/usr/X11R7/include -I/usr/X11R7/include/freetype2 
-I/usr/X11R7/include -I/usr/pkg/include -fvisibility=hidden -MT gdcmpgif.o -MD 
-MP -MF .deps/gdcmpgif.Tpo -c -o gdcmpgif.o gdcmpgif.c
mv -f .deps/gdcmpgif.Tpo .deps/gdcmpgif.Po
/bin/sh ../libtool --tag=CC    --mode=link gcc -std=gnu99  -O2 -pthread 
-I/usr/pkg/include -I/usr/include -I/usr/X11R7/include 
-I/usr/X11R7/include/freetype2 -I/usr/X11R7/include -I/usr/pkg/include 
-fvisibility=hidden   -L/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/X11R7/lib 
-Wl,-R/usr/X11R7/lib -Wl,-R/usr/pkg/lib -pthread -L/usr/X11R7/lib 
-L/usr/pkg/lib -o gdcmpgif gdcmpgif.o libgd.la  -ljpeg -lz -lm  
-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lpng16 -L/usr/X11R7/lib -lfreetype -lz -lbz2 
-L/usr/X11R7/lib -lfontconfig -lfontconfig -L/usr/pkg/lib -lvpx -L/usr/pkg/lib 
-ltiff
libtool: link: gcc -std=gnu99 -O2 -pthread 
-I/d0/build/pkgsrc/graphics/gd/work/.buildlink/include 
-I/d0/build/pkgsrc/graphics/gd/work/.x11-buildlink/include 
-I/d0/build/pkgsrc/graphics/gd/work/.x11-buildlink/include/freetype2 
-fvisibility=hidden -Wl,-R/usr/X11R7/lib -Wl,-R/usr/pkg/lib -pthread -o 
.libs/gdcmpgif gdcmpgif.o  -L/d0/build/pkgsrc/graphics/gd/work/.buildlink/lib 
-L/d0/build/pkgsrc/graphics/gd/work/.x11-buildlink/lib -L./.libs -lgd -lpng16 
-lfreetype -lbz2 -lfontconfig -lvpx -lrt -ltiff -llzma -ljbig -ljpeg -lz -lm 
-pthread -Wl,-rpath,/usr/pkg/lib 
-Wl,-rpath,/d0/build/pkgsrc/graphics/gd/work/.buildlink/lib
./.libs/libgd.so: undefined reference to `ceill'
*** Error code 1

Stop.
make[2]: stopped in /d0/build/pkgsrc/graphics/gd/work/libgd-2.1.0/src


The offending symbol is found in ${WRKSRC}/src/gd_bmp.c:794-795:
  /* The line must be divisible by 4, else its padded with NULLs */
  padding = ((int)ceill(0.1 * info->width)) % 4;

but later in the same file, lines 862-863:
  /* The line must be divisible by 4, else its padded with NULLs */
  padding = ((int)ceil(0.5 * info->width)) % 4;

The "width" member is from "bmp_info_t" which defines it as a signed
32-bit integer, so the use of "ceill()" which takes a long double
argument and returns a long double value is spurious.  I suspect a
typographical error.


This is compounded by the fact that <math.h> on NetBSD/macppc-6.99.24
contains a prototype for "ceill()" on line 405:

long double     ceill(long double);

but there is no corresponding entry point in /lib/libm.so:

$ nm /lib/libm.so | grep ceil
000254e0 t 00008000.got2.plt_pic32.ceil
0001ca64 T ceil
00011160 T ceilf


Meanwhile, on amd64-6.1_STABLE, there is neither prototype nor library
entry for "ceill()", yet compilation and linking completes.

Grovelling back through the build output reveals the following:

[...]
/bin/sh ../libtool --tag=CC    --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H 
-I.    -I/usr/pkg/include -I/usr/include -I/usr/X11R7/include/freetype2 
-I/usr/pkg/include/libpng16 -I/usr/X11R7/include/freetype2 -I/usr/X11R7/include 
-I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include  -O2 -pthread 
-I/usr/pkg/include -I/usr/include -I/usr/X11R7/include/freetype2 
-I/usr/X11R7/include -I/usr/pkg/include -fvisibility=hidden -MT gd_bmp.lo -MD 
-MP -MF .deps/gd_bmp.Tpo -c -o gd_bmp.lo gd_bmp.c
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. 
-I/d0/build/pkgsrc/graphics/gd/work/.buildlink/include 
-I/d0/build/pkgsrc/graphics/gd/work/.x11-buildlink/include/freetype2 
-I/d0/build/pkgsrc/graphics/gd/work/.buildlink/include/libpng16 
-I/d0/build/pkgsrc/graphics/gd/work/.x11-buildlink/include -O2 -pthread 
-fvisibility=hidden -MT gd_bmp.lo -MD -MP -MF .deps/gd_bmp.Tpo -c gd_bmp.c  
-fPIC -DPIC -o .libs/gd_bmp.o
gd_bmp.c: In function 'bmp_read_1bit':
gd_bmp.c:795:2: warning: implicit declaration of function 'ceill'
gd_bmp.c:795:18: warning: incompatible implicit declaration of built-in 
function 'ceill'
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. 
-I/d0/build/pkgsrc/graphics/gd/work/.buildlink/include 
-I/d0/build/pkgsrc/graphics/gd/work/.x11-buildlink/include/freetype2 
-I/d0/build/pkgsrc/graphics/gd/work/.buildlink/include/libpng16 
-I/d0/build/pkgsrc/graphics/gd/work/.x11-buildlink/include -O2 -pthread 
-fvisibility=hidden -MT gd_bmp.lo -MD -MP -MF .deps/gd_bmp.Tpo -c gd_bmp.c -o 
gd_bmp.o >/dev/null 2>&1
[...]

The compiler treats "ceill()" as implicitly typed, but nowhere is it
defined.  Yet, the linker apparently ignores this and the build
completes.

While 1-bpp BMP images are unlikely, they are not impossible.  It
would be interesting to see what fireworks come about should one
be processed by "libgd"...
>How-To-Repeat:
Attempt to build "graphics/gd" on macppc(others?)-6.99.24.  Note undefined
symbol error.

Build "graphics/gd" on {amd64,i386}(others?)-6.1_STABLE.  Note success,
but find above messages about implicit declaration of "ceill()" with
neither prototype nor library code to support it.
>Fix:
Immediate fix for "graphics/gd" is change "ceill()" to "ceil()".

There are implications of toolchain problems...



Home | Main Index | Thread Index | Old Index