runfalk / synology-wireguard

WireGuard support for some Synology NAS drives
MIT License
920 stars 131 forks source link

Cross compiling for DS418 #18

Closed emansih closed 4 years ago

emansih commented 4 years ago

Hi, I'm compiling wireguard from x86_64 arch for my DS418 and it fails. The error log:

patching file WireGuard-0.0.20190227/src/compat/Kbuild.include
make[1]: Entering directory '/source/WireGuard/WireGuard-0.0.20190227/src/tools'
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/wg.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/config.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/show.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/mnlg.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/terminal.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/ipc.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/encoding.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/curve25519.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/setconf.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/genkey.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/showconf.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/pubkey.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/set.o
  LD      /source/WireGuard/WireGuard-0.0.20190227/src/tools/wg
make[1]: Leaving directory '/source/WireGuard/WireGuard-0.0.20190227/src/tools'
make[1]: Entering directory '/source/WireGuard/WireGuard-0.0.20190227/src'
In file included from <command-line>:0:0:
/source/WireGuard/WireGuard-0.0.20190227/src/compat/memneq/include.h:2:19: error: redefinition of 'crypto_memneq'
 static inline int crypto_memneq(const void *a, const void *b, size_t size)
                   ^
In file included from /source/WireGuard/WireGuard-0.0.20190227/src/compat/compat.h:716:0,
                 from <command-line>:0:
include/crypto/algapi.h:380:19: note: previous definition of 'crypto_memneq' was here
 static inline int crypto_memneq(const void *a, const void *b, size_t size)
                   ^
scripts/Makefile.build:269: recipe for target '/source/WireGuard/WireGuard-0.0.20190227/src/main.o' failed
make[3]: *** [/source/WireGuard/WireGuard-0.0.20190227/src/main.o] Error 1
Makefile:1411: recipe for target '_module_/source/WireGuard/WireGuard-0.0.20190227/src' failed
make[2]: *** [_module_/source/WireGuard/WireGuard-0.0.20190227/src] Error 2
Makefile:37: recipe for target 'module' failed
make[1]: *** [module] Error 2
make[1]: Leaving directory '/source/WireGuard/WireGuard-0.0.20190227/src'
Makefile:57: recipe for target 'WireGuard-0.0.20190227/src/wireguard.ko' failed
make: *** [WireGuard-0.0.20190227/src/wireguard.ko] Error 2
make: Leaving directory '/source/WireGuard'

[Error] Build project fail!

----------------- Time cost statistics -----------------
Time cost: 00:00:14 [Build-->WireGuard]
[INFO] Build WireGuard finished!
Time cost: 00:00:14 [Build-->WireGuard]

########################################################
      Error(s) occurred on project "WireGuard"
########################################################
1 projects, 1 failed.

[Error] Check [/logs/error.build] for fixing errors.

############################################################
                  Failed to build package.
############################################################
Failed to build package. [rtd1296] : WireGuard
Error log: /build_env/ds.rtd1296-6.2/logs.build

BuildPackageError:
Failed to build package.

[ERROR] pkgscripts-ng/PkgCreate.py -p rtd1296 -v 6.2 -S --build-opt=-J --print-log -c WireGuard failed!
Build log
=========
Set cache size limit to 3.0 Gbytes
Statistics cleared
rm: cannot remove '/env32.mak': No such file or directory
rm: cannot remove '/env64.mak': No such file or directory
[INFO] projectList="WireGuard"
[INFO] Start to build WireGuard.
[SCRIPT] build script: //source/WireGuard/SynoBuildConf/build
[INFO] ======= Run build script =======
rm -rf libmnl-1.0.4.tar.bz2 libmnl-1.0.4 WireGuard-0.0.20190227.tar.xz WireGuard-0.0.20190227
make: Entering directory '/source/WireGuard'
--2019-07-15 22:31:44--  https://netfilter.org/projects/libmnl/files/libmnl-1.0.4.tar.bz2
Resolving netfilter.org (netfilter.org)... 150.214.142.167
Connecting to netfilter.org (netfilter.org)|150.214.142.167|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 301270 (294K) [application/x-bzip2]
Saving to: 'libmnl-1.0.4.tar.bz2'

     0K .......... .......... .......... .......... .......... 16%  451K 1s
    50K .......... .......... .......... .......... .......... 33%  930K 0s
   100K .......... .......... .......... .......... .......... 50% 22.6M 0s
   150K .......... .......... .......... .......... .......... 67% 28.6M 0s
   200K .......... .......... .......... .......... .......... 84%  963K 0s
   250K .......... .......... .......... .......... ....      100% 31.2M=0.2s

2019-07-15 22:31:44 (1.30 MB/s) - 'libmnl-1.0.4.tar.bz2' saved [301270/301270]

checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for x86_64-unknown-linux-gnu-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to create a pax tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking for x86_64-unknown-linux-gnu-gcc... /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-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... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc accepts -g... yes
checking for /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc option to accept ISO C89... none needed
checking whether /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc... gcc3
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc... /usr/local/aarch64-unknown-linux-gnueabi/aarch64-unknown-linux-gnueabi/bin/ld
checking if the linker (/usr/local/aarch64-unknown-linux-gnueabi/aarch64-unknown-linux-gnueabi/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /bin/nm -B
checking the name lister (/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/local/aarch64-unknown-linux-gnueabi/aarch64-unknown-linux-gnueabi/bin/ld option to reload object files... -r
checking for x86_64-unknown-linux-gnu-objdump... no
checking for objdump... objdump
configure: WARNING: using cross tools not prefixed with host triplet
checking how to recognize dependent libraries... pass_all
checking for x86_64-unknown-linux-gnu-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for x86_64-unknown-linux-gnu-ar... no
checking for ar... ar
checking for archiver @FILE support... @
checking for x86_64-unknown-linux-gnu-strip... strip
checking for x86_64-unknown-linux-gnu-ranlib... no
checking for ranlib... ranlib
checking command to parse /bin/nm -B output from /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc object... ok
checking for sysroot... no
checking for x86_64-unknown-linux-gnu-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc supports -fno-rtti -fno-exceptions... no
checking for /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc option to produce PIC... -fPIC -DPIC
checking if /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc PIC flag -fPIC -DPIC works... yes
checking if /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc static flag -static works... yes
checking if /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc supports -c -o file.o... yes
checking if /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc supports -c -o file.o... (cached) yes
checking whether the /usr/local/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-gcc linker (/usr/local/aarch64-unknown-linux-gnueabi/aarch64-unknown-linux-gnueabi/bin/ld -m elf_x86_64) supports shared libraries... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... unsupported
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking whether compiler accepts -fvisibility=hidden... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating include/Makefile
config.status: creating include/libmnl/Makefile
config.status: creating include/linux/Makefile
config.status: creating include/linux/netfilter/Makefile
config.status: creating examples/Makefile
config.status: creating examples/genl/Makefile
config.status: creating examples/kobject/Makefile
config.status: creating examples/netfilter/Makefile
config.status: creating examples/rtnl/Makefile
config.status: creating libmnl.pc
config.status: creating doxygen.cfg
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
make[1]: Entering directory '/source/WireGuard/libmnl-1.0.4'
make[2]: Entering directory '/source/WireGuard/libmnl-1.0.4'
Making all in src
make[3]: Entering directory '/source/WireGuard/libmnl-1.0.4/src'
  CC       socket.lo
  CC       callback.lo
  CC       nlmsg.lo
  CC       attr.lo
  CCLD     libmnl.la
make[3]: Leaving directory '/source/WireGuard/libmnl-1.0.4/src'
Making all in include
make[3]: Entering directory '/source/WireGuard/libmnl-1.0.4/include'
Making all in libmnl
Making all in linux
make[4]: Entering directory '/source/WireGuard/libmnl-1.0.4/include/linux'
Making all in netfilter
make[4]: Leaving directory '/source/WireGuard/libmnl-1.0.4/include/linux'
make[3]: Leaving directory '/source/WireGuard/libmnl-1.0.4/include'
Making all in examples
make[3]: Entering directory '/source/WireGuard/libmnl-1.0.4/examples'
Making all in genl
Making all in kobject
Making all in netfilter
Making all in rtnl
make[3]: Leaving directory '/source/WireGuard/libmnl-1.0.4/examples'
make[3]: Entering directory '/source/WireGuard/libmnl-1.0.4'
make[3]: Leaving directory '/source/WireGuard/libmnl-1.0.4'
make[2]: Leaving directory '/source/WireGuard/libmnl-1.0.4'
make[1]: Leaving directory '/source/WireGuard/libmnl-1.0.4'
--2019-07-15 22:31:49--  https://git.zx2c4.com/WireGuard/snapshot/WireGuard-0.0.20190227.tar.xz
Resolving git.zx2c4.com (git.zx2c4.com)... 147.75.77.251, 2604:1380:1:4d00::3
Connecting to git.zx2c4.com (git.zx2c4.com)|147.75.77.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-xz]
Saving to: 'WireGuard-0.0.20190227.tar.xz'

     0K .......... .......... .......... .......... ..........  303K
    50K .......... .......... .......... .......... ..........  643K
   100K .......... .......... .......... .......... ..........  238K
   150K .......... .......... .......... .......... ..........  103K
   200K .......... .......... .......... .......... ..........  190K
   250K .......... .......... .......... .......... ..........  640K
   300K .......... ......                                      2.23M=1.3s

2019-07-15 22:31:51 (246 KB/s) - 'WireGuard-0.0.20190227.tar.xz' saved [323788]

patching file WireGuard-0.0.20190227/src/compat/Kbuild.include
make[1]: Entering directory '/source/WireGuard/WireGuard-0.0.20190227/src/tools'
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/wg.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/config.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/show.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/mnlg.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/terminal.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/ipc.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/encoding.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/curve25519.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/setconf.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/genkey.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/showconf.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/pubkey.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/set.o
  LD      /source/WireGuard/WireGuard-0.0.20190227/src/tools/wg
make[1]: Leaving directory '/source/WireGuard/WireGuard-0.0.20190227/src/tools'
make[1]: Entering directory '/source/WireGuard/WireGuard-0.0.20190227/src'
In file included from <command-line>:0:0:
/source/WireGuard/WireGuard-0.0.20190227/src/compat/memneq/include.h:2:19: error: redefinition of 'crypto_memneq'
 static inline int crypto_memneq(const void *a, const void *b, size_t size)
                   ^
In file included from /source/WireGuard/WireGuard-0.0.20190227/src/compat/compat.h:716:0,
                 from <command-line>:0:
include/crypto/algapi.h:380:19: note: previous definition of 'crypto_memneq' was here
 static inline int crypto_memneq(const void *a, const void *b, size_t size)
                   ^
scripts/Makefile.build:269: recipe for target '/source/WireGuard/WireGuard-0.0.20190227/src/main.o' failed
make[3]: *** [/source/WireGuard/WireGuard-0.0.20190227/src/main.o] Error 1
Makefile:1411: recipe for target '_module_/source/WireGuard/WireGuard-0.0.20190227/src' failed
make[2]: *** [_module_/source/WireGuard/WireGuard-0.0.20190227/src] Error 2
Makefile:37: recipe for target 'module' failed
make[1]: *** [module] Error 2
make[1]: Leaving directory '/source/WireGuard/WireGuard-0.0.20190227/src'
Makefile:57: recipe for target 'WireGuard-0.0.20190227/src/wireguard.ko' failed
make: *** [WireGuard-0.0.20190227/src/wireguard.ko] Error 2
make: Leaving directory '/source/WireGuard'

[Error] Build project fail!

----------------- Time cost statistics -----------------
Time cost: 00:00:14 [Build-->WireGuard]
[INFO] Build WireGuard finished!
Time cost: 00:00:14 [Build-->WireGuard]

########################################################
      Error(s) occurred on project "WireGuard"
########################################################
1 projects, 1 failed.

[Error] Check [/logs/error.build] for fixing errors.

Install log
===========
cat: /build_env/ds.rtd1296-6.2/logs.install: No such file or directory

My compile command:

$ sudo docker run --rm --privileged --env PACKAGE_ARCH=rtd1296 --env DSM_VER=6.2 -v $(pwd)/artifacts:/result_spk synobuild

My model info:

Model: DS418
CPU: Realtek RTD1296 SoC
DSM: DSM 6.2.2-24922 Update 2
$ uname -a
Linux HomeNAS 4.4.59+ #24922 SMP Wed Jul 3 16:36:23 CST 2019 aarch64 GNU/Linux synology_rtd1296_ds418
$ cat /proc/cpuinfo

processor       : 0
model name      : ARMv8 Processor rev 4 (v8l)
BogoMIPS        : 54.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
model name      : ARMv8 Processor rev 4 (v8l)
BogoMIPS        : 54.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
model name      : ARMv8 Processor rev 4 (v8l)
BogoMIPS        : 54.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
model name      : ARMv8 Processor rev 4 (v8l)
BogoMIPS        : 54.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Thanks for any help!

emansih commented 4 years ago

Yes I did remove the memneq line from makefile

runfalk commented 4 years ago

Based on the error it doesn't seem like you removed it. Just add --env HAS_MEMNEQ=1 as one of your arguments when you build it.

emansih commented 4 years ago

Maybe because I didn't call make clean?

emansih commented 4 years ago

the environment argument works.

runfalk commented 4 years ago

It may be because you created the docker image before modifying the Makefile. When you create the docker image it will copy the current Makefile.