找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 3331|回复: 34

关于openwrt21.02下编译upx4.0.2报错的请教

[复制链接]
悬赏100恩山币已解决
客户机环境:乌班图22.04


使用的源码:openwrt官方的21.02分支

使用的upx源码:https://github.com/coolsnowwolf/ ... e/lean/upx/Makefile
  1. #
  2. # Copyright (C) 2011-2020 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk

  8. PKG_NAME:=upx
  9. PKG_VERSION:=4.2.2
  10. PKG_RELEASE:=1

  11. PKG_SOURCE_PROTO:=git
  12. PKG_SOURCE_URL:=https://github.com/upx/upx.git
  13. PKG_SOURCE_VERSION:=099c3d829e80488af7395a4242b318877e980da4
  14. PKG_MIRROR_HASH:=8bee3cd1ada2e4bfbe396348d2aecb3e044f92cdae2b7010838e36997fe6b3c3

  15. PKG_MAINTAINER:=Xingwang Liao <kuoruan@gmail.com>
  16. PKG_LICENSE:=GPL-2.0-only
  17. PKG_LICENSE_FILES:=COPYING LICENSE

  18. HOST_BUILD_DEPENDS:=ucl/host
  19. MAKE_PATH:=src

  20. include $(INCLUDE_DIR)/package.mk
  21. include $(INCLUDE_DIR)/host-build.mk

  22. define Package/upx
  23.   SECTION:=utils
  24.   CATEGORY:=Utilities
  25.   DEPENDS:=+libucl +libstdcpp +zlib
  26.   TITLE:=The Ultimate Packer for eXecutables
  27.   URL:=https://upx.github.io/
  28. endef

  29. define Package/upx/description
  30. UPX is a free, secure, portable, extendable, high-performance
  31. executable packer for several executable formats.
  32. endef

  33. define Host/Compile
  34.         UPX_UCLDIR=$(STAGING_DIR_HOST) \
  35.         $(MAKE) -C $(HOST_BUILD_DIR)/src \
  36.                 LDFLAGS="$(HOST_LDFLAGS)" \
  37.                 CXX="$(HOSTCXX)"
  38. endef

  39. define Host/Install
  40.         $(CP) $(HOST_BUILD_DIR)/build/release/upx $(STAGING_DIR_HOST)/bin/upx
  41. endef

  42. define Host/Clean
  43.         rm -f $(STAGING_DIR_HOST)/bin/upx
  44. endef

  45. define Package/upx/install
  46.         $(INSTALL_DIR) $(1)/usr/bin
  47.         $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/release/upx $(1)/usr/bin/upx
  48. endef

  49. $(eval $(call HostBuild))
  50. $(eval $(call BuildPackage,upx))
复制代码
遇到的报错日志:
  1. make[2]: Entering directory '/workdir/openwrt/feeds/small8/upx'
  2. mkdir -p /workdir/openwrt/dl
  3. SHELL= flock /workdir/openwrt/tmp/.upx-4.2.3-src.tar.xz.flock -c '          /workdir/openwrt/scripts/download.pl "/workdir/openwrt/dl" "upx-4.2.3-src.tar.xz" "d6357eec6ed4c1b51f40af2316b0958ff1b7fa6f53ef3de12da1d5c96d30e412" "" "https://github.com/upx/upx/releases/download/v4.2.3"    '
  4. touch /workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/.prepared_8ab2f467838f73a03180672eee52e05a_6664517399ebbbc92a37c5bb081b5c53_check
  5. . /workdir/openwrt/include/shell.sh; xzcat /workdir/openwrt/dl/upx-4.2.3-src.tar.xz | tar -C /workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/.. -xf -
  6. [ ! -d ./src/ ] || cp -fpR ./src/. /workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src
  7. touch /workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/.prepared_8ab2f467838f73a03180672eee52e05a_6664517399ebbbc92a37c5bb081b5c53
  8. rm -f /workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/.configured_*
  9. rm -f /workdir/openwrt/staging_dir/target-mipsel_24kc_musl/stamp/.upx_installed
  10. mkdir -p /workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build
  11. (cd /workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build; CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fmacro-prefix-map=/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src=upx-4.2.3-src -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fmacro-prefix-map=/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src=upx-4.2.3-src -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " LDFLAGS="-L/workdir/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/usr/lib -L/workdir/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.
  12. -- UPX_VERSION_GITREV: disabled
  13. -- The C compiler identification is GNU 8.4.0
  14. -- The CXX compiler identification is GNU 8.4.0
  15. -- Detecting C compiler ABI info
  16. -- Detecting C compiler ABI info - done
  17. -- Check for working C compiler: /workdir/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-musl-gcc - skipped
  18. -- Detecting C compile features
  19. -- Detecting C compile features - done
  20. -- Detecting CXX compiler ABI info
  21. -- Detecting CXX compiler ABI info - done
  22. -- Check for working CXX compiler: /workdir/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-musl-g++ - skipped
  23. -- Detecting CXX compile features
  24. -- Detecting CXX compile features - done
  25. -- CMAKE_VERSION = 3.25.2
  26. -- CMAKE_GENERATOR = Unix Makefiles
  27. -- CMAKE_HOST_SYSTEM_NAME = Linux
  28. -- CMAKE_HOST_SYSTEM_VERSION = 6.5.0-1018-azure
  29. -- CMAKE_HOST_SYSTEM_PROCESSOR = x86_64
  30. -- CMAKE_SYSTEM_NAME = Linux
  31. -- CMAKE_SYSTEM_VERSION = 1
  32. -- CMAKE_SYSTEM_PROCESSOR = mipsel
  33. -- CMAKE_CROSSCOMPILING = TRUE
  34. -- CMAKE_C_COMPILER = /workdir/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-musl-gcc
  35. -- CMAKE_CXX_COMPILER = /workdir/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-musl-g++
  36. -- CMAKE_AR = /workdir/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-musl-gcc-ar
  37. -- CMAKE_RANLIB = /workdir/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin/mipsel-openwrt-linux-musl-gcc-ranlib
  38. -- CMAKE_C_COMPILER_ID = GNU
  39. -- CMAKE_C_COMPILER_VERSION = 8.4.0
  40. -- CMAKE_C_PLATFORM_ID = Linux
  41. -- CMAKE_C_COMPILER_ABI = ELF
  42. -- CMAKE_CXX_COMPILER_ID = GNU
  43. -- CMAKE_CXX_COMPILER_VERSION = 8.4.0
  44. -- CMAKE_CXX_PLATFORM_ID = Linux
  45. -- CMAKE_CXX_COMPILER_ABI = ELF
  46. -- CMAKE_TRY_COMPILE_CONFIGURATION = Release
  47. -- UNIX = 1
  48. -- CMAKE_INSTALL_PREFIX = /usr
  49. -- CMAKE_BUILD_TYPE = Release
  50. -- Configuring done
  51. -- Generating done
  52. CMake Warning:
  53.   Manually-specified variables were not used by the project:
  54.     CMAKE_ASM_COMPILER
  55.     CMAKE_ASM_COMPILER_LAUNCHER
  56.     CMAKE_EXPORT_NO_PACKAGE_REGISTRY
  57.     CMAKE_EXPORT_PACKAGE_REGISTRY
  58.     CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY
  59.     CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY
  60.     CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
  61.     CMAKE_FIND_USE_PACKAGE_REGISTRY
  62.     CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY
  63.     CMAKE_MODULE_LINKER_FLAGS
  64.     CMAKE_SHARED_LINKER_FLAGS
  65.     DL_LIBRARY
  66. -- Build files have been written to: /workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build
  67. touch /workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/.configured_68b329da9893e34099c7d8ad5cb9c940
  68. rm -f /workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/.built
  69. touch /workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/.built_check
  70. CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fmacro-prefix-map=/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src=upx-4.2.3-src -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/workdir/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/usr/include -I/workdir/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include/fortify -I/workdir/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/include " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fmacro-prefix-map=/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src=upx-4.2.3-src -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,
  71. make[3]: Entering directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  72. make[4]: Entering directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  73. make[5]: Entering directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  74. make[5]: Leaving directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  75. make[5]: Entering directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  76. [  1%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/alloc.c.o
  77. [  2%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/n2b_99.c.o
  78. [  3%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/n2b_d.c.o
  79. [  4%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/n2b_ds.c.o
  80. [  5%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/n2b_to.c.o
  81. [  6%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/n2d_99.c.o
  82. [  7%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/n2d_d.c.o
  83. [  8%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/n2d_ds.c.o
  84. [  9%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/n2d_to.c.o
  85. [ 10%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/n2e_99.c.o
  86. [ 11%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/n2e_d.c.o
  87. [ 12%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/n2e_ds.c.o
  88. [ 13%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/n2e_to.c.o
  89. [ 14%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/ucl_crc.c.o
  90. [ 15%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/ucl_init.c.o
  91. [ 16%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/ucl_ptr.c.o
  92. [ 17%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/ucl_str.c.o
  93. [ 18%] Building C object CMakeFiles/upx_vendor_ucl.dir/vendor/ucl/src/ucl_util.c.o
  94. [ 20%] Linking C static library libupx_vendor_ucl.a
  95. make[5]: Leaving directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  96. [ 20%] Built target upx_vendor_ucl
  97. make[5]: Entering directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  98. make[5]: Leaving directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  99. make[5]: Entering directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  100. [ 21%] Building C object CMakeFiles/upx_vendor_zlib.dir/vendor/zlib/adler32.c.o
  101. [ 22%] Building C object CMakeFiles/upx_vendor_zlib.dir/vendor/zlib/crc32.c.o
  102. [ 23%] Building C object CMakeFiles/upx_vendor_zlib.dir/vendor/zlib/deflate.c.o
  103. [ 24%] Building C object CMakeFiles/upx_vendor_zlib.dir/vendor/zlib/gzclose.c.o
  104. [ 25%] Building C object CMakeFiles/upx_vendor_zlib.dir/vendor/zlib/gzlib.c.o
  105. [ 26%] Building C object CMakeFiles/upx_vendor_zlib.dir/vendor/zlib/gzread.c.o
  106. [ 27%] Building C object CMakeFiles/upx_vendor_zlib.dir/vendor/zlib/gzwrite.c.o
  107. [ 28%] Building C object CMakeFiles/upx_vendor_zlib.dir/vendor/zlib/infback.c.o
  108. [ 29%] Building C object CMakeFiles/upx_vendor_zlib.dir/vendor/zlib/inffast.c.o
  109. [ 30%] Building C object CMakeFiles/upx_vendor_zlib.dir/vendor/zlib/inflate.c.o
  110. [ 31%] Building C object CMakeFiles/upx_vendor_zlib.dir/vendor/zlib/inftrees.c.o
  111. [ 32%] Building C object CMakeFiles/upx_vendor_zlib.dir/vendor/zlib/trees.c.o
  112. [ 33%] Building C object CMakeFiles/upx_vendor_zlib.dir/vendor/zlib/zutil.c.o
  113. [ 34%] Linking C static library libupx_vendor_zlib.a
  114. make[5]: Leaving directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  115. [ 34%] Built target upx_vendor_zlib
  116. make[5]: Entering directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  117. make[5]: Leaving directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  118. make[5]: Entering directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  119. [ 35%] Building CXX object CMakeFiles/upx.dir/src/check/dt_check.cpp.o
  120. [ 36%] Building CXX object CMakeFiles/upx.dir/src/check/dt_cxxlib.cpp.o
  121. [ 37%] Building CXX object CMakeFiles/upx.dir/src/check/dt_impl.cpp.o
  122. [ 38%] Building CXX object CMakeFiles/upx.dir/src/check/dt_xspan.cpp.o
  123. {standard input}: Assembler messages:
  124. {standard input}:899: Error: invalid operands `srl $0,$0,13'
  125. {standard input}:900: Error: invalid operands `srl $0,$0,29'
  126. {standard input}:901: Error: invalid operands `srl $0,$0,3'
  127. {standard input}:902: Error: invalid operands `srl $0,$0,19'
  128. {standard input}:903: Error: invalid operands `or $13,$13,$13'
  129. make[5]: *** [CMakeFiles/upx.dir/build.make:118: CMakeFiles/upx.dir/src/check/dt_xspan.cpp.o] Error 1
  130. make[4]: *** [CMakeFiles/Makefile2:140: CMakeFiles/upx.dir/all] Error 2
  131. make[5]: Leaving directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  132. make[4]: Leaving directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  133. make[3]: Leaving directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/openwrt-build'
  134. make[3]: *** [Makefile:136: all] Error 2
  135. make[2]: *** [Makefile:60: /workdir/openwrt/build_dir/target-mipsel_24kc_musl/upx-4.2.3-src/.built] Error 2
  136. make[2]: Leaving directory '/workdir/openwrt/feeds/small8/upx'
  137. time: package/feeds/small8/upx/compile#8.85#1.05#9.50
  138.     ERROR: package/feeds/small8/upx failed to build.
  139. make[1]: *** [package/Makefile:120: package/feeds/small8/upx/compile] Error 1
  140. make[1]: Leaving directory '/workdir/openwrt'
  141. make: *** [/workdir/openwrt/include/toplevel.mk:230: package/upx/compile] Error 2
  142. Error: Process completed with exit code 2.
复制代码


需求:需要使用upx压缩xray

即:
  1. $(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/main
复制代码


请问各位大佬,这个问题该如何解决?
  1. {standard input}: Assembler messages:
  2. {standard input}:899: Error: invalid operands `srl $0,$0,13'
  3. {standard input}:900: Error: invalid operands `srl $0,$0,29'
  4. {standard input}:901: Error: invalid operands `srl $0,$0,3'
  5. {standard input}:902: Error: invalid operands `srl $0,$0,19'
  6. {standard input}:903: Error: invalid operands `or $13,$13,$13'
复制代码


最佳答案

查看完整内容

这样添加到Makefile里 先下载upx预编译好的文件到STAGING_DIR_HOST里
我的恩山、我的无线 The best wifi forum is right here.
本帖最后由 8267 于 2024-4-18 22:29 编辑
  1. define Download/upx
  2.   FILE:=upx-4.2.3-amd64_linux.tar.xz
  3.   URL_FILE:=upx.tar.xz
  4.   URL:=https://github.com/upx/upx/releases/download/v4.2.3/
  5.   HASH:=skip
  6. endef

  7. define Build/Prepare
  8.     $(call Build/Prepare/Default)
  9.     $(eval $(call Download,upx))
  10.     $(TAR) --strip-components=1 -C $(PKG_BUILD_DIR)/ -xvf $(DL_DIR)/upx-4.2.3-amd64_linux.tar.xz
  11.     $(CP) $(PKG_BUILD_DIR)/upx $(STAGING_DIR_HOST)/bin/upx
  12. endef
复制代码
这样添加到Makefile里 先下载upx预编译好的文件到STAGING_DIR_HOST里


  1. include $(TOPDIR)/rules.mk

  2. PKG_NAME:=Xray-core
  3. PKG_VERSION:=1.8.7
  4. PKG_RELEASE:=77

  5. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  6. PKG_SOURCE_URL:=https://codeload.github.com/XTLS/Xray-core/tar.gz/v$(PKG_VERSION)?
  7. PKG_HASH:=skip

  8. PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
  9. PKG_LICENSE:=MPL-2.0
  10. PKG_LICENSE_FILES:=LICENSE

  11. PKG_BUILD_DEPENDS:=golang/host
  12. PKG_BUILD_PARALLEL:=1
  13. PKG_USE_MIPS16:=0
  14. PKG_BUILD_FLAGS:=no-mips16

  15. GO_PKG:=github.com/xtls/xray-core
  16. GO_PKG_BUILD_PKG:=$(GO_PKG)/main
  17. GO_PKG_LDFLAGS_X:= \
  18.         $(GO_PKG)/core.build=OpenWrt \
  19.         $(GO_PKG)/core.version=$(PKG_VERSION)

  20. include $(INCLUDE_DIR)/package.mk
  21. include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
  22. define Download/upx
  23.   FILE:=upx-4.2.3-amd64_linux.tar.xz
  24.   URL_FILE:=upx.tar.xz
  25.   URL:=https://github.com/upx/upx/releases/download/v4.2.3/
  26.   HASH:=skip
  27. endef
  28. define Build/Prepare
  29.         $(call Build/Prepare/Default)
  30.         $(eval $(call Download,upx))
  31.         $(TAR) --strip-components=1 -C $(PKG_BUILD_DIR)/ -xvf $(DL_DIR)/upx-4.2.3-amd64_linux.tar.xz
  32.         $(CP) $(PKG_BUILD_DIR)/upx $(STAGING_DIR_HOST)/bin/upx
  33. endef
  34. define Package/xray/template
  35.   TITLE:=A platform for building proxies to bypass network restrictions
  36.   SECTION:=net
  37.   CATEGORY:=Network
  38.   URL:=https://xtls.github.io
  39. endef

  40. define Package/xray-core
  41.   $(call Package/xray/template)
  42.   DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
  43. endef

  44. define Package/xray-example
  45.   $(call Package/xray/template)
  46.   TITLE+= (example configs)
  47.   DEPENDS:=xray-core
  48.   PKGARCH:=all
  49. endef

  50. define Package/xray/description
  51.   Xray, Penetrates Everything. It helps you to build your own computer network.
  52.   It secures your network connections and thus protects your privacy.
  53. endef

  54. define Package/xray-core/description
  55.   $(call Package/xray/description)
  56. endef

  57. define Package/xray-example/description
  58.   $(call Package/xray/description)

  59.   This includes example configuration files for xray-core.
  60. endef

  61. define Package/xray-core/conffiles
  62. /etc/xray/
  63. /etc/config/xray
  64. endef

  65. define Package/xray-core/install
  66.         $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
  67.         $(INSTALL_DIR) $(1)/usr/bin/
  68.         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/main $(1)/usr/bin/xray
  69. <span>$(STAGING_DIR_HOST)/bin/upx --lzma --best  </span>$(1)/usr/bin/xray
  70.         $(INSTALL_DIR) $(1)/etc/xray/
  71.         $(INSTALL_DATA) $(CURDIR)/files/config.json.example $(1)/etc/xray/

  72.         $(INSTALL_DIR) $(1)/etc/config/
  73.         $(INSTALL_CONF) $(CURDIR)/files/xray.conf $(1)/etc/config/xray
  74.         $(INSTALL_DIR) $(1)/etc/init.d/
  75.         $(INSTALL_BIN) $(CURDIR)/files/xray.init $(1)/etc/init.d/xray
  76. endef

  77. define Package/xray-example/install
  78.         $(INSTALL_DIR) $(1)/etc/xray/
  79.         $(INSTALL_DATA) $(CURDIR)/files/vpoint_socks_vmess.json $(1)/etc/xray/
  80.         $(INSTALL_DATA) $(CURDIR)/files/vpoint_vmess_freedom.json $(1)/etc/xray/
  81. endef

  82. $(eval $(call BuildPackage,xray-core))
  83. $(eval $(call BuildPackage,xray-example))
复制代码


点评

何必呢?少说几句吧,网络这么大,聚到一起也不容易!: 5.0
何必呢?少说几句吧,网络这么大,聚到一起也不容易!: 5
  发表于 2024-4-18 23:51
感谢大佬的回复,我这边根据我自己的代码优化了下,现在测试。 如下贴上:  详情 回复 发表于 2024-4-18 23:17
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
不论是4.0.2还是lean的4.2.2都是这个报错
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

https://github.com/upx/upx/releases

这不是有预编译的版本吗

点评

主要是因为我需要在github action里运行这个编译,所以没有太好的办法内置预编译的  详情 回复 发表于 2024-4-18 09:21
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
TheKiller 发表于 2024-4-18 00:53
https://github.com/upx/upx/releases

这不是有预编译的版本吗

主要是因为我需要在github action里运行这个编译,所以没有太好的办法内置预编译的
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
8267 发表于 2024-4-18 22:22
这样添加到Makefile里 先下载upx预编译好的文件到STAGING_DIR_HOST里

感谢大佬的回复,我这边根据我自己的代码优化了下,现在测试。

如下贴上:

  1. include $(TOPDIR)/rules.mk

  2. PKG_NAME:=xray-core
  3. PKG_VERSION:=1.7.5
  4. PKG_RELEASE:=1

  5. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  6. PKG_SOURCE_URL:=https://codeload.github.com/XTLS/Xray-core/tar.gz/v$(PKG_VERSION)?
  7. PKG_HASH:=a5fc936136a57a463bf9a895d068fdfa895b168ae6093c58a10208e098b6b2d3

  8. PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
  9. PKG_LICENSE:=MPL-2.0
  10. PKG_LICENSE_FILES:=LICENSE

  11. PKG_BUILD_DIR:=$(BUILD_DIR)/Xray-core-$(PKG_VERSION)
  12. PKG_BUILD_DEPENDS:=golang/host  upx/host
  13. PKG_BUILD_PARALLEL:=1
  14. PKG_USE_MIPS16:=0

  15. GO_PKG:=github.com/xtls/xray-core
  16. GO_PKG_LDFLAGS:=-s -w
  17. GO_PKG_BUILD_PKG:=$(GO_PKG)/main
  18. GO_PKG_LDFLAGS_X:= \
  19.         $(GO_PKG)/core.build=OpenWrt \
  20.         $(GO_PKG)/core.version=$(PKG_VERSION)

  21. include $(INCLUDE_DIR)/package.mk
  22. include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk

  23. define Download/upx
  24.   FILE:=upx-4.2.3-amd64_linux.tar.xz
  25.   URL_FILE:=upx.tar.xz
  26.   URL:=https://github.com/upx/upx/releases/download/v4.2.3/
  27.   HASH:=skip
  28. endef

  29. define Build/Prepare
  30.   $(call Build/Prepare/Default)
  31.   $(eval $(call Download,upx))
  32.   $(TAR) --strip-components=1 -C $(PKG_BUILD_DIR)/ -xvf $(DL_DIR)/upx-4.2.3-amd64_linux.tar.xz
  33.   $(CP) $(PKG_BUILD_DIR)/upx $(STAGING_DIR_HOST)/bin/upx
  34. endef

  35. define Package/xray-core
  36.   TITLE:=A platform for building proxies to bypass network restrictions
  37.   SECTION:=net
  38.   CATEGORY:=Network
  39.   URL:=https://xtls.github.io
  40.   DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
  41. endef

  42. define Package/xray-core/description
  43.   Xray, Penetrates Everything. It helps you to build your own computer network.
  44.   It secures your network connections and thus protects your privacy.
  45. endef


  46. define Package/xray-core/install
  47.         $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
  48.         $(INSTALL_DIR) $(1)/usr/bin/
  49.         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/main $(1)/usr/bin/xray
  50.   $(STAGING_DIR_HOST)/bin/upx --lzma --best $(1)/usr/bin/xray
  51. endef

  52. $(eval $(call BuildPackage,xray-core))
复制代码

点评

测试工作流在此: https://github.com/yuos-bit/AutoBuild-OpenWrt/actions/runs/8740511869  详情 回复 发表于 2024-4-18 23:21
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
小渔学长 发表于 2024-4-18 23:17
感谢大佬的回复,我这边根据我自己的代码优化了下,现在测试。

如下贴上:

测试工作流在此:
https://github.com/yuos-bit/Auto ... ons/runs/8740511869
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

本帖最后由 8267 于 2024-4-18 23:52 编辑
小渔学长 发表于 2024-4-18 23:17
感谢大佬的回复,我这边根据我自己的代码优化了下,现在测试。

如下贴上:

如果upx编译失败,试试去掉第六行PKG_BUILD_DEPENDS:=golang/host  upx/host那个upx/host

不过
  1. define Download/upx
  2.   FILE:=upx-4.2.3-amd64_linux.tar.xz
  3.   URL_FILE:=upx.tar.xz
  4.   URL:=https://github.com/upx/upx/releases/download/v4.2.3/
  5.   HASH:=skip
  6. endef

  7. define Build/Prepare
  8.     $(call Build/Prepare/Default)
  9.     $(eval $(call Download,upx))
  10.     $(TAR) --strip-components=1 -C $(PKG_BUILD_DIR)/ -xvf $(DL_DIR)/upx-4.2.3-amd64_linux.tar.xz
  11.     $(CP) $(PKG_BUILD_DIR)/upx $(STAGING_DIR_HOST)/bin/upx
  12. endef
复制代码
这个方法确实可以把upx下载到STAGING_DIR_HOST目录里的 后面的可以按你的方法进行压缩  

点评

我突然想到,如果是这样的话,是否可以我直接打包一个xray然后压缩后再打包放在github上,然后以类似的命令去直接拉取,这样也不用编译,也不会有很多奇怪的报错。  详情 回复 发表于 2024-4-19 00:07
好的,谢谢大佬,打扰你休息了。我先试试,麻烦了  详情 回复 发表于 2024-4-19 00:05
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
8267 发表于 2024-4-18 23:40
如果upx编译失败,试试去掉第六行PKG_BUILD_DEPENDS:=golang/host  upx/host那个upx/host

不过

好的,谢谢大佬,打扰你休息了。我先试试,麻烦了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
8267 发表于 2024-4-18 23:40
如果upx编译失败,试试去掉第六行PKG_BUILD_DEPENDS:=golang/host  upx/host那个upx/host

不过

我突然想到,如果是这样的话,是否可以我直接打包一个xray然后压缩后再打包放在github上,然后以类似的命令去直接拉取,这样也不用编译,也不会有很多奇怪的报错。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

本帖最后由 8267 于 2024-4-19 00:22 编辑
小渔学长 发表于 2024-4-19 00:07
我突然想到,如果是这样的话,是否可以我直接打包一个xray然后压缩后再打包放在github上,然后以类似的命 ...

那也是可以的,我对openwrt不太懂,称不上大佬,我看也有好多插件就是直接下载的已经编译好的文件,解压进去的,没有进行源码编译。比如这个
https://github.com/OrayOS/OpenOray/blob/main/pgyvirtual**/Makefile


点评

附github action:https://github.com/yuos-bit/AutoBuild-OpenWrt/actions/runs/8741480948/job/23987602568  详情 回复 发表于 2024-4-19 09:14
大佬,这是我现在的makefile 但是目前报错: 、 我问了下chatgpt 就很奇怪  详情 回复 发表于 2024-4-19 09:03
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
8267 发表于 2024-4-19 00:12
那也是可以的,我对openwrt不太懂,称不上大佬,我看也有好多插件就是直接下载的已经编译好的文件,解压进 ...

大佬,这是我现在的makefile

  1. include $(TOPDIR)/rules.mk

  2. PKG_NAME:=xray-core
  3. PKG_VERSION:=1.7.5
  4. PKG_RELEASE:=1

  5. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  6. PKG_SOURCE_URL:=https://codeload.github.com/XTLS/Xray-core/tar.gz/v$(PKG_VERSION)?
  7. PKG_HASH:=a5fc936136a57a463bf9a895d068fdfa895b168ae6093c58a10208e098b6b2d3

  8. PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
  9. PKG_LICENSE:=MPL-2.0
  10. PKG_LICENSE_FILES:=LICENSE

  11. PKG_BUILD_DIR:=$(BUILD_DIR)/Xray-core-$(PKG_VERSION)
  12. PKG_BUILD_DEPENDS:=golang/host
  13. PKG_BUILD_PARALLEL:=1
  14. PKG_USE_MIPS16:=0

  15. GO_PKG:=github.com/xtls/xray-core
  16. GO_PKG_LDFLAGS:=-s -w
  17. GO_PKG_BUILD_PKG:=$(GO_PKG)/main
  18. GO_PKG_LDFLAGS_X:= \
  19.   $(GO_PKG)/core.build=OpenWrt \
  20.   $(GO_PKG)/core.version=$(PKG_VERSION)

  21. include $(INCLUDE_DIR)/package.mk
  22. include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk

  23. define Download/upx
  24.   FILE:=upx-4.2.3-amd64_linux.tar.xz
  25.   URL_FILE:=upx.tar.xz
  26.   URL:=https://github.com/upx/upx/releases/download/v4.2.3/
  27.   HASH:=skip
  28. endef

  29. define Build/Prepare
  30.   $(call Build/Prepare/Default)
  31.   $(eval $(call Download,upx))
  32.   $(TAR) --strip-components=1 -C $(PKG_BUILD_DIR)/ -xvf $(DL_DIR)/upx-4.2.3-amd64_linux.tar.xz
  33.   $(CP) $(PKG_BUILD_DIR)/upx $(STAGING_DIR_HOST)/bin/upx
  34. endef

  35. define Package/xray-core
  36.   TITLE:=A platform for building proxies to bypass network restrictions
  37.   SECTION:=net
  38.   CATEGORY:=Network
  39.   URL:=https://xtls.github.io
  40.   DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
  41. endef

  42. define Package/xray-core/description
  43.   Xray, Penetrates Everything. It helps you to build your own computer network.
  44.   It secures your network connections and thus protects your privacy.
  45. endef


  46. define Package/xray-core/install
  47.   $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
  48.   $(INSTALL_DIR) $(1)/usr/bin/
  49.   $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/main $(1)/usr/bin/xray
  50.   $(STAGING_DIR_HOST)/bin/upx --lzma --best $(1)/usr/bin/xray
  51. endef

  52. $(eval $(call BuildPackage,xray-core))
复制代码


但是目前报错:
  1. time: package/feeds/packages/curl/compile#50.61#10.78#58.29
  2. make[3]: Entering directory '/workdir/openwrt/feeds/packages/net/xray-core'
  3. Makefile:65: *** missing separator.  Stop.
  4. make[3]: Leaving directory '/workdir/openwrt/feeds/packages/net/xray-core'
  5. time: package/feeds/packages/xray-core/compile#0.11#0.04#0.13
  6.     ERROR: package/feeds/packages/xray-core failed to build.
  7. make[2]: *** [package/Makefile:120: package/feeds/packages/xray-core/compile] Error 1
  8. make[2]: Leaving directory '/workdir/openwrt'
  9. make[1]: *** [package/Makefile:114: /workdir/openwrt/staging_dir/target-mipsel_24kc_musl/stamp/.package_compile] Error 2
  10. make[1]: Leaving directory '/workdir/openwrt'
  11. make: *** [/workdir/openwrt/include/toplevel.mk:230: world] Error 2
复制代码


我问了下chatgpt


就很奇怪
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
8267 发表于 2024-4-19 00:12
那也是可以的,我对openwrt不太懂,称不上大佬,我看也有好多插件就是直接下载的已经编译好的文件,解压进 ...

附github action:https://github.com/yuos-bit/Auto ... 948/job/23987602568

点评

[attachimg]686469[/attachimg] 我开虚拟机 试了下 上面这个Makefile 是可以编译出来 而且也进行压缩了  详情 回复 发表于 2024-4-19 11:59
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

本帖最后由 8267 于 2024-4-19 12:05 编辑
  1. include $(TOPDIR)/rules.mk

  2. PKG_NAME:=Xray-core
  3. PKG_VERSION:=1.8.7
  4. PKG_RELEASE:=77

  5. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  6. PKG_SOURCE_URL:=https://codeload.github.com/XTLS/Xray-core/tar.gz/v$(PKG_VERSION)?
  7. PKG_HASH:=skip

  8. PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
  9. PKG_LICENSE:=MPL-2.0
  10. PKG_LICENSE_FILES:=LICENSE

  11. PKG_BUILD_DEPENDS:=golang/host
  12. PKG_BUILD_PARALLEL:=1
  13. PKG_USE_MIPS16:=0
  14. PKG_BUILD_FLAGS:=no-mips16

  15. GO_PKG:=github.com/xtls/xray-core
  16. GO_PKG_BUILD_PKG:=$(GO_PKG)/main
  17. GO_PKG_LDFLAGS_X:= \
  18.     $(GO_PKG)/core.build=OpenWrt \
  19.     $(GO_PKG)/core.version=$(PKG_VERSION)

  20. include $(INCLUDE_DIR)/package.mk
  21. include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
  22. define Download/upx
  23.   FILE:=upx-4.2.3-amd64_linux.tar.xz
  24.   URL_FILE:=upx.tar.xz
  25.   URL:=https://github.com/upx/upx/releases/download/v4.2.3/
  26.   HASH:=skip
  27. endef
  28. define Build/Prepare
  29.     $(call Build/Prepare/Default)
  30.     $(eval $(call Download,upx))
  31.     $(TAR) --strip-components=1 -C $(PKG_BUILD_DIR)/ -xvf $(DL_DIR)/upx-4.2.3-amd64_linux.tar.xz
  32.     $(CP) $(PKG_BUILD_DIR)/upx $(STAGING_DIR_HOST)/bin/upx
  33. endef
  34. define Package/xray/template
  35.   TITLE:=A platform for building proxies to bypass network restrictions
  36.   SECTION:=net
  37.   CATEGORY:=Network
  38.   URL:=https://xtls.github.io
  39. endef

  40. define Package/xray-core
  41.   $(call Package/xray/template)
  42.   DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
  43. endef

  44. define Package/xray-example
  45.   $(call Package/xray/template)
  46.   TITLE+= (example configs)
  47.   DEPENDS:=xray-core
  48.   PKGARCH:=all
  49. endef

  50. define Package/xray/description
  51.   Xray, Penetrates Everything. It helps you to build your own computer network.
  52.   It secures your network connections and thus protects your privacy.
  53. endef

  54. define Package/xray-core/description
  55.   $(call Package/xray/description)
  56. endef

  57. define Package/xray-example/description
  58.   $(call Package/xray/description)

  59.   This includes example configuration files for xray-core.
  60. endef

  61. define Package/xray-core/conffiles
  62. /etc/xray/
  63. /etc/config/xray
  64. endef

  65. define Package/xray-core/install
  66.     $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
  67.     $(INSTALL_DIR) $(1)/usr/bin/
  68.     $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/main $(1)/usr/bin/xray
  69.     $(STAGING_DIR_HOST)/bin/upx --lzma --best $(1)/usr/bin/xray
  70.    
  71. endef

  72. $(eval $(call BuildPackage,xray-core))
复制代码



我开虚拟机 试了下 上面这个Makefile 是可以编译出来 而且也进行压缩了



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

点评

好的,感谢大佬,我这边也再试试,目前总是报错 人都搞神完了  详情 回复 发表于 2024-4-19 23:06
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
8267 发表于 2024-4-19 11:59
我开虚拟机 试了下 上面这个Makefile 是可以编译出来 而且也进行压缩了

好的,感谢大佬,我这边也再试试,目前总是报错
  1. make[3]: Entering directory '/workdir/openwrt/feeds/packages/net/xray-core'
  2. Makefile:65: *** missing separator.  Stop.
  3. make[3]: Leaving directory '/workdir/openwrt/feeds/packages/net/xray-core'
复制代码


人都搞神完了

点评

我虚拟机试了你的 确实一样的报错,我从恩山直接复制 可以的居然也一样报错了 直接给你文件试试 [attachimg]686639[/attachimg] 同样的内容 本来可以编译的 把内容复制到恩山 再复制回去 就不能编译了 和你  详情 回复 发表于 2024-4-20 07:24
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-5-1 08:20

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表