Closed Ravbug closed 2 years ago
Perhaps try to pass to clang
flags -maes -mpcmul -march=native
?
I get the same result with those flags. I'm passing them like this:
if (NOT MSVC)
target_compile_options(${PROJECT_NAME} PUBLIC -maes -mpclmul)
endif()
The -march=native
flag does not work on Apple Clang but with g++ on Linux passing it did not have an effect either.
Libsodium was never meant to be compiled with cmake
. The source code doesn't include any support for cmake
. Compiling it in a custom way explicitly prints that this is unsupported.
Of course, you are free to invent your own build system, but then, please understand that you are on your own. Bug reports for 3rd party projects such as libsodium-cmake
should be reported there.
When I compile libsodium 1.0.18 for Linux (gcc), iOS, or macOS (clang), I'm getting the unavailable definitions for functions, for example,
crypto_aead_aes256gcm_is_available
due to conditional compilation is defined asI'm compiling the library using CMake. My
CMakeLists.txt
(adapted from here) looks like this:When I use this CMake file on Windows (MSVC) it works correctly and I get the definition from line 914 as expected:
How can I resolve this for the other platforms?