From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pjotr Prins Subject: gold linker and collect2: fatal error: cannot find 'ld' Date: Sun, 17 Mar 2019 17:06:16 +0100 Message-ID: <20190317160616.cyv5z7lbsrvbajur@thebird.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([209.51.188.92]:45032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5YTo-0007DD-Px for guix-devel@gnu.org; Sun, 17 Mar 2019 12:17:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h5YOK-0003jG-QR for guix-devel@gnu.org; Sun, 17 Mar 2019 12:12:05 -0400 Received: from mail.thebird.nl ([94.142.245.5]:48492) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5YOK-0003iv-Ia for guix-devel@gnu.org; Sun, 17 Mar 2019 12:12:04 -0400 Content-Disposition: inline List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org Hi all, I am facing some issues with the gold linker. Dlang's ldc compiler recently defaulted to gold as a linker. Ironically if I build ldc itself with binutils-gold it does not find the ld binary. If I don't add binutils-gold ldc builds fine but the tests fail to find the gold linker. Nice one. When I build ldc without tests (successfully) the created compiler environment requires gold. At this point ldc won't honour the --linker switch where you can provide an alternative (i think this is an ldc bug - no matter because I think using gold is a great idea). Anyway, pulling in binutils-gold compiles my software fine if you set LD_LIBRARY_PATH to LIBRARY_PATH. This is because the latter is not honoured by gold. Note that gold has a compatibility layer for ld, but it does not pick up environment variables (on purpose). Unfortunately the runtime of compiled software fails because the rpath is not updated either. So that requires adding in the RPATH explicitly on the ldc command line. When I set the RPATH the runtime is fine. I am posting this here so others can benefit when they run into similar issues later. Maybe the solution is to create an ld-wrapper style gold-wrapper for gold. Wdyt? Also I need to somehow resolve the ldc tests running on gold. Can we pull in standard ld and gold at the same time? binutils-gold suggests not. Pj.