From 709a9f9329d5ad11c6061eeca4cc39aff2412f17 Mon Sep 17 00:00:00 2001 From: Thomas Hebb Date: Fri, 1 Jan 2021 22:42:31 -0800 Subject: [PATCH] Don't use cross-compilation environment for Python requirements install We should eventually just get rid of the "pip install" invocation in the Makefile altogether and replace it with good documentation for manual environment setup. Bot for the moment we have it and so we should make it work even in the case where it needs to compile code. This should fix the CI problems on macOS and Ubuntu 19.10. I was torn between fixing it this way and removing the "export"s from the Makefile altogether, replacing them with explicit variable passing to submakes. But I figure that it's probably correct to have $CC and friends automatically set to the cross compiler since the entire purpose of these Makefiles is to build code for the BL602. If we ever delegate some functionality to a shell script, it'll be nice to just have $CC automagically set. So I've kept the exports and fixed it this way instead. --- make_scripts_riscv/project.mk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/make_scripts_riscv/project.mk b/make_scripts_riscv/project.mk index 66c41c7b..0d078bb4 100644 --- a/make_scripts_riscv/project.mk +++ b/make_scripts_riscv/project.mk @@ -183,11 +183,16 @@ export COMPONENT_INCLUDES include $(BL60X_SDK_PATH)/make_scripts_riscv/common.mk include $(BL60X_SDK_PATH)/make_scripts_riscv/toolchain.mk +# In this recipe, "pip install" may need to build native code, so make sure it +# doesn't use the cross-compilation environment. The specific list of variables +# unset is taken from the intersection of what we export and what Python's +# distutils uses (see CPython's Lib/distutils/sysconfig.py). all: ifeq ("$(OS)","Windows_NT") else ifeq ("$(CONFIG_CHIP_NAME)", "BL602") - @cd $(BL60X_SDK_PATH)/image_conf && python3 -m pip install -r requirements.txt && python3 flash_build.py $(PROJECT_NAME) $(CONFIG_CHIP_NAME) + @env -u CC -u CXX -u AR -u CFLAGS -u CPPFLAGS python3 -m pip install -r $(BL60X_SDK_PATH)/image_conf/requirements.txt + @cd $(BL60X_SDK_PATH)/image_conf && python3 flash_build.py $(PROJECT_NAME) $(CONFIG_CHIP_NAME) endif endif @echo "Building Finish. To flash build output."