rust: fix build with glibc

Don't set musl-specific options/ldflags when using glibc.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-03-20 02:08:00 +08:00 committed by Tianling Shen
parent 09d482c3b2
commit bb3082a1c5
2 changed files with 5 additions and 3 deletions

View File

@ -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)"

View File

@ -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
@ -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)