Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling an update 0.14.5 for openwrt #11

Open
pquan opened this issue Jul 15, 2022 · 4 comments
Open

Compiling an update 0.14.5 for openwrt #11

pquan opened this issue Jul 15, 2022 · 4 comments

Comments

@pquan
Copy link

pquan commented Jul 15, 2022

I could use a small hand on compiling netmaker on openwrt. I'm trying to update the package to 0.14.5 as the API has changed and is no longer backwards compatible.
I can build openwrt normally but not when including netmaker.
My openwrt build fails trying to include from glfw libraries and X11.h (!)

My build machine is ubuntu 20.04 focal. I have golang-go compiler installed.

Here's the log from the build process:

$make -j1 V=sc package/netmaker/compile 
make[2]: Entering directory '/home/void/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/home/void/openwrt/scripts/config'
time: target/linux/prereq#0.07#0.01#0.09
make[1]: Entering directory '/home/void/openwrt'
cd "/home/void/openwrt"; git log --format=%h -1 toolchain > /home/void/openwrt/tmp/.ver_check
cmp -s /home/void/openwrt/tmp/.ver_check /home/void/openwrt/staging_dir/toolchain-x86_64_gcc-11.2.0_musl/stamp/.ver_check || { \
        rm -rf /home/void/openwrt/build_dir/target-x86_64_musl /home/void/openwrt/staging_dir/target-x86_64_musl /home/void/openwrt/staging_dir/toolchain-x86_64_gcc-11.2.0_musl /home/void/openwrt/build_dir/toolchain-x86_64_gcc-11.2.0_musl; \
        mkdir -p /home/void/openwrt/staging_dir/toolchain-x86_64_gcc-11.2.0_musl/stamp; \
        mv /home/void/openwrt/tmp/.ver_check /home/void/openwrt/staging_dir/toolchain-x86_64_gcc-11.2.0_musl/stamp/.ver_check; \
}
make[2]: Entering directory '/home/void/openwrt/feeds/packages/lang/golang/golang'
find /home/void/openwrt/build_dir/hostpkg/go-1.18.3 -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' | xargs -r rm -rf
make[2]: Leaving directory '/home/void/openwrt/feeds/packages/lang/golang/golang'
time: package/feeds/packages/golang/host-compile#0.23#0.01#0.23
make[2]: Entering directory '/home/void/openwrt/package/libs/toolchain'
Makefile:735: WARNING: skipping libgomp -- package has no install section
echo "libc" >> /home/void/openwrt/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "libgcc" >> /home/void/openwrt/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "libpthread" >> /home/void/openwrt/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "librt" >> /home/void/openwrt/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
touch -r /home/void/openwrt/build_dir/target-x86_64_musl/toolchain/.built /home/void/openwrt/build_dir/target-x86_64_musl/toolchain/.autoremove 2>/dev/null >/dev/null
find /home/void/openwrt/build_dir/target-x86_64_musl/toolchain -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | xargs -r rm -rf
make[2]: Leaving directory '/home/void/openwrt/package/libs/toolchain'
time: package/libs/toolchain/compile#0.09#0.01#0.11
make[2]: Entering directory '/home/void/openwrt/feeds/netmaker/netmaker'
mkdir -p /home/void/openwrt/dl
SHELL= flock /home/void/openwrt/tmp/.netmaker-0.14.5.tar.xz.flock -c '          /home/void/openwrt/scripts/download.pl "/home/void/openwrt/dl" "netmaker-0.14.5.tar.xz" "skip" "" || (  /home/void/openwrt/scripts/dl_github_archive.py --dl-dir="/home/void/openwrt/dl" --url="https://github.com/gravitl/netmaker.git" --version="8182673992dd609fb4e35b2ed0c261aa3319392b" --subdir="netmaker-0.14.5" --source="netmaker-0.14.5.tar.xz" --hash="skip" || (     echo "Checking out files from the git repository..."; mkdir -p /home/void/openwrt/tmp/dl && cd /home/void/openwrt/tmp/dl && rm -rf netmaker-0.14.5 && [ \! -d netmaker-0.14.5 ] && git clone  https://github.com/gravitl/netmaker.git netmaker-0.14.5 && (cd netmaker-0.14.5 && git checkout 8182673992dd609fb4e35b2ed0c261aa3319392b && git submodule update --init --recursive) && echo "Packing checkout..." && export TAR_TIMESTAMP=`cd netmaker-0.14.5 && git log -1 --format='\''@%ct'\''` && rm -rf netmaker-0.14.5/.git &&  tar --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name ${TAR_TIMESTAMP:+--mtime="$TAR_TIMESTAMP"} -c netmaker-0.14.5 |  xz -zc -7e > /home/void/openwrt/tmp/dl/netmaker-0.14.5.tar.xz && mv /home/void/openwrt/tmp/dl/netmaker-0.14.5.tar.xz /home/void/openwrt/dl/ && rm -rf netmaker-0.14.5; );  )    '
rm -f /home/void/openwrt/build_dir/target-x86_64_musl/netmaker-0.14.5/.built
touch /home/void/openwrt/build_dir/target-x86_64_musl/netmaker-0.14.5/.built_check
CONFIG_GOLANG_MOD_CACHE_WORLD_READABLE="" GO_BUILD_CACHE_DIR="/home/void/openwrt/tmp/go-build" GO_MOD_CACHE_DIR="/home/void/openwrt/dl/go-mod-cache" GO_MOD_ARGS="-modcacherw" GO_PKG="github.com/gravitl/netmaker" GO_INSTALL_EXTRA="extra/file extra/dir" GO_INSTALL_ALL="" GO_SOURCE_ONLY="" GO_BUILD_PKG="github.com/gravitl/netmaker/..." GO_EXCLUDES="excluded" GO_GO_GENERATE="" GO_INSTALL_BIN_PATH="/usr/bin" BUILD_DIR="/home/void/openwrt/build_dir/target-x86_64_musl/netmaker-0.14.5" GO_BUILD_DIR="/home/void/openwrt/build_dir/target-x86_64_musl/netmaker-0.14.5/.go_work/build" GO_BUILD_BIN_DIR="/home/void/openwrt/build_dir/target-x86_64_musl/netmaker-0.14.5/.go_work/build/bin" GO_BUILD_DEPENDS_PATH="/usr/share/gocode" GO_BUILD_DEPENDS_SRC="/home/void/openwrt/staging_dir/target-x86_64_musl/usr/share/gocode/src" GOOS="linux" GOARCH="amd64" GO386="" GOAMD64="v1" GOARM="" GOMIPS="" GOMIPS64="" GOPPC64="" CGO_ENABLED=1 CC="x86_64-openwrt-linux-musl-gcc" CXX="x86_64-openwrt-linux-musl-g++" CGO_CFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -ffile-prefix-map=/home/void/openwrt/build_dir/target-x86_64_musl/netmaker-0.14.5=netmaker-0.14.5 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" CGO_CPPFLAGS="-I/home/void/openwrt/staging_dir/toolchain-x86_64_gcc-11.2.0_musl/usr/include -I/home/void/openwrt/staging_dir/toolchain-x86_64_gcc-11.2.0_musl/include/fortify -I/home/void/openwrt/staging_dir/toolchain-x86_64_gcc-11.2.0_musl/include" CGO_CXXFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -ffile-prefix-map=/home/void/openwrt/build_dir/target-x86_64_musl/netmaker-0.14.5=netmaker-0.14.5 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" CGO_LDFLAGS="-L/home/void/openwrt/staging_dir/toolchain-x86_64_gcc-11.2.0_musl/usr/lib -L/home/void/openwrt/staging_dir/toolchain-x86_64_gcc-11.2.0_musl/lib -znow -zrelro" GOPATH="/home/void/openwrt/build_dir/target-x86_64_musl/netmaker-0.14.5/.go_work/build" GOCACHE="/home/void/openwrt/tmp/go-build" GOMODCACHE="/home/void/openwrt/dl/go-mod-cache" GOENV=off /usr/bin/env bash /home/void/openwrt/feeds/packages/lang/golang//golang-build.sh build -v -buildvcs=false -trimpath -ldflags "all=-buildid '1657134579' -linkmode external -extldflags '-L/home/void/openwrt/staging_dir/toolchain-x86_64_gcc-11.2.0_musl/usr/lib -L/home/void/openwrt/staging_dir/toolchain-x86_64_gcc-11.2.0_musl/lib -Wl,-z,now -Wl,-z,relro'"        -ldflags "-s -w  -buildid '1657134579' -linkmode external -extldflags '-L/home/void/openwrt/staging_dir/toolchain-x86_64_gcc-11.2.0_musl/usr/lib -L/home/void/openwrt/staging_dir/toolchain-x86_64_gcc-11.2.0_musl/lib -Wl,-z,now -Wl,-z,relro'"
Finding targets

Building targets
github.com/go-gl/glfw/v3.3/glfw
github.com/go-gl/gl/v3.2-core/gl
# /home/void/openwrt/staging_dir/host/bin/pkg-config --cflags  -- gl gl
Package gl was not found in the pkg-config search path.
Perhaps you should add the directory containing `gl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gl', required by 'virtual:world', not found
Package 'gl', required by 'virtual:world', not found
/home/void/openwrt/staging_dir/host/bin/pkg-config: exit status 1
# github.com/go-gl/glfw/v3.3/glfw
In file included from ./glfw/src/internal.h:188,
                 from ./glfw/src/context.c:30,
                 from ../../../../../dl/go-mod-cache/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20211213063430-748e38ca8aec/c_glfw.go:4:
./glfw/src/x11_platform.h:33:10: fatal error: X11/Xlib.h: No such file or directory
   33 | #include <X11/Xlib.h>
      |          ^~~~~~~~~~~~
compilation terminated.

make[2]: *** [Makefile:93: /home/void/openwrt/build_dir/target-x86_64_musl/netmaker-0.14.5/.built] Error 2
make[2]: Leaving directory '/home/void/openwrt/feeds/netmaker/netmaker'
time: package/feeds/netmaker/netmaker/compile#2.51#1.09#0.90
    ERROR: package/feeds/netmaker/netmaker failed to build.
make[1]: *** [package/Makefile:116: package/feeds/netmaker/netmaker/compile] Error 1
make[1]: Leaving directory '/home/void/openwrt'
make: *** [/home/void/openwrt/include/toplevel.mk:230: package/netmaker/compile] Error 2

What am I doing wrong?

@etnperlong
Copy link

The same error when I try to compile a newer version for openwrt. 😢

@pquan
Copy link
Author

pquan commented Jul 27, 2022

In the readme, the following paragraph reads:

To build Netmaker for OpenWRT, you need to have Golang with OpenWRT build envirment. Then, you can insert the Netmaker package using a package feed or add the package manually.

Please clarify what is meant exactly. I have goland in openwrt, I can compile openwrt perfectly. Yet, the package fails to build with an X11 requirement.

Could you share the compile process?

@sunyoung1
Copy link

tried other versions of netmaker for 22.03 and doesn't work at all, compiling a build for a newer version doesn't work too.
dev could probably compile for 22.03 since it's not gonna be too long when the latest stable version comes out.

@pquan
Copy link
Author

pquan commented Aug 18, 2022

Can you share your compilation steps? I don't seem to get it, but if I manage to compile, I can integrate the process with my openwrt build and release an updated version for 22.03.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants