Hi, dear developers
Recently Mediatek Open-Sourced the HWNAT on MT7621 devices, and i merged it into the OpenWrt tags/v21.02.3 and try to compile it for my Xiaomi MI Router CR6608. but i met this problem:
gcc -O2 -I/home/christine/openwrt/staging_dir/host/include -Wno-unused-parameter -include endian.h -L/home/christine/openwrt/staging_dir/host/lib -o /home/christine/openwrt/build_dir/host/firmware-utils/bin/wrt400n src/wrt400n.c src/cyg_crc32.c
src/wrt400n.c: In function 'main':
src/wrt400n.c:312:2: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
312 | write(outfd, buf, totalsize);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -O2 -I/home/christine/openwrt/staging_dir/host/include -Wno-unused-parameter -include endian.h -L/home/christine/openwrt/staging_dir/host/lib -o /home/christine/openwrt/build_dir/host/firmware-utils/bin/xorimage src/xorimage.c
Assembler messages:
Internal error (Segmentation fault).
Please report this bug.
make[3]: *** [Makefile:181: /home/christine/openwrt/build_dir/host/firmware-utils/.built] Error 1
make[3]: Leaving directory '/home/christine/openwrt/tools/firmware-utils'
time: tools/firmware-utils/compile#18.26#6.08#24.83
ERROR: tools/firmware-utils failed to build.
make[2]: *** [tools/Makefile:159: tools/firmware-utils/compile] Error 1
make[2]: Leaving directory '/home/christine/openwrt'
make[1]: *** [tools/Makefile:155: /home/christine/openwrt/staging_dir/host/stamp/.tools_compile_yyynyynnyyynyyyyyynyynyyyyynyyyyyyyyyyyyyyyynynnyyyyyyyy] Error 2
make[1]: Leaving directory '/home/christine/openwrt'
make: *** [/home/christine/openwrt/include/toplevel.mk:230: world] Error 2
i use the HWNAT in this repo: https://github.com/padavanonly/immortalwrt , and compile with Ubuntu 20.04.3. So any help? Thanks!
neheb
July 11, 2022, 4:33am
2
That's...hard to work around. Try:
--- a/rules.mk
+++ b/rules.mk
@@ -240,7 +240,7 @@ HOSTCC:=gcc
HOSTCXX:=g++
HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include $(if $(IS_PACKAGE_BUILD),-I$(STAGING_DIR_HOSTPKG)/include -I$(STAGING_DIR)/host/include)
HOST_CXXFLAGS:=
-HOST_CFLAGS:=-O2 $(HOST_CPPFLAGS)
+HOST_CFLAGS:=$(HOST_CPPFLAGS)
HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib $(if $(IS_PACKAGE_BUILD),-L$(STAGING_DIR_HOSTPKG)/lib)
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
edit: actually since you're using immortalwrt, why post here?
Well... i just use HWNAT in it, according the instruction, i replaced target/linux/ramips into repo to do that:
christine@christine-darmstadtium:~$ cat openwrt/.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/openwrt/openwrt.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
Solved. But another "Segmentation fault". Interesting, wrong tag?
g++ -fno-PIE -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I/home/christine/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/gcc-8.4.0/gcc -I/home/christine/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/gcc-8.4.0/gcc/. -I/home/christine/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/gcc-8.4.0/gcc/../include -I/home/christine/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/gcc-8.4.0/gcc/../libcpp/include -I/home/christine/openwrt/staging_dir/host/include -I/home/christine/openwrt/staging_dir/host/include -I/home/christine/openwrt/staging_dir/host/include -I/home/christine/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/gcc-8.4.0/gcc/../libdecnumber -I/home/christine/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/gcc-8.4.0/gcc/../libdecnumber/dpd -I../libdecnumber -I/home/christine/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/gcc-8.4.0/gcc/../libbacktrace -o tree-ssa-loop-niter.o -MT tree-ssa-loop-niter.o -MMD -MP -MF ./.deps/tree-ssa-loop-niter.TPo /home/christine/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/gcc-8.4.0/gcc/tree-ssa-loop-niter.c
Assembler messages:
Internal error (Segmentation fault).
Please report this bug.
make[5]: *** [Makefile:1110: tree-ssa-loop-niter.o] Error 1
make[5]: Leaving directory '/home/christine/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/gcc-8.4.0-initial/gcc'
make[4]: *** [Makefile:4251: all-gcc] Error 2
make[4]: Leaving directory '/home/christine/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/gcc-8.4.0-initial'
make[3]: *** [Makefile:37: /home/christine/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/gcc-8.4.0-initial/.built] Error 2
make[3]: Leaving directory '/home/christine/openwrt/toolchain/gcc/initial'
time: toolchain/gcc/initial/compile#527.99#56.09#584.47
ERROR: toolchain/gcc/initial failed to build.
make[2]: *** [toolchain/Makefile:97: toolchain/gcc/initial/compile] Error 1
make[2]: Leaving directory '/home/christine/openwrt'
make[1]: *** [toolchain/Makefile:93: /home/christine/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/stamp/.toolchain_compile] Error 2
make[1]: Leaving directory '/home/christine/openwrt'
make: *** [/home/christine/openwrt/include/toplevel.mk:230: world] Error 2
neheb
July 11, 2022, 1:55pm
5
Yeah… something is wrong with your host toolchain. I don’t have a good solution for you. You could try compiling with clang but something else would probably break later on.
Anyway, OpenWrt forks are unsupported here. Also since you mentioned HWNAT, regular OpenWrt supports it just fine.
Well... I think i dont explain well. Mediatek update open-source HWNAT for mt7621 devices, with wifi/dsl HWNAT support. accourding to this chinese forum's post , to use hwnat for other openwrt or its fork's repo, which is openwrt 21.04.3 in my situations, just replace the fork's "target/linux/ramips" folder and then reconfig.
so i just do that. then i met these error.
for the toolchain, now i use Ubuntu 20.04.4 on VirtualBox and install the packages which
Build System Setup mentioned. Maybe caused by 20.04?