unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Fis Trivial <ybbs.daans@hotmail.com>
Cc: help-guix <help-guix@gnu.org>
Subject: Re: How to make a working ld in guix pure environment?
Date: Thu, 24 May 2018 22:38:44 +0200	[thread overview]
Message-ID: <87efi0u6uj.fsf@gnu.org> (raw)
In-Reply-To: <BLUPR16MB050019C974107811AEFCAD99926A0@BLUPR16MB0500.namprd16.prod.outlook.com> (Fis Trivial's message of "Thu, 24 May 2018 18:14:07 +0000")

Hello,

Fis Trivial <ybbs.daans@hotmail.com> 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 <math.h>
>
> 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’t fix the problem above.  The problem above is that glibc
is not in the search path.  To fix that, a simple fix would be to add a
wrapper atop ld-wrapper (!) that would add “-L /gnu/store/…-glibc/lib”.

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’.

  reply	other threads:[~2018-05-24 20:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24 18:14 How to make a working ld in guix pure environment? Fis Trivial
2018-05-24 20:38 ` Ludovic Courtès [this message]
2018-05-25  8:48   ` Fis Trivial

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87efi0u6uj.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=help-guix@gnu.org \
    --cc=ybbs.daans@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).