From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: How to make a working ld in guix pure environment? Date: Thu, 24 May 2018 22:38:44 +0200 Message-ID: <87efi0u6uj.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fLx0Z-0005L5-2l for help-guix@gnu.org; Thu, 24 May 2018 16:38:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fLx0Y-0002HX-8v for help-guix@gnu.org; Thu, 24 May 2018 16:38:47 -0400 In-Reply-To: (Fis Trivial's message of "Thu, 24 May 2018 18:14:07 +0000") List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Fis Trivial Cc: help-guix Hello, Fis Trivial skribis: > I tried to use ld in guix pure environment, tested with bintuils, > gcc-toolchain, ld-wrapper, and none of them work. > > Take the following trivial snippy (not opencl related) as an example: > > // main.c > #include > > int main() > { > log1p(32); > } > > > To build it, one would do something similar to `ld -lm main.o` after > compilation. But I got an error saying "ld: cannot find -lm". You would need to use ld-wrapper, not ld, so that ld-wrapper sets the RUNPATH appropriately. But this won=E2=80=99t fix the problem above. The problem above is that gl= ibc is not in the search path. To fix that, a simple fix would be to add a wrapper atop ld-wrapper (!) that would add =E2=80=9C-L /gnu/store/=E2=80=A6= -glibc/lib=E2=80=9D. Perhaps there are more elegant ways to achieve it though. How is ld invoked? Would it work to add that -L flag directly in the code that invokes ld? HTH! Ludo=E2=80=99.