From owner-freebsd-ports@freebsd.org Sat Aug 20 15:10:51 2016 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41A96BC0139; Sat, 20 Aug 2016 15:10:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA46F1347; Sat, 20 Aug 2016 15:10:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u7KFAjpY091982 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 20 Aug 2016 18:10:45 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u7KFAjpY091982 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u7KFAiTw091957; Sat, 20 Aug 2016 18:10:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 20 Aug 2016 18:10:44 +0300 From: Konstantin Belousov To: Tijl Coosemans Cc: Dimitry Andric , freebsd-toolchain@freebsd.org, freebsd-ports@freebsd.org, Steve Kargl , kargl@uw.edu Subject: Re: Problems with out libgcc_s.so in base Message-ID: <20160820151044.GO83214@kib.kiev.ua> References: <20160814230351.GA10587@troutmask.apl.washington.edu> <20160814233430.GA35872@night.db.net> <20160817211710.GA59205@troutmask.apl.washington.edu> <20160818111521.7f79b9f8@kalimero.tijl.coosemans.org> <20160819011432.6f2eadbd@kalimero.tijl.coosemans.org> <20160819072813.GB83214@kib.kiev.ua> <20160819215028.3d8e5b42@kalimero.tijl.coosemans.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160819215028.3d8e5b42@kalimero.tijl.coosemans.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2016 15:10:51 -0000 On Fri, Aug 19, 2016 at 09:50:28PM +0200, Tijl Coosemans wrote: > On Fri, 19 Aug 2016 10:28:14 +0300 Konstantin Belousov wrote: > > The option which would fix all this mess is: > > 1. add rpath for gcc lib/ directory into spec file > > and > > 2. make ports collection use its own compiler instead of fighting with > > the base. > > That still doesn't cover all cases, e.g.: > > port exec -> base lib -> libgcc_s.so.1 > -> port lib -> recent libgcc_s.so.1 > > An example is: > > % echo 'int main(void){}' > test.c > % clang37 -o test test.c -lexecinfo -lgfortran -L/usr/local/lib/gcc5 -Wl,-rpath,/usr/local/lib/gcc5 > % ./test > /lib/libgcc_s.so.1: version GCC_4.6.0 required by /usr/local/lib/gcc5/libgfortran.so.3 not found > > The base library (libexecinfo) doesn't have DT_RPATH or DT_RUNPATH so the > only way rtld can find the right libgcc_s.so is if the executable (test) > has DT_RPATH and no DT_RUNPATH. Clang runs ld with --enable-new-dtags > so the executable has DT_RUNPATH. DT_RPATH is deprecated in the Linux > world so there are probably more ports that use --enable-new-dtags. > Another example seems to be Rust. Indeed, and I rechecked the find_library() code against the latest gABI once more. So base libraries linked against libgcc_s are /lib/libcxxrt.so.1 /usr/lib/libc++.so.1 /usr/lib/libexecinfo.so.1 /usr/lib/libprivatedevdctl.so.0 and only libexecinfo would be somewhat problematic. libcxxrt and libc++ come from C++ runtime, which must be provided by the port's compiler, the private library should not be linked to by behaving applications. I suppose that libexecinfo pull unwinder from libgcc_s. It might be possible just dlopen() libgcc_s for _Unwind_Backtrace, it seems.