microsoft / PQCrypto-VPN

Post-quantum Cryptography VPN
https://www.microsoft.com/research/project/post-quantum-crypto-vpn/
MIT License
319 stars 74 forks source link

dev1.3 branch, build error #15

Closed ReverseControl closed 4 years ago

ReverseControl commented 4 years ago

I tried building in a docker container and I get this error following the instructions on the readme for the new branch. Since I am building in Linux the build should not fail if the windows-building-process fails.

Also, is nsis really required? Can we get rid of it? :)

Edit 1: I build on alpine base image, not ubuntu or the one in the repo.

Error message

Extract '/opt/PQCrypto-VPN/openvpn/build/repos/openvpn-build/windows-nsis/sources/liboqs.tar.gz'
Extract '/opt/PQCrypto-VPN/openvpn/build/repos/openvpn-build/windows-nsis/sources/lzo-2.10.tar.gz'
Extract '/opt/PQCrypto-VPN/openvpn/build/repos/openvpn-build/windows-nsis/sources/openssl-oqs.tar.gz'
Extract '/opt/PQCrypto-VPN/openvpn/build/repos/openvpn-build/windows-nsis/sources/openvpn-2.4.8.tar.gz'
Extract '/opt/PQCrypto-VPN/openvpn/build/repos/openvpn-build/windows-nsis/sources/openvpn-gui-11.tar.gz'
Extract '/opt/PQCrypto-VPN/openvpn/build/repos/openvpn-build/windows-nsis/sources/pkcs11-helper-1.22.tar.bz2'
Extract '/opt/PQCrypto-VPN/openvpn/build/repos/openvpn-build/windows-nsis/sources/tap-windows-9.24.2.zip'
Archive:  /opt/PQCrypto-VPN/openvpn/build/repos/openvpn-build/windows-nsis/sources/tap-windows-9.24.2.zip
   creating: tap-windows-9.24.2/
   creating: tap-windows-9.24.2/arm64/
  inflating: tap-windows-9.24.2/arm64/tapinstall.exe
  inflating: tap-windows-9.24.2/arm64/tap0901.cat
  inflating: tap-windows-9.24.2/arm64/tap0901.sys
  inflating: tap-windows-9.24.2/arm64/OemVista.inf
   creating: tap-windows-9.24.2/include/
  inflating: tap-windows-9.24.2/include/tap-windows.h
   creating: tap-windows-9.24.2/amd64/
  inflating: tap-windows-9.24.2/amd64/tapinstall.exe
  inflating: tap-windows-9.24.2/amd64/tap0901.cat
  inflating: tap-windows-9.24.2/amd64/tap0901.sys
  inflating: tap-windows-9.24.2/amd64/OemVista.inf
   creating: tap-windows-9.24.2/i386/
  inflating: tap-windows-9.24.2/i386/tapinstall.exe
  inflating: tap-windows-9.24.2/i386/tap0901.cat
  inflating: tap-windows-9.24.2/i386/tap0901.sys
  inflating: tap-windows-9.24.2/i386/OemVista.inf
Patch: '/opt/PQCrypto-VPN/openvpn/build/repos/openvpn-build/generic/patches/pkcs11-helper-001-RFC7512.patch'
patching file lib/pkcs11h-serialization.c
patching file lib/pkcs11h-util.c
Build liboqs
-- The C compiler identification is GNU 8.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/x86_64-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc -- broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/usr/bin/x86_64-w64-mingw32-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /opt/PQCrypto-VPN/openvpn/build/repos/openvpn-build/windows-nsis/tmp/build-x86_64/liboqs/build-win/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/ninja cmTC_38761 && [1/2] Building C object CMakeFiles/cmTC_38761.dir/testCCompiler.c.obj
    [2/2] Linking C executable cmTC_38761.exe
    FAILED: cmTC_38761.exe 
    : && /usr/bin/x86_64-w64-mingw32-gcc -Wl,--dynamicbase,--nxcompat   CMakeFiles/cmTC_38761.dir/testCCompiler.c.obj  -o cmTC_38761.exe -Wl,--out-implib,libcmTC_38761.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && :
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find crt2.o: No such file or directory
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find crtbegin.o: No such file or directory
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lkernel32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -luser32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgdi32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lwinspool
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lshell32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lole32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -loleaut32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -luuid
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lcomdlg32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -ladvapi32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lmingw32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgcc
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgcc_eh
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lmoldname
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lmingwex
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lmsvcrt
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -ladvapi32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lshell32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -luser32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lkernel32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lmingw32
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgcc
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgcc_eh
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lmoldname
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lmingwex
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lmsvcrt
    /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find crtend.o: No such file or directory
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:4 (project)

-- Configuring incomplete, errors occurred!
See also "/opt/PQCrypto-VPN/openvpn/build/repos/openvpn-build/windows-nsis/tmp/build-x86_64/liboqs/build-win/CMakeFiles/CMakeOutput.log".
See also "/opt/PQCrypto-VPN/openvpn/build/repos/openvpn-build/windows-nsis/tmp/build-x86_64/liboqs/build-win/CMakeFiles/CMakeError.log".
FATAL: cmake
FATAL: build x86_64 >&2
***** Running command: ninja
***** Running command: ninja install
***** Running command: ./config shared --prefix=/opt/PQCrypto-VPN/openvpn/build/scratch/oqs-openssl-output/openssl --openssldir=/opt/PQCrypto-VPN/openvpn/build/scratch/oqs-openssl-output/ssl -lm
***** Running command: make -j
***** Running command: make install
***** Running command: autoreconf -i -f -v
***** Running command: touch ./usr/local/openvpn/etc/.placeholder ./usr/local/openvpn/log/.placeholder
***** Running command: tar -cz --group=root --owner=root -f ../pq-openvpn-linux-staged.tar.gz .
***** Running command: tar czvvf /tmp/liboqs.tar.gz liboqs
***** Running command: tar czvvf /tmp/openssl-oqs.tar.gz openssl-oqs
***** Running command: autoreconf -i -v -f
***** Running command: ./configure
***** Running command: tar czvvf /tmp/openvpn-2.4.8.tar.gz openvpn-2.4.8
***** Running command: autoreconf -i -v -f
***** Running command: tar czvvf /tmp/openvpn-gui-11.tar.gz openvpn-gui
***** Running command: ./windows-nsis/build-complete
Traceback (most recent call last):
  File "build.py", line 236, in <module>
    build_openvpn_windows()
  File "build.py", line 207, in build_openvpn_windows
    run_command(['./windows-nsis/build-complete'])
  File "build.py", line 42, in run_command
    raise RuntimeError('Command failed')
RuntimeError: Command failed
The command '/bin/sh -c cd  /opt/PQCrypto-VPN/openvpn/build                          && python build.py' returned a non-zero code: 1
(ERROR)-(Exit Code 1)-(General error)
kevinmkane commented 4 years ago

nsis is required because it's used by OpenVPN's build process to build the Windows installer.

I want the full build to still be both Linux and Windows and to fail if either one doesn't succeed, but I'll add command line parameters to allow skipping one or the other when doing private builds. I've opened #16. nsis wouldn't be required when skipping the Windows build. In the meantime, you can comment out the call to build_openvpn_windows() at the bottom of build.py and that will skip the Windows build.

Based on your output, there are some dependencies that don't appear to be installed that are installed by the gcc-mingw-w64 package on Ubuntu. Since Alpine isn't one of our targeted build platforms I'm not going to investigate this further. If you want to investigate and submit a PR to add the necessary dependencies to build.py I'd be happy to take it.

ReverseControl commented 4 years ago

Yes, that appears to be the case, mingw is missing things. Also, nsis is a pain to install in alpine. I will skip the windows build for now in alpine, but it seems doable with some manual careful building of dependencies.

Otherwise, it builds fine. Thanks for the command line option. It is much better to have that then it is to edit the code, as building docker containers is more friendly to command line options. :D