[Pkg-utopia-maintainers] Bug#452859: stack protector detection prevents cross-compiling

Neil Williams codehelp at debian.org
Sun Nov 25 17:44:46 UTC 2007


Package: avahi
Version: 0.6.21
Severity: normal
Tags: patch
User: codehelp at debian.org
Usertags: crossbuilt

--- Please enter the report below this line. ---

In line with the other cross-building support bugs:
http://lists.debian.org/debian-devel/2007/11/msg00116.html

This patch is necessary to allow avahi to cross-build in Debian.

--- avahi-0.6.21/debian/rules   2007-11-25 17:42:57.000000000 +0000
+++ avahi.new/debian/rules      2007-11-25 17:42:48.000000000 +0000
@@ -18,7 +18,7 @@
                              --disable-mono --disable-monodoc

 # Only enable the stack protector on certain archs
-ifeq (,$(filter $(DEB_BUILD_ARCH), powerpc s390 sparc amd64 i386))
+ifeq (,$(filter $(DEB_HOST_ARCH), powerpc s390 sparc amd64 i386))
   DEB_CONFIGURE_EXTRA_FLAGS += --disable-stack-protector
 endif


i.e. the detection of whether to use -lssp_nonshared is determined by
the host architecture so that the option matches the compiler being
used. (DEB_BUILD_ARCH is of little use in a cross build.)

When building on i386, amd64 or powerpc for arm, the current check
causes arm-linux-gnu-gcc to fail when compiling one of the test programs
for pthread support.

$ arm-linux-gnu-gcc -o conftest -g -O2 -fstack-protector -pthread
conftest.c
/usr/lib/gcc/arm-linux-gnu/4.2.3/../../../../arm-linux-gnu/bin/ld:
cannot find -lssp_nonshared
collect2: ld returned 1 exit status
configure:20173: $? = 1
configure: failed program was:
 /* confdefs.h.  */
 #define PACKAGE_NAME "avahi"
 #define PACKAGE_TARNAME "avahi"
 #define PACKAGE_VERSION "0.6.21"
 #define PACKAGE_STRING "avahi 0.6.21"
 #define PACKAGE_BUGREPORT "avahi (at) lists (dot) freedesktop (dot) org"
 #define PACKAGE "avahi"
 #define VERSION "0.6.21"
 #define _GNU_SOURCE 1
 #define ENABLE_SSP_CC 1
 #define ENABLE_SSP_CXX 1
 #define STDC_HEADERS 1
 #define HAVE_SYS_TYPES_H 1
 #define HAVE_SYS_STAT_H 1
 #define HAVE_STDLIB_H 1
 #define HAVE_STRING_H 1
 #define HAVE_MEMORY_H 1
 #define HAVE_STRINGS_H 1
 #define HAVE_INTTYPES_H 1
 #define HAVE_STDINT_H 1
 #define HAVE_UNISTD_H 1
 #define HAVE_DLFCN_H 1
 /* end confdefs.h.  */
 #include <pthread.h>
 int
 main ()
 {
 pthread_t th; pthread_join(th, 0);
                      pthread_attr_init(0); pthread_cleanup_push(0, 0);
                      pthread_create(0,0,0,0); pthread_cleanup_pop(0);
   ;
   return 0;
 }
ac_link=$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS
conftest.$ac_ext $LIBS >&5
ac_try=
acx_pthread_ok=no

A native build on amd64 uses:

 gcc -o conftest -g -O2 -fstack-protector -pthread   conftest.c   >&5
configure:20173: $? = 0
ac_link=$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS
conftest.$ac_ext $LIBS >&5
ac_try=./conftest$ac_exeext
acx_pthread_ok=yes

To build on arm, the test should run:
arm-linux-gnu-gcc -o conftest -g -O2 -pthread   conftest.c   >&5
configure:20173: $? = 0
ac_link=$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS
conftest.$ac_ext $LIBS >&5
ac_try=
acx_pthread_ok=yes

As the test only checks to see if the test C file can be compiled and
linked (not run), then it is safe to let the test operate normally
during the cross build - providing that the stack protection detection
in debian/rules matches the option to the actual compiler in use.

The change above has been tested in a native build as well as a cross build.

Thanks.

--- System information. ---
Architecture: amd64
Kernel:       Linux 2.6.22-2-amd64

Debian Release: lenny/sid
  500 unstable        www.emdebian.org
  500 unstable        ftp.uk.debian.org


-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-utopia-maintainers/attachments/20071125/5f6ad612/attachment.pgp 


More information about the Pkg-utopia-maintainers mailing list