From owner-freebsd-ports@FreeBSD.ORG Sat Apr 28 21:46:22 2012 Return-Path: Delivered-To: freebsd-ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1BE8F106564A; Sat, 28 Apr 2012 21:46:22 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [IPv6:2a01:e0c:1:1599::14]) by mx1.freebsd.org (Postfix) with ESMTP id A0A7C8FC0A; Sat, 28 Apr 2012 21:46:18 +0000 (UTC) Received: from endor.tataz.chchile.org (unknown [82.233.239.98]) by smtp5-g21.free.fr (Postfix) with ESMTP id 0BF13D4807D; Sat, 28 Apr 2012 23:46:11 +0200 (CEST) Received: from felucia.tataz.chchile.org (felucia.tataz.chchile.org [192.168.1.9]) by endor.tataz.chchile.org (Postfix) with ESMTP id E8A87C36; Sat, 28 Apr 2012 23:46:10 +0200 (CEST) Received: by felucia.tataz.chchile.org (Postfix, from userid 1000) id BF03910578; Sat, 28 Apr 2012 21:46:10 +0000 (UTC) Date: Sat, 28 Apr 2012 23:46:10 +0200 From: Jeremie Le Hen To: Juergen Lock Message-ID: <20120428214610.GC27994@felucia.tataz.chchile.org> References: <20111209175652.GA27334@triton8.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111209175652.GA27334@triton8.kn-bremen.de> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: vd@FreeBSD.org, johans@FreeBSD.org, freebsd-ports@FreeBSD.org Subject: Re: -fstack-protector again (rpm4, BROKEN textproc/libextractor) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Apr 2012 21:46:22 -0000 Hi Juergen, Please Cc: me when replying. On Fri, Dec 09, 2011 at 06:56:52PM +0100, Juergen Lock wrote: > Hi! > > I got a report that textproc/libextractor was marked BROKEN on > i386 which one of my ports uses, so with the help of swill's tb > (I don't really use i386 myself here anymore so thanx for that :) > I took a look. The failed libextractor log seem to be this one: > > http://pointyhat.freebsd.org/errorlogs/i386-errorlogs/e.8.20110914141638/libextractor-0.6.2_4.log > > The problem: > > [...] > checking for rpmReadPackageFile in -lrpm... no > [...] > ===> Building package for libextractor-0.6.2_4 > tar: lib/libextractor/libextractor_rpm.la: Cannot stat: No such file or directory > tar: lib/libextractor/libextractor_rpm.so: Cannot stat: No such file or directory > tar: Error exit delayed from previous errors. > pkg_create: make_dist: tar command failed with code 256 > *** Error code 1 > [...] > > The config.log from swill's tb reveals: > > [...] > configure:19183: checking for rpmReadPackageFile in -lrpm > configure:19208: cc -o conftest -fno-strict-aliasing -O2 -pipe -fno-strict-alias > ing -I/usr/local/include -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib/qt4 > conftest.c -lrpm >&5 > /usr/local/lib/librpm.so: undefined reference to `__stack_chk_fail_local' > configure:19208: $? = 1 > configure: failed program was: > | /* confdefs.h */ > | #define PACKAGE_NAME "libextractor" > | #define PACKAGE_TARNAME "libextractor" > | #define PACKAGE_VERSION "0.6.2" > | #define PACKAGE_STRING "libextractor 0.6.2" > | #define PACKAGE_BUGREPORT "bug-libextractor@gnu.org" > | #define PACKAGE_URL "" > | #define PACKAGE "libextractor" > | #define VERSION "0.6.2" > | #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 __EXTENSIONS__ 1 > | #define _ALL_SOURCE 1 > | #define _GNU_SOURCE 1 > | #define _POSIX_PTHREAD_SEMANTICS 1 > | #define _TANDEM_SOURCE 1 > | #define HAVE_DLFCN_H 1 > | #define LT_OBJDIR ".libs/" > | #define LT_MODULE_EXT ".so" > | #define LT_MODULE_PATH_VAR "LD_LIBRARY_PATH" > | #define LT_DLSEARCH_PATH "/lib:/usr/lib" > | #define HAVE_LIBDL 1 > | #define HAVE_DLERROR 1 > | #define HAVE_LIBDLLOADER 1 > | #define error_t int > | #define __error_t_defined 1 > | #define HAVE_PRELOADED_SYMBOLS 1 > | #define HAVE_LTDL 1 > | #define HAVE_UNISTD_H 1 > | #define HAVE_DIRENT_H 1 > | #define HAVE_CLOSEDIR 1 > | #define HAVE_OPENDIR 1 > | #define HAVE_READDIR 1 > | #define HAVE_STRLCAT 1 > | #define HAVE_STRLCPY 1 > | #define LT_LIBEXT "a" > | #define SOMEBSD 1 > | #define HAVE_LIBC_R 1 > | #define HAVE_ICONV 1 > | #define ICONV_CONST const > | #define LOCALEDIR "/usr/local/share/locale" > | #define ISOLOCALEDIR "/usr/share/locale" > | #define HAVE_FSEEKO 1 > | #define HAVE_LIBSTDC__ 1 > | #define HAVE_LANGINFO_H 1 > | #define HAVE_VORBIS_VORBISFILE_H 1 > | #define HAVE_VORBISFILE 1 > | #define HAVE_FLAC_ALL_H 1 > | #define HAVE_FLAC 1 > | #define HAVE_FLAC 1 > | #define HAVE_ZLIB_H 1 > | #define HAVE_ZLIB 1 > | #define HAVE_BZLIB_H 1 > | #define HAVE_LIBBZ2 1 > | /* end confdefs.h. */ > | > | /* Override any GCC internal prototype to avoid an error. > | Use char because int might match the return type of a GCC > | builtin and then its argument prototype would still apply. */ > | #ifdef __cplusplus > | extern "C" > | #endif > | char rpmReadPackageFile (); > | int > | main () > | { > | return rpmReadPackageFile (); > | ; > | return 0; > | } > configure:19217: result: no > [...] > > So the problem is this: > > /usr/local/lib/librpm.so: undefined reference to `__stack_chk_fail_local' > > which according to list archives happens/can happen [1] when one > links code built with -fstack-protector to code that wasn't, and > archivers/rpm4's configure script autodetects that the compiler > supports -fstack-protector and then proceeds to using it: > > [...] > checking supported compiler flags... > -fno-strict-aliasing > -fstack-protector > checking for special C compiler options needed for large files... no > [...] > > ..while libextractor's doesn't. So I came up with this (untested) > patch for archivers/rpm4: (maintainers Cc'd, of course we'd want a > PORTREVISION bump there too.) > > Index: Makefile > =================================================================== > RCS file: /home/pcvs/ports/archivers/rpm4/Makefile,v > retrieving revision 1.38 > diff -u -p -r1.38 Makefile > --- Makefile 7 Oct 2011 14:33:17 -0000 1.38 > +++ Makefile 9 Dec 2011 17:24:09 -0000 > @@ -101,6 +101,16 @@ LIB_DEPENDS+= lzma:${PORTSDIR}/archivers > .endif > > post-patch: > +# disable -fstack-protector on i386 as that causes librpm clients > +# not using -fstack-protector faling to link there, like the autoconf > +# check in textproc/libextractor: > +# http://pointyhat.freebsd.org/errorlogs/i386-errorlogs/e.8.20110914141638/libextractor-0.6.2_4.log > +# [...] checking for rpmReadPackageFile in -lrpm... no [...] > +# (for some reason only 8/i386 is affected, 7/i386 and 8/amd64 are not.) > +.if ${ARCH} == "i386" > + ${REINPLACE_CMD} -e '/cflags_to_try=/s/-fstack-protector//' \ > + ${WRKSRC}/configure > +.endif > ${REINPLACE_CMD} -e '/^pkgconfigdir/s:/:data/:' \ > -e 's:\.\./\.\./bin/::' ${WRKSRC}/Makefile.in > ${REINPLACE_CMD} -e 's/(hpux)/& || defined(__FreeBSD__)/' \ > > Thoughts? (Or should something like that even be done globally in > Mk/ since there are surely more ports affected?) Sorry I'm not subscribed to the -ports@ mailing-list. I knew that this problem existed but I wasn't aware of any occurence of it. I think this patch could solve the problem, I intend to commit it to head in the next days. http://people.freebsd.org/~jlh/libc_ssp_nonshared.diff > PS: [1] for some reason only 8/i386 is affected, 7/i386 and 8/amd64 are not. I don't know why amd64 doesn't have the problem though. According to the subject, it seems it's not the first time it occured. Can you point other occurences of this? -- Jeremie Le Hen Men are born free and equal. Later on, they're on their own. Jean Yanne