* [Buildroot] [PATCH] Sets LD_LIBRARY_PATH inside toolchain-wrapper.
@ 2018-02-16 22:18 Daniel Serpell
2018-02-16 22:46 ` Thomas Petazzoni
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Serpell @ 2018-02-16 22:18 UTC (permalink / raw)
To: buildroot
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
^ permalink raw reply related [flat|nested] 4+ messages in thread* [Buildroot] [PATCH] Sets LD_LIBRARY_PATH inside toolchain-wrapper.
2018-02-16 22:18 [Buildroot] [PATCH] Sets LD_LIBRARY_PATH inside toolchain-wrapper Daniel Serpell
@ 2018-02-16 22:46 ` Thomas Petazzoni
[not found] ` <CANepG=MckvkieMHtLfR2fsrH1yJzvjUwDiritOk-YvP5-ghE8g@mail.gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2018-02-16 22:46 UTC (permalink / raw)
To: buildroot
Hello,
On Fri, 16 Feb 2018 19:18:45 -0300, Daniel Serpell wrote:
> 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>
This is not needed. If you want to move around the host toolchain
folder, run "make sdk", which prepares the host toolchain to be a
relocatable SDK.
See slide 280 of
https://bootlin.com/doc/training/buildroot/buildroot-slides.pdf for
more details.
And yes, we should mention this in the Buildroot manual. Patches
welcome :-)
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-18 14:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-16 22:18 [Buildroot] [PATCH] Sets LD_LIBRARY_PATH inside toolchain-wrapper Daniel Serpell
2018-02-16 22:46 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox