From: Daniel Serpell <daniel.serpell@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] Sets LD_LIBRARY_PATH inside toolchain-wrapper.
Date: Fri, 16 Feb 2018 19:18:45 -0300 [thread overview]
Message-ID: <20180216221845.13337-1-daniel.serpell@gmail.com> (raw)
Setting the host library path in the toolchain wrapper allows moving the
host toolchain folder to a new path, as some of the tools depends on
buildroot provided libraries.
Signed-off-by: Daniel Serpell <daniel.serpell@gmail.com>
---
toolchain/toolchain-wrapper.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c
index 2928ea42d0..53ea73fdf1 100644
--- a/toolchain/toolchain-wrapper.c
+++ b/toolchain/toolchain-wrapper.c
@@ -231,6 +231,7 @@ int main(int argc, char **argv)
char *progpath = argv[0];
char *basename;
char *env_debug;
+ char *ld_path, *new_ld_path;
char *paranoid_wrapper;
int paranoid;
int ret, i, count = 0, debug;
@@ -442,6 +443,19 @@ int main(int argc, char **argv)
}
#endif
+ /* Adds library path to our host libraries */
+ if ((ld_path = getenv("LD_LIBRARY_PATH")) && ld_path[0]) {
+ new_ld_path = malloc(strlen(ld_path) + strlen(absbasedir) + 6);
+ sprintf(new_ld_path, "%s:%s/lib", ld_path, absbasedir);
+ } else {
+ new_ld_path = malloc(strlen(absbasedir) + 5);
+ sprintf(new_ld_path, "%s/lib", absbasedir);
+ }
+ if (setenv("LD_LIBRARY_PATH", new_ld_path, 1)) {
+ perror(__FILE__ ": Failed to set LD_LIBRARY_PATH");
+ return 3;
+ }
+
if (execv(exec_args[0], exec_args))
perror(path);
--
2.16.1
next reply other threads:[~2018-02-16 22:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-16 22:18 Daniel Serpell [this message]
2018-02-16 22:46 ` [Buildroot] [PATCH] Sets LD_LIBRARY_PATH inside toolchain-wrapper Thomas Petazzoni
[not found] ` <CANepG=MckvkieMHtLfR2fsrH1yJzvjUwDiritOk-YvP5-ghE8g@mail.gmail.com>
2018-02-17 0:43 ` Daniel Serpell
2018-02-18 14:30 ` Thomas Petazzoni
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180216221845.13337-1-daniel.serpell@gmail.com \
--to=daniel.serpell@gmail.com \
--cc=buildroot@busybox.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.