Open galaxyskyknight opened 3 years ago
@galaxyskyknight , can you document your build process?
It looks like you are doing something a little strange and the sanity checks are catching that.
Is this a real git checkout? or is it a tar extract inside a different git checkout for something else - the git tags the scripts/version/sh found do not look "normal"
oh, and your directory structure seems to suggest you are building n2n v2.9, but the n2n build system is one from n2n v3.1 - is that what you expected?
Finally, just for reference, I have a branch with a github action to build for OpenWRT at https://github.com/hamishcoleman/n2n/tree/openwrt whilc this might not be completely relevant for you (because you are clearly not building a normal openwrt) it could be helpful to compare with
Finally, just for reference, I have a branch with a github action to build for OpenWRT at https://github.com/hamishcoleman/n2n/tree/openwrt whilc this might not be completely relevant for you (because you are clearly not building a normal openwrt) it could be helpful to compare with
I didn't build from the orignal OpenWRT project but from the third party one, here it is: https://github.com/coolsnowwolf/lede
can you try that? currently its n2n version baseline is stiil stay at ver2.8, you must change the git commit to the latest one manually(under package/lean/n2n/Makefile) and the makefile also need to do some other adaptive change for lib dependency , it is working good till the last two or three commit here and then got the error above.
oh, and your directory structure seems to suggest you are building n2n v2.9, but the n2n build system is one from n2n v3.1 - is that what you expected?
that doesn't matter. the folder name comes from the Makefile definition, its easy to rename it to git-3.1.0-xxxx. the problem is I got no idea where does this version sanity check come from (3.1.0!=20200416) since you have redefined the VERSION file and I don't know where to change '20200416' to be 3.1.0 to pass this version check.
I found the root cause for this error finally, it comes from the /scripts/version.sh
you newly added 7 days ago.
there is a logic hole here.... seems you are using 'git describe --abbrev
' to output the current git branch tag for n2n, however, it will be the openwrt project git repo tag description when try to compile the whole openwrt repo, but not the n2n project git repo as you original expected. You used methodology here is only considering the senario for n2n compiling in an individual project build evnrioment but not consider it is integrated to other project (e.g like Openwrt), so the if [ "$VER_FILE_SHORT" != "$VER_GIT_SHORT" ];
will always NOT equal.
The "$VER_GIT_SHORT"
here in my setup output is
And build error you can obviously see
But in an individual n2n project, its repo tag is as expected:
The script code snap here:
if git status >/dev/null; then
VER_GIT_SHORT=$(git describe --abbrev=0)
if [ "$VER_FILE_SHORT" != "$VER_GIT_SHORT" ]; then
echo "Error: VERSION file does not match tag version ($VER_FILE_SHORT != $VER_GIT_SHORT)"
exit 1
fi
looks like there is no way to easy distinguish the current n2n repo tag description in Openwrt git repo as it is only snapshot the code for complie, even I switch to the n2n clone folder . I suggest to remove such a sanity check consider my senario unless you have better solution.
There certainly will be better solutions. Unfortunately, my openwrt build system is unavailable at the moment, so cannot look immediately. I'm going to stick to testing with mainline openwrt as that is one common baseline for all people. There are a number of other improvements that still need to be made with that build process, so this will probably be rolled in with them.
Also, I have replicated a tag and version related error with my openwrt build, which looks to be the same as your error, so the same solutions should have some applicability.
Basically, if openwrt is going to do a git checkout, it needs to actually do a git checkout - this is not an uncommon requirement and I expect other projects included in openwrt have crossed this same bridge.
There certainly will be better solutions. Unfortunately, my openwrt build system is unavailable at the moment, so cannot look immediately. I'm going to stick to testing with mainline openwrt as that is one common baseline for all people. There are a number of other improvements that still need to be made with that build process, so this will probably be rolled in with them.
Also, I have replicated a tag and version related error with my openwrt build, which looks to be the same as your error, so the same solutions should have some applicability.
Basically, if openwrt is going to do a git checkout, it needs to actually do a git checkout - this is not an uncommon requirement and I expect other projects included in openwrt have crossed this same bridge.
I don't understand introduce such a less helpful tag version check here which will block the whole thing that working well all along in the past years with my follow up, what's the benifit here....? you need not only consider your project run well but also need to consider from compatible wise, the minimual restriction will carry out more compatibility,why need to stick to doing this to block that even we clearly know there are some issues.... sorry, really confused, I just wanna my compile back but I am not going to fork a repo and change it in my local. its quiet simple fix that to comment out this check in script.
The version check is so that we dont accidentally make a release without the correct version numbers in the release files and tags - which is a pretty critical part of making a release.
There is a lot of benefit to be gained from cleaning up the version numbers in the n2n build - there were previously at least 5 places that all needed to be manually kept in sync.
I have made a small change to the way the version.sh works in #896 , can you test it ?
Additionally, if you have specific build requirements, you could automate them in a github workflow and raise a PR to add that to the continuous integration testing that we run - this would allow us to at least see the build work against the same environments that other people are using.
I have made a small change to the way the version.sh works in #896 , can you test it ?
Additionally, if you have specific build requirements, you could automate them in a github workflow and raise a PR to add that to the continuous integration testing that we run - this would allow us to at least see the build work against the same environments that other people are using.
Tested, works fine. Thanks a lot!! next time I will raise PR.
if you try to build a n2n package for OpenWrt, and please check the https://github.com/ntop/n2n/tree/dev/packages/openwrt folder. you need to change the two items that you want to build if you are familiar with OpenWrt build system.
Example
if you want to build 3.0.0 version, you need to replace those two items to
sed -i 's/PKG_SOURCE_VERSION:=.*/PKG_SOURCE_VERSION:=66f557af97b9c2ad42537516101fd04df2639ef0/g' Makefile
sed -i 's/PKG_VERSION:=.*/PKG_VERSION:=3.0.0/g' Makefile
@csrutil I'm working on changes that might help avoid those sed lines - or at least integrate the file updating into the n2n source.
august@august-PC:~/openwrt$ make package/n2n/prepare USE_SOURCE_DIR=../n2n V=s Collecting package info: done make[1]: Entering directory '/home/august/openwrt' make[2]: Entering directory '/home/august/openwrt/package/n2n' touch /home/august/openwrt/build_dir/target-mipsel_24kc_musl/n2n-3.1.0-59-g7f16385/.prepared_check rm -rf /home/august/openwrt/build_dir/target-mipsel_24kc_musl/n2n-3.1.0-59-g7f16385 ln -snf ../n2n /home/august/openwrt/build_dir/target-mipsel_24kc_musl/n2n-3.1.0-59-g7f16385 touch /home/august/openwrt/build_dir/target-mipsel_24kc_musl/n2n-3.1.0-59-g7f16385/.source_dir touch: cannot touch '/home/august/openwrt/build_dir/target-mipsel_24kc_musl/n2n-3.1.0-59-g7f16385/.source_dir': No such file or directory make[2]: [Makefile:106: /home/august/openwrt/build_dir/target-mipsel_24kc_musl/n2n-3.1.0-59-g7f16385/.prepared] Error 1 make[2]: Leaving directory '/home/august/openwrt/package/n2n' time: package/n2n/prepare#0.52#0.03#0.55 ERROR: package/n2n failed to build. make[1]: [package/Makefile:116: package/n2n/prepare] Error 1 make[1]: Leaving directory '/home/august/openwrt' make: *** [/home/august/openwrt/include/toplevel.mk:230:package/n2n/prepare] 错误 2 august@august-PC:~/openwrt$
august@august-PC:~/openwrt$ make package/n2n/prepare USE_SOURCE_DIR=../n2n V=s Collecting package info: done make[1]: Entering directory '/home/august/openwrt' make[2]: Entering directory '/home/august/openwrt/package/n2n' touch /home/august/openwrt/build_dir/target-mipsel_24kc_musl/n2n-3.1.0-59-g7f16385/.prepared_check rm -rf /home/august/openwrt/build_dir/target-mipsel_24kc_musl/n2n-3.1.0-59-g7f16385 ln -snf ../n2n /home/august/openwrt/build_dir/target-mipsel_24kc_musl/n2n-3.1.0-59-g7f16385 touch /home/august/openwrt/build_dir/target-mipsel_24kc_musl/n2n-3.1.0-59-g7f16385/.source_dir touch: cannot touch '/home/august/openwrt/build_dir/target-mipsel_24kc_musl/n2n-3.1.0-59-g7f16385/.source_dir': No such file or directory make[2]: [Makefile:106: /home/august/openwrt/build_dir/target-mipsel_24kc_musl/n2n-3.1.0-59-g7f16385/.prepared] Error 1 make[2]: Leaving directory '/home/august/openwrt/package/n2n' time: package/n2n/prepare#0.52#0.03#0.55 ERROR: package/n2n failed to build. make[1]: [package/Makefile:116: package/n2n/prepare] Error 1 make[1]: Leaving directory '/home/august/openwrt' make: *** [/home/august/openwrt/include/toplevel.mk:230:package/n2n/prepare] 错误 2 august@august-PC:~/openwrt$
I found it create two files,and the file it want is in another file
I have not seen this error before. I am not sure I understand your second comment - Are you saying you have fixed it? Can you share how? If not, can you paste your entire checkout/configure/build log?
in the build_dir/target-mipsel_24kc_musl/ ,it will create two files ,fist is code then copy from github ,but when they build ,it will search in second file.so it will take error. when I copy fist file to the second file ,it can be build.
It should not do this. Did you follow the entire instructions from the https://github.com/ntop/n2n/blob/dev/packages/openwrt/README.md page?
If you paste your full and complete build session log, we might be able to figure out what is happening
@AugustLiu looking closely at the snippet you have pasted, it looks like there is something wrong with your "../n2n" directory. Can you run these commands and show your output?
ls -al /home/august/openwrt/build_dir/target-mipsel_24kc_musl/n2n-3.1.0-59-g7f16385
ls -al /home/august/openwrt/../n2n
Thanks
when I copy the Lede's n2n code ,build sucessful!
I cannot reproduce the issue you are seeing, if you paste a text copy of your entire build session, from checkout until build error then we may be able to investigate.
@galaxyskyknight , since you closed this as completed, can you share how you fixed it?
make[1]: Leaving directory '/home/duy/lede' make: *** [/home/duy/lede/include/toplevel.mk:230: world] Error 2 duy@duy-virtual-machine:~/lede$ ^C
Hi @Doanduy09 , I take it you have had an issue compiling? It is probably better if you create a new ticket - this one has quite a lot of history in it. Please be sure to paste your entire build log and clearly show the steps that you are following (there are a number of different instructions on how to compile floating around - and not all of them are repeatable) for a start, I see you are not actually using OpenWRT, but lede - these projects often say they are the same, but that turns out to not always be correct, so it is important to see exactly what steps you have tried.
thank you so much
( cd /home/builder/lede_x86/build_dir/target-x86_64_musl/n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7; ./autogen.sh; ./configure --with-openssl) Wait please... configure: loading site script /home/builder/lede_x86/include/site/x86_64 checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for EVP_CIPHER_CTX_reset in -lcrypto... yes checking for pcap_open_live in -lpcap... yes checking for pcap_set_immediate_mode in -lpcap... yes checking for cap_get_proc in -lcap... yes checking for pthread_mutex_trylock in -lpthread... yes configure: creating ./config.status config.status: creating Makefile config.status: creating tools/Makefile config.status: creating include/config.h touch /home/builder/lede_x86/build_dir/target-x86_64_musl/n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7/.configured_68b329da9893e34099c7d8ad5cb9c940 rm -f /home/builder/lede_x86/build_dir/target-x86_64_musl/n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7/.built touch /home/builder/lede_x86/build_dir/target-x86_64_musl/n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7/.built_check CFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/builder/lede_x86/build_dir/target-x86_64_musl/n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7=n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I/home/builder/lede_x86/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/usr/include -I/home/builder/lede_x86/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/include/fortify -I/home/builder/lede_x86/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/include " CXXFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/builder/lede_x86/build_dir/target-x86_64_musl/n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7=n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I/home/builder/lede_x86/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/usr/include -I/home/builder/lede_x86/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/include/fortify -I/home/builder/lede_x86/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/include " LDFLAGS="-L/home/builder/lede_x86/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/usr/lib -L/home/builder/lede_x86/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/lib -znow -zrelro " make -C /home/builder/lede_x86/build_dir/target-x86_64_musl/n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7/. AR="x86_64-openwrt-linux-musl-gcc-ar" AS="x86_64-openwrt-linux-musl-gcc -c -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/builder/lede_x86/build_dir/target-x86_64_musl/n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7=n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=x86_64-openwrt-linux-musl-ld NM="x86_64-openwrt-linux-musl-gcc-nm" CC="x86_64-openwrt-linux-musl-gcc" GCC="x86_64-openwrt-linux-musl-gcc" CXX="x86_64-openwrt-linux-musl-g++" RANLIB="x86_64-openwrt-linux-musl-gcc-ranlib" STRIP=x86_64-openwrt-linux-musl-strip OBJCOPY=x86_64-openwrt-linux-musl-objcopy OBJDUMP=x86_64-openwrt-linux-musl-objdump SIZE=x86_64-openwrt-linux-musl-size CROSS="x86_64-openwrt-linux-musl-" ARCH="x86_64" ; make[4]: Entering directory '/home/builder/lede_x86/build_dir/target-x86_64_musl/n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7' Build for version: Error: VERSION file does not match tag version (3.1.0 != 20200416) make[4]: [Makefile:158: version] Error 1 make[4]: Leaving directory '/home/builder/lede_x86/build_dir/target-x86_64_musl/n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7' make[3]: [Makefile:89: /home/builder/lede_x86/build_dir/target-x86_64_musl/n2n-2.9.0_dev_git-c5f9e8198bc9dca55eb3d7a3d5777299570ac4b7/.built] Error 2 make[3]: Leaving directory '/home/builder/lede_x86/package/lean/n2n_v2' time: package/lean/n2n_v2/compile#4.18#2.91#10.25 ERROR: package/lean/n2n_v2 failed to build. make[2]: [package/Makefile:116: package/lean/n2n_v2/compile] Error 1 make[2]: Leaving directory '/home/builder/lede_x86' make[1]: [package/Makefile:110: /home/builder/lede_x86/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2 make[1]: Leaving directory '/home/builder/lede_x86' make: *** [/home/builder/lede_x86/include/toplevel.mk:230:world] error 2 builder@Build-Server:~/lede_x86$