From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id B10A21F466 for ; Mon, 20 Jan 2020 03:01:23 +0000 (UTC) Received: from localhost ([::1]:57868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itNJa-0002Rx-9I for normalperson@yhbt.net; Sun, 19 Jan 2020 22:01:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50725) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itNJQ-0002Rd-NV for bug-gnulib@gnu.org; Sun, 19 Jan 2020 22:01:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1itNJP-00066K-Co for bug-gnulib@gnu.org; Sun, 19 Jan 2020 22:01:12 -0500 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::10]:30559) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1itNJO-000647-Nf for bug-gnulib@gnu.org; Sun, 19 Jan 2020 22:01:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1579489267; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=uRAl8Cw0GjipwL4UYkdxzZC/YbeGBY24wY/lEWlJIMw=; b=gAneX9LH2uH05RRqXX3flWumfmU19uwGheP9ZLRLu8uAB25IuydlsjmI0BWG+kNm9u zzRl8l8GhUDaYwUYaVOpTk3ZdBuQg6v6GsQr0PSu+J0kEEqBNKsuNW0LScZDsDAHonP1 eMuDocSSAOughddHfcoKLrVQJorpSYeJmV4z7kMZoAc4rzxrHYfnFeNlNjNfExZ816iy 5Lxy7/xGVqnmMG9l5zj4K5csaSce/9v5KJw8pYyRMd8+lkfsBPFSd7uRLtxcav97W7Wf lrWb9Q+VKrOW3NT7qcqmNbsH/54sGG1VaUTUKR0qL17kR3RBg+eba3ReFhrqPSR01SMe sMjw== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOH6fzxfs=" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 46.1.4 DYNA|AUTH) with ESMTPSA id z0b9d9w0K316kKu (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Mon, 20 Jan 2020 04:01:06 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: Re: FreeBSD 11.2: glthread build failure Date: Mon, 20 Jan 2020 04:01:05 +0100 Message-ID: <1770813.AsgGKQxQiM@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-171-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: References: <928aec54-9ccb-7464-20ff-22e1f91e7be7@gmx.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5300::10 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tim =?ISO-8859-1?Q?R=FChsen?= Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Hi Tim, > > FreeBSD 11.2-RELEASE-p4 (with clang 6.0): > >=20 > > CCLD wget2 Please make it a habit to use "make V=3D1" when submitting a report. I don't want to see "CCLD wget2"; I want to see the actual link command line. > > /usr/bin/ld: undefined reference to symbol > > `pthread_mutexattr_gettype@@FBSD_1.0' (try adding -lthr) > > //lib/libthr.so.3: could not read symbols: Bad value > > clang: error: linker command failed with exit code 1 (use -v to see > > invocation) > > gmake[2]: *** [Makefile:1697: wget2] Error 1 I reproduce the issue - with a wget2-1.99.2.tar.gz tarball downloaded from https://gitlab.com/gnuwget/wget2/pipelines - when configuring with --disable-shared - on FreeBSD 11, NOT on FreeBSD 12, - NOT when configuring with --disable-shared --without-lzma The problem is that, somehow, weak symbols don't work well when linking with a library that has a dependency to libpthread.so (-> libthr.so) =2D liblzma.so in this case. Since gnulib cannot forbid any package from linking with liblzma, gnulib has to avoid using weak symbols in this case. This patch should fix the problem. 2020-01-19 Bruno Haible threadlib: Disable use of weak symbols on FreeBSD 11. Reported by Tim R=FChsen in . * m4/threadlib.m4 (gl_WEAK_SYMBOLS): Require AC_CANONICAL_HOST. Test against a bug in FreeBSD 11. diff --git a/m4/threadlib.m4 b/m4/threadlib.m4 index e64ad62..94441f6 100644 =2D-- a/m4/threadlib.m4 +++ b/m4/threadlib.m4 @@ -1,4 +1,4 @@ =2D# threadlib.m4 serial 26 +# threadlib.m4 serial 27 dnl Copyright (C) 2005-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -81,6 +81,7 @@ dnl Checks whether the compiler and linker support weak d= eclarations of symbols. =20 AC_DEFUN([gl_WEAK_SYMBOLS], [ + AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether imported symbols can be declared weak], [gl_cv_have_weak], [gl_cv_have_weak=3Dno @@ -119,6 +120,30 @@ int main () case " $LDFLAGS " in *" -static "*) gl_cv_have_weak=3Dno ;; esac + dnl Test for a bug in FreeBSD 11: A link error occurs when using a we= ak + dnl symbol and linking against a shared library that has a dependency= on + dnl the shared library that defines the symbol. + case "$gl_cv_have_weak" in + *yes) + case "$host_os" in + freebsd* | dragonfly*) + : > conftest1.c + $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so c= onftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1 + cat < conftest2.c +#include +#pragma weak pthread_mutexattr_gettype +int main () +{ + return (pthread_mutexattr_gettype !=3D NULL); +} +EOF + $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libemp= ty.so >&AS_MESSAGE_LOG_FD 2>&1 \ + || gl_cv_have_weak=3Dno + rm -f conftest1.c libempty.so conftest2.c conftest + ;; + esac + ;; + esac ]) case "$gl_cv_have_weak" in *yes)