From owner-freebsd-ports@FreeBSD.ORG Fri Dec 9 17:58:57 2011 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 449B1106564A for ; Fri, 9 Dec 2011 17:58:57 +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 BEEB98FC14 for ; Fri, 9 Dec 2011 17:58:56 +0000 (UTC) Received: by smtp.kn-bremen.de (Postfix, from userid 10) id 569381E000DF; Fri, 9 Dec 2011 18:58:55 +0100 (CET) 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 pB9HuqWC027946; Fri, 9 Dec 2011 18:56:52 +0100 (CET) (envelope-from nox@triton8.kn-bremen.de) Received: (from nox@localhost) by triton8.kn-bremen.de (8.14.4/8.14.3/Submit) id pB9Huq6J027945; Fri, 9 Dec 2011 18:56:52 +0100 (CET) (envelope-from nox) From: Juergen Lock Date: Fri, 9 Dec 2011 18:56:52 +0100 To: freebsd-ports@FreeBSD.org Message-ID: <20111209175652.GA27334@triton8.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Cc: vd@FreeBSD.org, johans@FreeBSD.org Subject: -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: Fri, 09 Dec 2011 17:58:57 -0000 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?) Thanx, Juergen PS: [1] for some reason only 8/i386 is affected, 7/i386 and 8/amd64 are not.