From owner-freebsd-ports@FreeBSD.ORG Sat Apr 28 22:03:02 2012 Return-Path: Delivered-To: freebsd-ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEDD01065672; Sat, 28 Apr 2012 22:03:02 +0000 (UTC) (envelope-from nox@jelal.kn-bremen.de) Received: from smtp.kn-bremen.de (gelbbaer.kn-bremen.de [78.46.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id 21CA38FC18; Sat, 28 Apr 2012 22:03:02 +0000 (UTC) Received: by smtp.kn-bremen.de (Postfix, from userid 10) id 0B6CA1E000C7; Sun, 29 Apr 2012 00:02:59 +0200 (CEST) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.4/8.14.4) with ESMTP id q3SM2DVN096194; Sun, 29 Apr 2012 00:02:13 +0200 (CEST) (envelope-from nox@triton8.kn-bremen.de) Received: (from nox@localhost) by triton8.kn-bremen.de (8.14.4/8.14.3/Submit) id q3SM2DOA096193; Sun, 29 Apr 2012 00:02:13 +0200 (CEST) (envelope-from nox) From: Juergen Lock Date: Sun, 29 Apr 2012 00:02:13 +0200 To: Jeremie Le Hen Message-ID: <20120428220213.GA95932@triton8.kn-bremen.de> References: <20111209175652.GA27334@triton8.kn-bremen.de> <20120428214610.GC27994@felucia.tataz.chchile.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120428214610.GC27994@felucia.tataz.chchile.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: vd@FreeBSD.org, johans@FreeBSD.org, Juergen Lock , 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 22:03:02 -0000 On Sat, Apr 28, 2012 at 11:46:10PM +0200, Jeremie Le Hen wrote: > Hi Juergen, Hi! > > 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? Back when I looked at this I searched the list archives for __stack_chk_fail_local and got several hits: http://freebsd.markmail.org/search/?q=__stack_chk_fail_local+order%3Adate-backward So the patch would be very welcome I suppose... :) Juergen