diff --git a/toolchain/build.sh b/toolchain/build.sh index ad2b2ca..4a88461 100644 --- a/toolchain/build.sh +++ b/toolchain/build.sh @@ -24,27 +24,34 @@ elif [ "$model" = "OpenWrt_X86_64_v24.10" ]; then curl -s $Github/target-modify_for_x86_64.patch | patch -p1 fi -# fix gcc14 and gcc15 +# fix gcc14 if [ "$USE_GCC14" = y ] || [ "$USE_GCC15" = y ]; then - # 如果是 GCC 14 或 GCC 15,则替换并克隆修复后的 linux-atm - echo "Detected GCC 14 or 15. Replacing linux-atm with a fixed version..." - - # 移除原有的 linux-atm 软件包 + # linux-atm rm -rf package/network/utils/linux-atm - - # 从 GitHub 克隆修复后的 linux-atm 软件包 - git clone https://github.com/sbwml/package_network_utils_linux-atm package/network/utils/linux-atm - - # 检查是否克隆成功 - if [ -d "package/network/utils/linux-atm" ]; then - echo "linux-atm has been successfully replaced for GCC 14/15 compatibility." - else - echo "Failed to clone the fixed linux-atm package. Please check your network or the repository URL." - exit 1 + git clone https://$github/sbwml/package_network_utils_linux-atm package/network/utils/linux-atm + # glibc + # Added the compiler flag -Wno-implicit-function-declaration to suppress + # warnings about implicit function declarations during the build process. + # This change addresses build issues in environments where some functions + # are used without prior declaration. + if [ "$ENABLE_GLIBC" = "y" ]; then + # perl + sed -i "/Target perl/i\TARGET_CFLAGS_PERL += -Wno-implicit-function-declaration -Wno-int-conversion\n" feeds/packages/lang/perl/Makefile + sed -i '/HOST_BUILD_PARALLEL/aPKG_BUILD_FLAGS:=no-mold' feeds/packages/lang/perl/Makefile + # lucihttp + sed -i "/TARGET_CFLAGS/i\TARGET_CFLAGS += -Wno-implicit-function-declaration" feeds/luci/contrib/package/lucihttp/Makefile + # rpcd + sed -i "/TARGET_LDFLAGS/i\TARGET_CFLAGS += -Wno-implicit-function-declaration" package/system/rpcd/Makefile + # ucode-mod-lua + sed -i "/Build\/Configure/i\TARGET_CFLAGS += -Wno-implicit-function-declaration" feeds/luci/contrib/package/ucode-mod-lua/Makefile + # luci-base + sed -i "s/-DNDEBUG/-DNDEBUG -Wno-implicit-function-declaration/g" feeds/luci/modules/luci-base/src/Makefile + # uhttpd + sed -i "/Package\/uhttpd\/install/i\TARGET_CFLAGS += -Wno-implicit-function-declaration\n" package/network/services/uhttpd/Makefile + # shadow + sed -i '/TARGET_LDFLAGS/d' feeds/packages/utils/shadow/Makefile + sed -i 's/libxcrypt/openssl/g' feeds/packages/utils/shadow/Makefile fi -else - # 如果不是 GCC 14 或 GCC 15,则什么都不做 - echo "GCC 14 or 15 not enabled. Skipping linux-atm replacement." fi # fix gcc-15