Browse Source

package/cargo: pass appropriate library path to the linker

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>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
(cherry picked from commit b5e1b51dd1ee68ee342a3340c9c947c083861eb8)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Thomas Petazzoni 6 năm trước cách đây
mục cha
commit
820a4c61c8
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      package/cargo/cargo.mk

+ 1 - 1
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