Hello everyone,
While compiling on the OpenWrt 21.02 branch, I encountered an issue where a plugin requires the Ninja toolchain. After referring to the OpenWrt main branch, I made modifications to the following files. However, when using GitHub Actions for compilation, I still encounter the following error:
time: tools/ninja/compile#0.00#0.00#0.00
ERROR: tools/ninja failed to build.
Upon checking the detailed logs, I found that the directory under tools
could not be found (make[2]: *** tools/ninja: No such file or directory. Stop.
), even though I had manually copied it via the command line.
At the moment, I don’t have a good solution for this issue. Below are portions of the code from the OpenWrt main branch that I referenced to modify the 21.02 branch. Any advice or guidance from experienced members would be greatly appreciated.
rules.mk
NINJA = \
MAKEFLAGS="$(MAKE_JOBSERVER)" \
$(STAGING_DIR_HOST)/bin/ninja \
$(if $(findstring c,$(OPENWRT_VERBOSE)),-v) \
$(if $(MAKE_JOBSERVER),,-j1)
tools/Makefile
$(curdir)/meson/compile := $(curdir)/ninja/compile
$(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile
ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),)
$(foreach tool, $(filter-out xz zstd patch pkgconf libressl ninja meson cmake,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile))
tools-y += ccache
$(curdir)/ccache/compile := $(curdir)/zstd/compile
endif
include/cmake.mk
PKG_USE_NINJA ?= 1
HOST_USE_NINJA ?= 1
ifeq ($(PKG_USE_NINJA),1)
PKG_BUILD_PARALLEL ?= 1
endif
ifeq ($(HOST_USE_NINJA),1)
HOST_BUILD_PARALLEL ?= 1
endif
ifeq ($(HOST_USE_NINJA),1)
CMAKE_HOST_OPTIONS += -DCMAKE_GENERATOR="Ninja"
define Host/Compile/Default
+$(NINJA) -C $(HOST_CMAKE_BINARY_DIR) $(1)
endef
define Host/Install/Default
+$(NINJA) -C $(HOST_CMAKE_BINARY_DIR) install
endef
define Host/Uninstall/Default
+$(NINJA) -C $(HOST_CMAKE_BINARY_DIR) uninstall
endef
else
CMAKE_HOST_OPTIONS += -DCMAKE_GENERATOR="Unix Makefiles"
endif
ifeq ($(PKG_USE_NINJA),1)
CMAKE_OPTIONS += -DCMAKE_GENERATOR="Ninja"
define Build/Compile/Default
+$(NINJA) -C $(CMAKE_BINARY_DIR) $(1)
endef
define Build/Install/Default
+DESTDIR="$(PKG_INSTALL_DIR)" $(NINJA) -C $(CMAKE_BINARY_DIR) install
endef
else
CMAKE_OPTIONS += -DCMAKE_GENERATOR="Unix Makefiles"
endif
This is my action url:https://github.com/yuos-bit/AutoBuild-OpenWrt
Thanks evreyone!