rust: fix build with glibc
authorTianling Shen <cnsztl@immortalwrt.org>
Sun, 19 Mar 2023 18:08:00 +0000 (02:08 +0800)
committerTianling Shen <cnsztl@gmail.com>
Thu, 23 Mar 2023 18:08:47 +0000 (02:08 +0800)
Don't set musl-specific options/ldflags when using glibc.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
lang/rust/Makefile
lang/rust/rust-values.mk

index 3cdb633ab9be425cef4c28b9b3cd11c1dcda05dc..ca5437aeb6a1b48841ff25003934d6a4d0736cd1 100644 (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)"
index 7fcfcf2a3cccc82bd97fe4b5221357dd4a9eace3..c9eb26f08054297e9cae59c07245151b827a3871 100644 (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)