-
Notifications
You must be signed in to change notification settings - Fork 479
Platform specific notes for building liboqs
- OpenBSD
- OSX
- Windows
- Cross-compiling on Linux for ARM
- Cross-compiling on Debian/Ubuntu Linux for Windows
- Cross-compiling on Arch Linux for Windows
After installing the base prerequisites older computing hardware may require the installation of gcc-multilib
, e.g. by running apt install gcc-multilib
.
When compiling on ARMv8, by default benchmarking in liboqs
will use clock_gettime
, which offers lower temporal accuracy. To get the more accurate cycle count, ARMv8's Performance Monitoring Unit (PMU) can be used via the OQS_SPEED_USE_ARM_PMU option. Access to the PMU from user mode must be enabled via a kernel module. Instructions for this can be found here.
Install the dependencies using pkg_add
:
pkg_add cmake ninja
pkg_add -r python
pip3 install pytest pytest-xdist
Then proceed with the remaining instructions here.
Due to the large number of algorithms supported by liboqs
it is known that on some OSX installations linking may fail with the error message
/Applications/Xcode-11.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc: Argument list too long
All suggestions for resolving this limitation would be thankfully received, ideally by PR to the project. Until it is resolved, a possible solution is to not enable all algorithms. This can be facilitated by suitably setting to OFF
select algorithms using OQS_ENABLE_ build flags.
-
Install supported MS Visual Studio 19 and required cmake.
-
Continue according to paragraph 2 of the quick-start instructions for building liboqs. To use
msbuild
do not specifyninja
as a build tool, i.e., usecmake ..
for generating MSVC build targets. Execute them as usual, e.g. usingmsbuild ALL_BUILD.vcxproj
instead of runningninja
.
- Install required components:
Using the mingw64.exe shell:
pacman -S git \
mingw-w64-x86_64-cmake \
mingw-w64-x86_64-ninja \
mingw-w64-x86_64-python-pytest \
mingw-w64-x86_64-python-pytest-xdist \
mingw-w64-x86_64-toolchain
Using mingw32.exe shell:
pacman -S git \
mingw-w64-i686-cmake \
mingw-w64-i686-ninja \
mingw-w64-i686-python-pytest \
mingw-w64-i686-python-pytest-xdist \
mingw-w64-i686-toolchain
- Continue according to paragraph 2 of the quick-start instructions for building liboqs.
-
Install required components using cygwin setup: Be sure to select at least
git, gcc, ninja, cmake, python3
. Also installlibssl-devel
if building using OpenSSL (defaultliboqs
build option OQS_USE_OPENSSL). For testing, be sure to install python componentspytest
,pytest-xdist
, andpsutils
, using pip, e.g. running the commandpip install pytest pytest-xdist psutil
. -
Continue according to paragraph 2 of the quick-start instructions for building liboqs. When creating
cmake
Makefiles consider to disable algorithms not properly supported under Windows, e.g., using the commandcmake -GNinja -DOQS_ENABLE_KEM_BIKE=OFF ..
.
Binaries for ARM can be cross-compiled on Linux. In order to do so, you need to supply CMake with an appropriate toolchain file.
For example, to cross compile for a Raspberry Pi on an x86-64 Ubuntu Bionic machine:
apt install gcc-8-arm-linux-gnueabihf
mkdir build && cd build
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain_rasppi.cmake -DOQS_USE_OPENSSL=OFF ..
ninja
Binaries for Windows AMD64 can be cross-compiled on Linux. In order to do so, you need to supply CMake with an appropriate toolchain file. The following example shows how to use the toolchain for Windows AMD64 compilation. The subsequent section shows how to build using a different approach.
apt install gcc-mingw-w64
mkdir build && cd build
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain_windows-amd64.cmake ..
ninja
To compile for Windows AMD64 from Ubuntu Bionic and create a liboqs.dll
file
apt install cmake gcc gcc-mingw-w64 ninja-build
git clone https://github.com/open-quantum-safe/liboqs
cd liboqs
mkdir build && cd build
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain_windows-amd64.cmake -DOQS_DIST_BUILD=ON -DBUILD_SHARED_LIBS=ON ..
ninja
This will generate a bin/liboqs.dll
file in the build
directory that you will need to copy to Windows. You should configure it to be available via the PATH environment variable.
- Cross-compiled code does not activate all CPU feature optimization flags. If such optimized code is required, using native Windows tooling is recommended.
-
You need to enable the ownstuff repository.
-
Install required components:
pacman -S git \
mingw-w64-cmake \
mingw-w64-openssl \
mingw-w64-toolchain \
ninja
- Get the source:
git clone -b master https://github.com/open-quantum-safe/liboqs.git
cd liboqs
- Build:
mkdir build && cd build
x86_64-w64-mingw32-cmake .. -GNinja
ninja
mkdir build && cd build
i686-w64-mingw32-cmake .. -GNinja
ninja