Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/cargo: pass appropriate library path to the linker
@ 2018-12-28 13:25 Thomas Petazzoni
  2019-01-17 22:04 ` Peter Korsgaard
  2019-01-28 17:15 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2018-12-28 13:25 UTC (permalink / raw)
  To: buildroot

When linking the host cargo binary, the linker should be told to find
libraries in $(HOST_DIR)/lib, otherwise it will not work libraries
such as libhttp_parser. This was found with per-package directory
support, where the build failed with:

  = note: /usr/bin/ld: cannot find -lhttp_parser
          collect2: error: ld returned 1 exit status

In order to fix this, instead of passing -L$(HOST_DIR)/lib during the
build of Cargo, we make sure all flags in $(HOST_LDFLAGS) are passed.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/cargo/cargo.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/cargo/cargo.mk b/package/cargo/cargo.mk
index 1b1053ba41..a387281b4c 100644
--- a/package/cargo/cargo.mk
+++ b/package/cargo/cargo.mk
@@ -70,7 +70,7 @@ HOST_CARGO_SNAP_OPTS = \
 	$(if $(VERBOSE),--verbose)
 
 HOST_CARGO_ENV = \
-	RUSTFLAGS="-Clink-arg=-Wl,-rpath,$(HOST_DIR)/lib" \
+	RUSTFLAGS="$(addprefix -Clink-arg=,$(HOST_LDFLAGS))" \
 	CARGO_HOME=$(HOST_CARGO_HOME)
 
 define HOST_CARGO_BUILD_CMDS
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] package/cargo: pass appropriate library path to the linker
  2018-12-28 13:25 [Buildroot] [PATCH] package/cargo: pass appropriate library path to the linker Thomas Petazzoni
@ 2019-01-17 22:04 ` Peter Korsgaard
  2019-01-28 17:15 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2019-01-17 22:04 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > When linking the host cargo binary, the linker should be told to find
 > libraries in $(HOST_DIR)/lib, otherwise it will not work libraries

s/work/find/

> such as libhttp_parser. This was found with per-package directory
 > support, where the build failed with:

 >   = note: /usr/bin/ld: cannot find -lhttp_parser
 >           collect2: error: ld returned 1 exit status

 > In order to fix this, instead of passing -L$(HOST_DIR)/lib during the
 > build of Cargo, we make sure all flags in $(HOST_LDFLAGS) are passed.

 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 > ---
 >  package/cargo/cargo.mk | 2 +-
 >  1 file changed, 1 insertion(+), 1 deletion(-)

 > diff --git a/package/cargo/cargo.mk b/package/cargo/cargo.mk
 > index 1b1053ba41..a387281b4c 100644
 > --- a/package/cargo/cargo.mk
 > +++ b/package/cargo/cargo.mk
 > @@ -70,7 +70,7 @@ HOST_CARGO_SNAP_OPTS = \
 >  	$(if $(VERBOSE),--verbose)
 
 >  HOST_CARGO_ENV = \
 > -	RUSTFLAGS="-Clink-arg=-Wl,-rpath,$(HOST_DIR)/lib" \
 > +	RUSTFLAGS="$(addprefix -Clink-arg=,$(HOST_LDFLAGS))" \

The -Clink-arg= thing looked odd to me, but is apparently how linker
flags are passed:

https://github.com/rust-lang/rust/pull/36574

Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] package/cargo: pass appropriate library path to the linker
  2018-12-28 13:25 [Buildroot] [PATCH] package/cargo: pass appropriate library path to the linker Thomas Petazzoni
  2019-01-17 22:04 ` Peter Korsgaard
@ 2019-01-28 17:15 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2019-01-28 17:15 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > When linking the host cargo binary, the linker should be told to find
 > libraries in $(HOST_DIR)/lib, otherwise it will not work libraries
 > such as libhttp_parser. This was found with per-package directory
 > support, where the build failed with:

 >   = note: /usr/bin/ld: cannot find -lhttp_parser
 >           collect2: error: ld returned 1 exit status

 > In order to fix this, instead of passing -L$(HOST_DIR)/lib during the
 > build of Cargo, we make sure all flags in $(HOST_LDFLAGS) are passed.

 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Committed to 2018.02.x and 2018.11.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-28 17:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-28 13:25 [Buildroot] [PATCH] package/cargo: pass appropriate library path to the linker Thomas Petazzoni
2019-01-17 22:04 ` Peter Korsgaard
2019-01-28 17:15 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox