zfl9 / dns2tcp

将 dns 查询从 udp 转为 tcp 的实用工具
GNU Affero General Public License v3.0
133 stars 54 forks source link

大佬你好,我在编译最新版的过程中遇到了编译失败,能帮忙看看怎么解决吗?谢谢! #13

Closed wekingchen closed 3 months ago

wekingchen commented 4 months ago

具体编译信息如下: make[3]: Entering directory '/workdir/openwrt/feeds/passwall_packages/dns2tcp' rm -f /workdir/openwrt/build_dir/target-mipsel_24kc_musl/dns2tcp-1.1.1/.built touch /workdir/openwrt/build_dir/target-mipsel_24kc_musl/dns2tcp-1.1.1/.built_check 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/dns2tcp-1.1.1=dns2tcp-1.1.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fpic -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/dns2tcp-1.1.1=dns2tcp-1.1.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fpic -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 " 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.0_musl/lib -znow -zrelro " make -C /workdir/openwrt/build_dir/target-mipsel_24kc_musl/dns2tcp-1.1.1/. AR="mipsel-openwrt-linux-musl-gcc-ar" AS="mipsel-openwrt-linux-musl-gcc -c -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 -fmacro-prefix-map=/workdir/openwrt/build_dir/target-mipsel_24kc_musl/dns2tcp-1.1.1=dns2tcp-1.1.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fpic" LD=mipsel-openwrt-linux-musl-ld NM="mipsel-openwrt-linux-musl-gcc-nm" CC="mipsel-openwrt-linux-musl-gcc" GCC="mipsel-openwrt-linux-musl-gcc" CXX="mipsel-openwrt-linux-musl-g++" RANLIB="mipsel-openwrt-linux-musl-gcc-ranlib" STRIP=mipsel-openwrt-linux-musl-strip OBJCOPY=mipsel-openwrt-linux-musl-objcopy OBJDUMP=mipsel-openwrt-linux-musl-objdump SIZE=mipsel-openwrt-linux-musl-size CROSS="mipsel-openwrt-linux-musl-" ARCH="mipsel" CFLAGS="-std=c99 -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/dns2tcp-1.1.1=dns2tcp-1.1.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fpic" EVCFLAGS="-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/dns2tcp-1.1.1=dns2tcp-1.1.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fpic" ; make[4]: Entering directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/dns2tcp-1.1.1' mipsel-openwrt-linux-musl-gcc -std=c99 -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/dns2tcp-1.1.1=dns2tcp-1.1.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fpic -c libev/ev.c -o libev/ev.o libev/ev.c:2139:31: warning: 'ev_default_loop_ptr' initialized and declared 'extern' EV_API_DECL struct ev_loop ev_default_loop_ptr = 0; / needs to be initialised to make it a definition despite extern */ ^~~~~~~ {standard input}: Assembler messages: {standard input}:4260: Error: opcode not supported on this processor: mips2 (mips2) sync' {standard input}:4535: Error: opcode not supported on this processor: mips2 (mips2)sync' make[4]: [Makefile:25: libev/ev.o] Error 1 make[4]: Leaving directory '/workdir/openwrt/build_dir/target-mipsel_24kc_musl/dns2tcp-1.1.1' make[3]: [Makefile:45: /workdir/openwrt/build_dir/target-mipsel_24kc_musl/dns2tcp-1.1.1/.built] Error 2 make[3]: Leaving directory '/workdir/openwrt/feeds/passwall_packages/dns2tcp' time: package/feeds/passwall_packages/dns2tcp/compile#0.33#0.04#0.36 ERROR: package/feeds/passwall_packages/dns2tcp failed to build. make[2]: *** [package/Makefile:120: package/feeds/passwall_packages/dns2tcp/compile] Error 1

zfl9 commented 4 months ago

https://github.com/zfl9/dns2tcp/blob/8796f058ee0c578b71e71ed22f07b942339be999/libev/config.h#L17-L18

试试把这两行取消注释?

wekingchen commented 4 months ago

谢谢大佬回复,我用https://github.com/sbwml/openwrt_helloworld的这个Makefile编译成功了。

# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2022 ImmortalWrt.org

include $(TOPDIR)/rules.mk

PKG_NAME:=dns2tcp
PKG_VERSION:=1.1.1
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/zfl9/dns2tcp/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=35251fbe1645601086f21cdbd5a2f75471d812f99ed8017bb05158840456b43c

PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_LICENSE:=AGPL-3.0-only
PKG_LICENSE_FILES:=LICENSE

PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
PKG_BUILD_FLAGS:=no-mips16

include $(INCLUDE_DIR)/package.mk

define Package/dns2tcp
  SECTION:=net
  CATEGORY:=Network
  SUBMENU:=IP Addresses and Names
  TITLE:=utility to convert dns query from udp to tcp
  URL:=https://github.com/zfl9/dns2tcp
endef

TARGET_CFLAGS+= $(FPIC) -Wl,--gc-sections -flto
MAKE_FLAGS+= \
    CFLAGS="-std=c99 $(TARGET_CFLAGS)" \
    EVCFLAGS="$(TARGET_CFLAGS)"

define Package/dns2tcp/install
    $(INSTALL_DIR) $(1)/usr/bin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/dns2tcp $(1)/usr/bin/
endef

$(eval $(call BuildPackage,dns2tcp))