runfalk / synology-wireguard

WireGuard support for some Synology NAS drives
MIT License
952 stars 135 forks source link

Build failed for apollolake DS218+ #2

Closed ghost closed 5 years ago

ghost commented 5 years ago

Tried to build this on a DS218+ in a Docker container for itself. All I'm doing differently from your instructions is swapping your processor target for my own.

root@764bd8649e25:/# pkgscripts-ng/PkgCreate.py -p apollolake -v 6.2 -S --build-opt=-J --print-log -c WireGuard

============================================================
                   Parse argument result                    
------------------------------------------------------------
env_section  : default
env_version  : 6.2
dep_level    : 1
branch       : master
suffix       : 
collect      : True
update       : True
link         : True
build        : True
install      : True
only_install : False
sign         : False
build_opt    : -J
install_opt  : 
print_log    : True
sdk_ver      : 6.0
package      : WireGuard

Processing [6.2-23739]: apollolake

============================================================
              Start to run "Traverse project"               
------------------------------------------------------------
[INFO] Branch projects: WireGuard
[INFO] Tag projects: 
[INFO] Reference projects: 
[INFO] Reference tag projects: 

============================================================
                Start to run "Link Project"                 
------------------------------------------------------------
Link /pkgscripts-ng -> /build_env/ds.apollolake-6.2/pkgscripts-ng
Link //source/WireGuard -> /build_env/ds.apollolake-6.2/source/WireGuard

============================================================
                Start to run "Build Package"                
------------------------------------------------------------
[apollolake] set -o pipefail; env PackageName=WireGuard /pkgscripts-ng/SynoBuild --apollolake -c --min-sdk 6.0 -J WireGuard 2>&1 | tee logs.build

############################################################
          /build_env/ds.apollolake-6.2/logs.build           
############################################################
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-03-21 02:14:46--  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%  400K 1s
    50K .......... .......... .......... .......... .......... 33%  821K 0s
   100K .......... .......... .......... .......... .......... 50% 11.4M 0s
   150K .......... .......... .......... .......... .......... 67% 1.55M 0s
   200K .......... .......... .......... .......... .......... 84% 1.49M 0s
   250K .......... .......... .......... .......... ....      100% 44.1M=0.3s

2019-03-21 02:14:46 (1.12 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/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-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 /usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc accepts -g... yes
checking for /usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc option to accept ISO C89... none needed
checking whether /usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of /usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-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/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc... /usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/bin/ld
checking if the linker (/usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/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/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/bin/ld option to reload object files... -r
checking for x86_64-unknown-linux-gnu-objdump... no
checking for objdump... objdump
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/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-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/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-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/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc supports -fno-rtti -fno-exceptions... no
checking for /usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc option to produce PIC... -fPIC -DPIC
checking if /usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc PIC flag -fPIC -DPIC works... yes
checking if /usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc static flag -static works... yes
checking if /usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc supports -c -o file.o... yes
checking if /usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc supports -c -o file.o... (cached) yes
checking whether the /usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc linker (/usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
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-03-21 02:14:53--  https://git.zx2c4.com/WireGuard/snapshot/WireGuard-0.0.20190227.tar.xz
Resolving git.zx2c4.com (git.zx2c4.com)... 192.95.5.69, 2607:5300:61:14f::c05f:545
Connecting to git.zx2c4.com (git.zx2c4.com)|192.95.5.69|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-xz]
Saving to: 'WireGuard-0.0.20190227.tar.xz'

     0K .......... .......... .......... .......... ..........  428K
    50K .......... .......... .......... .......... ..........  439K
   100K .......... .......... .......... .......... .......... 87.9M
   150K .......... .......... .......... .......... ..........  626K
   200K .......... .......... .......... .......... .......... 1.26M
   250K .......... .......... .......... .......... .......... 1.58M
   300K .......... ......                                      1.59M=0.4s

2019-03-21 02:14:55 (809 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/show.o
  CC      /source/WireGuard/WireGuard-0.0.20190227/src/tools/config.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/mnlg.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:54: 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: 00:00:16 [Build-->WireGuard]
[INFO] Build WireGuard finished!

----------------- Time cost statistics -----------------
Time cost: 00:00:16 [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. [apollolake] : WireGuard
Error log: /build_env/ds.apollolake-6.2/logs.build

BuildPackageError:
Failed to build package.

[ERROR] pkgscripts-ng/PkgCreate.py -p apollolake -v 6.2 -S --build-opt=-J --print-log -c WireGuard failed!
runfalk commented 5 years ago

It looks like apollolake comes shipped with crypto support enabled in the kernel. You can probably fix this by removing this line in the Makefile:

https://github.com/runfalk/synology-wireguard/blob/master/Makefile#L42

Let me know if it worked and I can try to enable that line conditionally on ARM only maybe. If you've patched the Makefile in other ways you may want to revert those changes.

ghost commented 5 years ago

It worked!

ShagoY commented 5 years ago

I have just successfully compiled the spk for my DS918+ with the deletion of the line. The spk is installed but as I have users using my NAS, I will test it tonight.

Edit : it works like a charm.