Skip to content

Commit

Permalink
rust: fix build with glibc
Browse files Browse the repository at this point in the history
Don't set musl-specific options/ldflags when using glibc.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
  • Loading branch information
1715173329 committed Mar 20, 2023
1 parent cd6cec0 commit ee4a467
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lang/rust/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ TARGET_CONFIGURE_ARGS = \
--set=target.$(RUSTC_TARGET_ARCH).cc=$(TARGET_CC_NOCACHE) \
--set=target.$(RUSTC_TARGET_ARCH).cxx=$(TARGET_CXX_NOCACHE) \
--set=target.$(RUSTC_TARGET_ARCH).linker=$(TARGET_CC_NOCACHE) \
--set=target.$(RUSTC_TARGET_ARCH).musl-root=$(TOOLCHAIN_DIR) \
--set=target.$(RUSTC_TARGET_ARCH).ranlib=$(TARGET_RANLIB)
--set=target.$(RUSTC_TARGET_ARCH).ranlib=$(TARGET_RANLIB) \
$(if $(CONFIG_USE_MUSL),--set=target.$(RUSTC_TARGET_ARCH).musl-root=$(TOOLCHAIN_DIR))

# CARGO_HOME is an environmental
HOST_CONFIGURE_OPTS += CARGO_HOME="$(CARGO_HOME)"
Expand Down
4 changes: 3 additions & 1 deletion lang/rust/rust-values.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ CONFIG_HOST_SUFFIX:=$(word 4, $(subst -, ,$(GNU_HOST_NAME)))
RUSTC_HOST_ARCH:=$(HOST_ARCH)-unknown-linux-$(CONFIG_HOST_SUFFIX)
CARGO_HOME:=$(STAGING_DIR_HOSTPKG)/cargo

# Force linking of the SSP library
ifeq ($(CONFIG_USE_MUSL),y)
# Force linking of the SSP library for musl
ifdef CONFIG_PKG_CC_STACKPROTECTOR_REGULAR
ifeq ($(strip $(PKG_SSP)),1)
RUSTC_LDFLAGS += -lssp_nonshared
Expand All @@ -18,6 +19,7 @@ ifdef CONFIG_PKG_CC_STACKPROTECTOR_STRONG
TARGET_CFLAGS += -lssp_nonshared
endif
endif
endif

# mips64 openwrt has a specific targed in rustc
ifeq ($(ARCH),mips64)
Expand Down

0 comments on commit ee4a467

Please sign in to comment.