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

Bug#708056: ncurses: FTBFS: test/hanoi.c:234: undefined reference to `pow'



Source: ncurses
Version: 5.9+20130504-1
Severity: important
Tags: patch
Justification: fails to build from source (but built successfully in the past)

Hi!

[…]
m68k-linux-gnu-gcc -c -I. -I/tmp/buildd/ncurses-5.9+20130504/test -I../test -DHAVE_CONFIG_H -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/tmp/buildd/ncurses-5.9+20130504/obj-wide/include -I/usr/include/ncursesw -D_XPG5 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security  /tmp/buildd/ncurses-5.9+20130504/test/hanoi.c
m68k-linux-gnu-gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security  -o hanoi ../obj-test/hanoi.o -L/tmp/buildd/ncurses-5.9+20130504/obj-wide/lib -Wl,-z,relro -I. -I/tmp/buildd/ncurses-5.9+20130504/test -I../test -DHAVE_CONFIG_H -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/tmp/buildd/ncurses-5.9+20130504/obj-wide/include -I/usr/include/ncursesw -D_XPG5 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security  `echo "-lformw -lmenuw -lpanelw -lncursesw -ltinfo  " | sed -e 's/-lform.*-lpanel[^ ]*//'`
.../obj-test/hanoi.o: In function `DisplayTiles':
/tmp/buildd/ncurses-5.9+20130504/test/hanoi.c:234: undefined reference to `pow'
collect2: ld returned 1 exit status
make[1]: *** [hanoi] Error 1
make[1]: Leaving directory `/tmp/buildd/ncurses-5.9+20130504/obj-test'
make: *** [build-test] Error 2
dpkg-buildpackage: error: debian/rules build-arch gave error exit status 2
E: Failed autobuilding of package


I think the problem is here:

[…]
configure:13625: checking if -lm needed for math functions
configure:13647: gcc -o conftest -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64  -DNDEBUG  -Wl,-z,relro conftest.c  -ldl >&5
configure:13650: $? = 0
configure:13653: test -s conftest
configure:13656: $? = 0
configure:13666: result: no
[…]

Which comes from:

[…]
echo "$as_me:13625: checking if -lm needed for math functions" >&5
[…]
main ()
{
double x = rand(); printf("result = %g\n", sin(x))
  ;
  return 0;
}
[…]

Which does not check “enough”. GCC will usually provide sin(3)
as builtin, but not necessarily pow(3).

Sadly, your packaging does not run autoreconf, but I *think*
the attached patch might work. It’ll take another day, at
least, for me to confirm this, as compiling on an Atari, even
a VM, is really slow.

(Not 100% sure on the autoconf magic, but I’m pretty certain
that $2 must be []-escaped as it contains a comma now. Tom
Cc’d, he will probably know, seeing as he forked autoconf
several times.)

-- System Information:
Debian Release: 7.0
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: m68k

Kernel: Linux 3.2.0-4-atari
Locale: LANG=C, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/mksh-static
diff -Nru ncurses-5.9+20130504/debian/changelog ncurses-5.9+20130504/debian/changelog
--- ncurses-5.9+20130504/debian/changelog	2013-05-11 11:00:56.000000000 +0000
+++ ncurses-5.9+20130504/debian/changelog	2013-05-12 19:34:05.000000000 +0000
@@ -1,3 +1,9 @@
+ncurses (5.9+20130504-1+m68k.1) unreleased; urgency=low
+
+  * Check for pow() without -lm too, not just sin()
+
+ -- Thorsten Glaser <tg@mirbsd.de>  Sun, 12 May 2013 19:32:39 +0000
+
 ncurses (5.9+20130504-1) unstable; urgency=low
 
   * New upstream patchlevel.
diff -Nru ncurses-5.9+20130504/debian/patches/fix-libmath.diff ncurses-5.9+20130504/debian/patches/fix-libmath.diff
--- ncurses-5.9+20130504/debian/patches/fix-libmath.diff	1970-01-01 00:00:00.000000000 +0000
+++ ncurses-5.9+20130504/debian/patches/fix-libmath.diff	2013-05-12 19:44:09.000000000 +0000
@@ -0,0 +1,24 @@
+# DP: one of the examples uses pow() so check for it as well
+
+--- a/configure
++++ b/configure
+@@ -13638,7 +13638,7 @@ else
+ int
+ main ()
+ {
+-double x = rand(); printf("result = %g\n", sin(x))
++double x = rand(); printf("result = %g\n", pow(sin(x),x))
+   ;
+   return 0;
+ }
+--- a/configure.in
++++ b/configure.in
+@@ -1327,7 +1327,7 @@ AC_CHECK_LIB(bsd, gettimeofday,
+ 	;;
+ esac
+ 
+-CF_MATH_LIB(MATH_LIB,sin(x))
++CF_MATH_LIB(MATH_LIB,[pow(sin(x),x)])
+ AC_SUBST(MATH_LIB)
+ 
+ ###	Checks for header files.
diff -Nru ncurses-5.9+20130504/debian/patches/series ncurses-5.9+20130504/debian/patches/series
--- ncurses-5.9+20130504/debian/patches/series	2013-05-06 18:05:06.000000000 +0000
+++ ncurses-5.9+20130504/debian/patches/series	2013-05-12 19:41:57.000000000 +0000
@@ -1,2 +1,3 @@
 02-debian-backspace.diff
 03-debian-ncursesconfig-omit-L.diff
+fix-libmath.diff

Reply to: