Giter Club home page Giter Club logo

cryptopp-cmake's Introduction

Crypto++ CMake

-+- Build Status -+-

Build status - master

-+-

Latest release Commits Linux Windows Mac OS License

Introduction

This repository contains CMake files for Wei Dai's Crypto++ (https://github.com/weidai11/cryptopp) for those who use the library in Modern CMake projects.

See this announcement from crypto++ maintainers.

The emphasis on Modern here is very important. In 2022, we have some really good solutions to many of the build problems developers used to waste a lot of time on. CMake in particular has made so much progress to become one of the most widely used build systems for C++. But, we're not talking about CMake 2.x here. We're talking about CMake 3.11+ and maybe even CMake 3.24+.

For more details on this topic, see down below...

Table of Contents

Before you ask

  • Can you support an older version of CMake? You really don't need 3.21...

    No.

    This is an opinionated fork with the main purpose being to stay always on a recent version of CMake. We believe that the build system should be the latest unlike compilers and Operating Systems. If you want to stay on old versions, please take a look at the old repo.

  • Can you fix the shared library build? I really like DLLs...

    Me too, but No.

    Crypto++ does not properly export symbols and manage visibility. You can request this feature from the crypto++ project maintainers. The old DLL build was only for FIPS version, with limited symbol exports. That version is going end-of-life and there is no point from supporting it here.

    If you love DLLs, you can make a Wrapper DLL as explained on crypto++ wiki.

    The CMakeLists.txt in this project are already built for shared and static builds, but the shared build is locked until crypto++ is ready for it.

  • Why did you change XXX? It used to work like YYY before...

    I don't know.

    I use crypto++ in my project, and I use it in a way that I learnt and improved over time through experience, extensive reading of other peoples' experiences, and sticking as close as possible to modern cmake practices. I'm open to new ways and suggestions, especially if they come via a tracked issue, a rationale and a pull request. If you have a valid use case, please document it in an issue and let's find someone to help make it happen for you. It's Open Source πŸ˜ƒ

Versioning principles

This project releases track the crypto++ releases. In other words, every time a new release of crypto++ happens, this project gets updated to take into account changes in source files, compiler options etc, and will see a new release with the same number than crypto++.

At times, bug fixes in this project will happen before a new crypto++ release is published. When a certain number of fixes have been added, and depending on the criticality of the defects, an additional release tag may be made. These patch tags will never introduce any additional changes in crypto++ itself.

Main release tags will have the format: CRYPTOPP_M_m_p, while patch tags will have the format CRYPTOPP_M_m_p_f, where M.m.p represents the crypto++ version and f is a suffix number incremented each time a patch tag is created. Patch tags will keep the same crypto++ version as the main release tag.

As always, if you want to get the latest and greatest, always track the master branch.

Standard usage

  • Get this project using your favorite method (clone as submodule, get with FetchContent, get with CPM...)

  • In your master CMakeLists.txt, add the following:

    add_subdirectory(xxxx)
    # where xxx is the location where you put the cryptopp-cmake files

    That's pretty much it. You'll be able to link against cryptopp or the scoped alias cryptopp::cryptopp and have cmake handle everything else for you.

An example is located in the test/standard-cpm directory.

Using a local copy of crypto++

Certain users would prefer to have a fully disconnected project, and in such scenario both the crypto++ source package and the cryptopp-cmake source package would be pre-downloaded and then unpacked somewhere.

You would still need to add cryptopp-cmake as a subdirectory in your master CMakeLists.txt, and you can set it up in such a way to use your local copy of crypto++ via the option CRYPTOPP_SOURCES. Just set that option in the cmake command line or in your CMakeLists.txt to point to the crypto++ source directory. The rest will be taken care of for you.

Requesting the master branch of cryptopp

If you want to test the bleeding edge of crypto++ with cmake, simply set the option CRYPTOPP_USE_MASTER_BRANCH in your CMakeLists.txt or the cmake command line and as usual, add the cryptopp-cmake as a subdirectory.

Other ways

There are many other ways to use this project, including by directly picking the files you need and adding them to your own project, by getting the package via conan, etc... Take some time to read the source code, and make suggestions if you need a new usage scenario via a new issue.

Why Modern CMake?

Have a look at Installing CMake from the online 'Modern CMake' book, to see a recent snapshot of which version of CMake is being installed by default on Linux distributions.

Packaging Status

And more than that, it's so easy to install a modern version of CMake on Linux/MacOS/Windows, and many other OSes.

Looking at the release notes of CMake versions from 3.0 till now, a minimum version requirement of 3.21 is a good starting point. That release brings in particular presets and some nice quality of life features that will make the maintenance and the use of this project much simpler and pleasant. After all, there is no justification for doing free Open Source without pleasure πŸ˜ƒ

cryptopp-cmake's People

Contributors

abdes avatar botanegg avatar chausner avatar chrisburr avatar felipefarinon avatar foretspaisibles avatar fwosar avatar kobykahane avatar naville avatar oddegamra avatar smessmer avatar unbreak4ble avatar vollstrecker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cryptopp-cmake's Issues

Cannot cross-compile to x64 on Apple Silicon

The CMake script tries to get the build target information from the system (dumpmachine), which is wrong. Instead something like CMAKE_SYSTEM_PROCESSOR and CMAKE_OSX_ARCHITECTURES should be used to get the cross-compilation target given to CMake.

=> Project : cryptopp v8.7.0 (51d00a28d761)
-- Found Git: /usr/bin/git (found version "2.37.0 (Apple Git-136)") 
-- downloading/updating cryptopp
-- cryptopp directory not found, cloning...
Cloning into '/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp'...
-- 
Switched to a new branch 'tag_CRYPTOPP_8_7_0'
-- 
-- Crypto++ auto fetched at: /Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp
=> Module : cryptopp
-- [cryptopp] CMake version 3.23.2
-- [cryptopp] System Darwin
-- [cryptopp] Processor arm64
-- [cryptopp] Performing Test CRYPTOPP_ARM_ACLE_HEADER
-- [cryptopp] Performing Test CRYPTOPP_ARM_ACLE_HEADER - Failed
-- Performing Test CRYPTOPP_ARMV8A_ASIMD
-- Performing Test CRYPTOPP_ARMV8A_ASIMD - Failed
-- Performing Test CRYPTOPP_ARMV8A_CRC
-- Performing Test CRYPTOPP_ARMV8A_CRC - Failed
-- Performing Test CRYPTOPP_ARMV8A_CRYPTO
-- Performing Test CRYPTOPP_ARMV8A_CRYPTO - Failed
-- [cryptopp] Generating cmake package config files
-- [cryptopp] Generating pkgconfig files
-- [cryptopp] Platform: ARMv8
-- [cryptopp] Compiler definitions:  CRYPTOPP_DATA_DIR="/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp";CRYPTOPP_DISABLE_ARM_ASIMD;CRYPTOPP_DISABLE_ARM_CRC32;CRYPTOPP_DISABLE_ARM_AES;CRYPTOPP_DISABLE_ARM_PMULL;CRYPTOPP_DISABLE_ARM_SHA
-- [cryptopp] Compiler options:   
-- [cryptopp] Build type: RelWithDebInfo

This results in tons of errors, because the extensions are enabled by the defines but without the corresponding compiler flags.

FAILED: _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/chacha_avx.cpp.o 
/usr/bin/clang++ -DCRYPTOPP_DATA_DIR=\"/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ARM_AES -DCRYPTOPP_DISABLE_ARM_ASIMD -DCRYPTOPP_DISABLE_ARM_CRC32 -DCRYPTOPP_DISABLE_ARM_PMULL -DCRYPTOPP_DISABLE_ARM_SHA -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps -O2 -g -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=11 -fPIC -fvisibility=hidden -Wno-inconsistent-missing-override -Wno-missing-declarations -Wno-comment -Wno-uninitialized -Wno-deprecated-declarations -Wno-switch -Wno-potentially-evaluated-expression -Wno-parentheses "-Wno-#pragma-messages" -Wno-delete-abstract-non-virtual-dtor -Wno-invalid-source-encoding -Wno-empty-body -Wno-unused-value -MD -MT _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/chacha_avx.cpp.o -MF _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/chacha_avx.cpp.o.d -o _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/chacha_avx.cpp.o -c /Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/chacha_avx.cpp
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/chacha_avx.cpp:93:28: error: always_inline function '_mm256_broadcastsi128_si256' requires target feature 'avx2', but would be inlined into function 'ChaCha_OperateKeystream_AVX2' that is compiled without support for 'avx2'
    const __m256i state0 = _mm256_broadcastsi128_si256(
                           ^
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/chacha_avx.cpp:93:28: error: AVX vector return of type '__m256i' (vector of 4 'long long' values) without 'avx' enabled changes the ABI
... more errors ...
20 errors generated.
FAILED: _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/crc_simd.cpp.o 
/usr/bin/clang++ -DCRYPTOPP_DATA_DIR=\"/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ARM_AES -DCRYPTOPP_DISABLE_ARM_ASIMD -DCRYPTOPP_DISABLE_ARM_CRC32 -DCRYPTOPP_DISABLE_ARM_PMULL -DCRYPTOPP_DISABLE_ARM_SHA -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps -O2 -g -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=11 -fPIC -fvisibility=hidden -Wno-inconsistent-missing-override -Wno-missing-declarations -Wno-comment -Wno-uninitialized -Wno-deprecated-declarations -Wno-switch -Wno-potentially-evaluated-expression -Wno-parentheses "-Wno-#pragma-messages" -Wno-delete-abstract-non-virtual-dtor -Wno-invalid-source-encoding -Wno-empty-body -Wno-unused-value -MD -MT _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/crc_simd.cpp.o -MF _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/crc_simd.cpp.o.d -o _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/crc_simd.cpp.o -c /Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/crc_simd.cpp
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/crc_simd.cpp:155:13: error: always_inline function '_mm_crc32_u8' requires target feature 'crc32', but would be inlined into function 'CRC32C_Update_SSE42' that is compiled without support for 'crc32'
        c = _mm_crc32_u8(c, *s);
            ^
... more errors ...
7 errors generated.
FAILED: _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/gcm_simd.cpp.o 
/usr/bin/clang++ -DCRYPTOPP_DATA_DIR=\"/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ARM_AES -DCRYPTOPP_DISABLE_ARM_ASIMD -DCRYPTOPP_DISABLE_ARM_CRC32 -DCRYPTOPP_DISABLE_ARM_PMULL -DCRYPTOPP_DISABLE_ARM_SHA -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps -O2 -g -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=11 -fPIC -fvisibility=hidden -Wno-inconsistent-missing-override -Wno-missing-declarations -Wno-comment -Wno-uninitialized -Wno-deprecated-declarations -Wno-switch -Wno-potentially-evaluated-expression -Wno-parentheses "-Wno-#pragma-messages" -Wno-delete-abstract-non-virtual-dtor -Wno-invalid-source-encoding -Wno-empty-body -Wno-unused-value -MD -MT _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/gcm_simd.cpp.o -MF _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/gcm_simd.cpp.o.d -o _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/gcm_simd.cpp.o -c /Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/gcm_simd.cpp
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/gcm_simd.cpp:400:24: error: '__builtin_ia32_pclmulqdq128' needs target feature pclmul
    const __m128i c0 = _mm_clmulepi64_si128(x,h,0);
                       ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/__wmmintrin_pclmul.h:45:13: note: expanded from macro '_mm_clmulepi64_si128'
  ((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(X), \
            ^
... more errors ...
16 errors generated.
FAILED: _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/gf2n_simd.cpp.o 
/usr/bin/clang++ -DCRYPTOPP_DATA_DIR=\"/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ARM_AES -DCRYPTOPP_DISABLE_ARM_ASIMD -DCRYPTOPP_DISABLE_ARM_CRC32 -DCRYPTOPP_DISABLE_ARM_PMULL -DCRYPTOPP_DISABLE_ARM_SHA -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps -O2 -g -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=11 -fPIC -fvisibility=hidden -Wno-inconsistent-missing-override -Wno-missing-declarations -Wno-comment -Wno-uninitialized -Wno-deprecated-declarations -Wno-switch -Wno-potentially-evaluated-expression -Wno-parentheses "-Wno-#pragma-messages" -Wno-delete-abstract-non-virtual-dtor -Wno-invalid-source-encoding -Wno-empty-body -Wno-unused-value -MD -MT _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/gf2n_simd.cpp.o -MF _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/gf2n_simd.cpp.o.d -o _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/gf2n_simd.cpp.o -c /Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/gf2n_simd.cpp
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/gf2n_simd.cpp:189:10: error: '__builtin_ia32_pclmulqdq128' needs target feature pclmul
    c0 = _mm_clmulepi64_si128(a, b, 0x00);
         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/__wmmintrin_pclmul.h:45:13: note: expanded from macro '_mm_clmulepi64_si128'
  ((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(X), \
            ^
... more errors ...
7 errors generated.
FAILED: _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/lsh256_avx.cpp.o 
/usr/bin/clang++ -DCRYPTOPP_DATA_DIR=\"/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ARM_AES -DCRYPTOPP_DISABLE_ARM_ASIMD -DCRYPTOPP_DISABLE_ARM_CRC32 -DCRYPTOPP_DISABLE_ARM_PMULL -DCRYPTOPP_DISABLE_ARM_SHA -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps -O2 -g -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=11 -fPIC -fvisibility=hidden -Wno-inconsistent-missing-override -Wno-missing-declarations -Wno-comment -Wno-uninitialized -Wno-deprecated-declarations -Wno-switch -Wno-potentially-evaluated-expression -Wno-parentheses "-Wno-#pragma-messages" -Wno-delete-abstract-non-virtual-dtor -Wno-invalid-source-encoding -Wno-empty-body -Wno-unused-value -MD -MT _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/lsh256_avx.cpp.o -MF _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/lsh256_avx.cpp.o.d -o _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/lsh256_avx.cpp.o -c /Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/lsh256_avx.cpp
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/lsh256_avx.cpp:407:46: error: always_inline function '_mm256_setzero_si256' requires target feature 'avx', but would be inlined into function 'zero_submsgs' that is compiled without support for 'avx'
        _mm256_storeu_si256(M256_CAST(sub_msgs+ 0), _mm256_setzero_si256());
                                                    ^
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/lsh256_avx.cpp:407:46: error: AVX vector return of type '__m256i' (vector of 4 'long long' values) without 'avx' enabled changes the ABI
... more errors ...
20 errors generated.
FAILED: _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/lsh512_avx.cpp.o 
/usr/bin/clang++ -DCRYPTOPP_DATA_DIR=\"/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ARM_AES -DCRYPTOPP_DISABLE_ARM_ASIMD -DCRYPTOPP_DISABLE_ARM_CRC32 -DCRYPTOPP_DISABLE_ARM_PMULL -DCRYPTOPP_DISABLE_ARM_SHA -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps -O2 -g -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=11 -fPIC -fvisibility=hidden -Wno-inconsistent-missing-override -Wno-missing-declarations -Wno-comment -Wno-uninitialized -Wno-deprecated-declarations -Wno-switch -Wno-potentially-evaluated-expression -Wno-parentheses "-Wno-#pragma-messages" -Wno-delete-abstract-non-virtual-dtor -Wno-invalid-source-encoding -Wno-empty-body -Wno-unused-value -MD -MT _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/lsh512_avx.cpp.o -MF _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/lsh512_avx.cpp.o.d -o _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/lsh512_avx.cpp.o -c /Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/lsh512_avx.cpp
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/lsh512_avx.cpp:492:3: error: always_inline function '_mm256_setzero_si256' requires target feature 'avx', but would be inlined into function 'zero_submsgs' that is compiled without support for 'avx'
                _mm256_setzero_si256());
                ^
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/lsh512_avx.cpp:492:3: error: AVX vector return of type '__m256i' (vector of 4 'long long' values) without 'avx' enabled changes the ABI
... more errors ...
20 errors generated.
FAILED: _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/rijndael_simd.cpp.o 
/usr/bin/clang++ -DCRYPTOPP_DATA_DIR=\"/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ARM_AES -DCRYPTOPP_DISABLE_ARM_ASIMD -DCRYPTOPP_DISABLE_ARM_CRC32 -DCRYPTOPP_DISABLE_ARM_PMULL -DCRYPTOPP_DISABLE_ARM_SHA -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps -O2 -g -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=11 -fPIC -fvisibility=hidden -Wno-inconsistent-missing-override -Wno-missing-declarations -Wno-comment -Wno-uninitialized -Wno-deprecated-declarations -Wno-switch -Wno-potentially-evaluated-expression -Wno-parentheses "-Wno-#pragma-messages" -Wno-delete-abstract-non-virtual-dtor -Wno-invalid-source-encoding -Wno-empty-body -Wno-unused-value -MD -MT _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/rijndael_simd.cpp.o -MF _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/rijndael_simd.cpp.o.d -o _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/rijndael_simd.cpp.o -c /Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/rijndael_simd.cpp
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/rijndael_simd.cpp:466:50: error: '__builtin_ia32_aeskeygenassist128' needs target feature aes
        rk[keyLen/4] = rk[0] ^ _mm_extract_epi32(_mm_aeskeygenassist_si128(temp, 0), 3) ^ *(rc++);
                                                 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/__wmmintrin_aes.h:136:13: note: expanded from macro '_mm_aeskeygenassist_si128'
  ((__m128i)__builtin_ia32_aeskeygenassist128((__v2di)(__m128i)(C), (int)(R)))
            ^
... more errors ...
5 errors generated.
FAILED: _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/sha_simd.cpp.o 
/usr/bin/clang++ -DCRYPTOPP_DATA_DIR=\"/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ARM_AES -DCRYPTOPP_DISABLE_ARM_ASIMD -DCRYPTOPP_DISABLE_ARM_CRC32 -DCRYPTOPP_DISABLE_ARM_PMULL -DCRYPTOPP_DISABLE_ARM_SHA -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps -O2 -g -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=11 -fPIC -fvisibility=hidden -Wno-inconsistent-missing-override -Wno-missing-declarations -Wno-comment -Wno-uninitialized -Wno-deprecated-declarations -Wno-switch -Wno-potentially-evaluated-expression -Wno-parentheses "-Wno-#pragma-messages" -Wno-delete-abstract-non-virtual-dtor -Wno-invalid-source-encoding -Wno-empty-body -Wno-unused-value -MD -MT _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/sha_simd.cpp.o -MF _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/sha_simd.cpp.o.d -o _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/sha_simd.cpp.o -c /Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/sha_simd.cpp
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/sha_simd.cpp:256:16: error: '__builtin_ia32_sha1rnds4' needs target feature sha
        ABCD = _mm_sha1rnds4_epu32(ABCD, E0, 0);
               ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/shaintrin.h:21:3: note: expanded from macro '_mm_sha1rnds4_epu32'
  __builtin_ia32_sha1rnds4((__v4si)(__m128i)(V1), (__v4si)(__m128i)(V2), (M))
  ^
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/sha_simd.cpp:261:14: error: always_inline function '_mm_sha1nexte_epu32' requires target feature 'sha', but would be inlined into function 'SHA1_HashMultipleBlocks_SHANI' that is compiled without support for 'sha'
        E1 = _mm_sha1nexte_epu32(E1, MSG1);
             ^
... more errors ...
20 errors generated.
FAILED: _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/shacal2_simd.cpp.o 
/usr/bin/clang++ -DCRYPTOPP_DATA_DIR=\"/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ARM_AES -DCRYPTOPP_DISABLE_ARM_ASIMD -DCRYPTOPP_DISABLE_ARM_CRC32 -DCRYPTOPP_DISABLE_ARM_PMULL -DCRYPTOPP_DISABLE_ARM_SHA -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps -O2 -g -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=11 -fPIC -fvisibility=hidden -Wno-inconsistent-missing-override -Wno-missing-declarations -Wno-comment -Wno-uninitialized -Wno-deprecated-declarations -Wno-switch -Wno-potentially-evaluated-expression -Wno-parentheses "-Wno-#pragma-messages" -Wno-delete-abstract-non-virtual-dtor -Wno-invalid-source-encoding -Wno-empty-body -Wno-unused-value -MD -MT _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/shacal2_simd.cpp.o -MF _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/shacal2_simd.cpp.o.d -o _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/shacal2_simd.cpp.o -c /Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/shacal2_simd.cpp
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/shacal2_simd.cpp:68:8: error: always_inline function '_mm_sha256rnds2_epu32' requires target feature 'sha', but would be inlined into function 'SHACAL2_Enc_ProcessAndXorBlock_SHANI' that is compiled without support for 'sha'
                B1 = _mm_sha256rnds2_epu32(B1, B0, RK0);
                     ^
... more errors ...
4 errors generated.
FAILED: _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/sm4_simd.cpp.o 
/usr/bin/clang++ -DCRYPTOPP_DATA_DIR=\"/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ARM_AES -DCRYPTOPP_DISABLE_ARM_ASIMD -DCRYPTOPP_DISABLE_ARM_CRC32 -DCRYPTOPP_DISABLE_ARM_PMULL -DCRYPTOPP_DISABLE_ARM_SHA -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp -I/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps -O2 -g -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=11 -fPIC -fvisibility=hidden -Wno-inconsistent-missing-override -Wno-missing-declarations -Wno-comment -Wno-uninitialized -Wno-deprecated-declarations -Wno-switch -Wno-potentially-evaluated-expression -Wno-parentheses "-Wno-#pragma-messages" -Wno-delete-abstract-non-virtual-dtor -Wno-invalid-source-encoding -Wno-empty-body -Wno-unused-value -MD -MT _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/sm4_simd.cpp.o -MF _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/sm4_simd.cpp.o.d -o _deps/cryptopp-build/cryptopp/CMakeFiles/cryptopp.dir/__/_deps/cryptopp/sm4_simd.cpp.o -c /Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/sm4_simd.cpp
/Users/aleksisapon/Sources/PortableFLS/out/build/macos-x64-release/_deps/cryptopp-build/_deps/cryptopp/sm4_simd.cpp:246:13: error: always_inline function '_mm_aesenclast_si128' requires target feature 'aes', but would be inlined into function 'SM4_Encrypt' that is compiled without support for 'aes'
        x = _mm_aesenclast_si128(x, c0f);   // AESNI instruction
            ^
1 error generated.

Make build interface include directory prefixed in the same way as install interface

Currently, if a user uses cryptopp-cmake with the install interface (i.e. via a find_package() for example), the includes will be prefixed with cryptopp. However, if the project is used directly within another CMake project, the build interface is used instead, and the includes will be taken directly from the CRYPROPP_PROJECT_DIR, not prefixed with cryptopp.

This behavior creates an inconsistent convention that will not work if the code is moved from source level dependency to install dependency.

Windows Build Error for RelWithDebInfo

Setup: cryptopp-cmake and cryptopp are subfolders of my main project. cryptopp-cmake is included with add_subdirectory and CRYPTOPP_SOURCES points to the folder containing cryptopp.

Building works fine on Ubuntu, but on WIndows it fails with

=> Module : cryptopp
-- Using branch HEAD for tests
-- [cryptopp] CMake version 3.26.4
-- [cryptopp] System Windows
-- [cryptopp] Processor AMD64
-- [cryptopp] CMAKE_HOST_SYSTEM_PROCESSOR : AMD64
-- [cryptopp]      CMAKE_SYSTEM_PROCESSOR : AMD64
-- [cryptopp] Target architecture detected as: x86_64 -> CRYPTOPP_AMD64
-- Looking for C++ include winapifamily.h
-- Looking for C++ include winapifamily.h - found
-- The ASM_MASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/ml64.exe
-- Found OpenMP_C: -openmp (found version "2.0") 
-- Found OpenMP_CXX: -openmp (found version "2.0") 
-- Found OpenMP: TRUE (found version "2.0")  
-- [cryptopp] Generating cmake package config files
-- [cryptopp] Generating pkgconfig files
-- [cryptopp] Platform: x86_64
-- [cryptopp] Compiler definitions:  _WIN32_WINNT=0x0A00
-- [cryptopp] Compiler options: /DWIN32 /D_WINDOWS /EHsc   /FIwinapifamily.h;/GR;/MP;/EHsc
-- [cryptopp] Build type: RelWithDebInfo
-- Building version 0.11.3+90.gee5b0db6
-- Linking to Dokan x86_64
-- This is Windows. Will not install man page
-- Building version 0.11.3+90.gee5b0db6
-- WIX package version is 0.11.3
-- Configuring done (57.0s)
-- Generating done (0.5s)
-- Build files have been written to: D:/a/cryfs/cryfs/build
cmake --build . --config RelWithDebInfo
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(436,5): error MSB8013: This project doesn't contain the Configuration and Platform combination of RelWithDebInfo|x64. [D:\a\cryfs\cryfs\build\ZERO_CHECK.vcxproj]
Error: Process completed with exit code 1.

I'm not sure why this happens, in the previous cryptopp-cmake, it worked fine. Before upgrading to cryptopp 8.8.0 and this new cmake, CI passes and after upgrading, it fails.

Upgrade commit: cryfs/cryfs@ee5b0db
CI Error: https://github.com/cryfs/cryfs/actions/runs/5571367891/job/15085389729

Note that building with -DCMAKE_BUILD_TYPE=Release or -DCMAKE_BUILD_TYPE=Debug fail with a different error, so maybe this bug only exists for -DCMAKE_BUILD_TYPE=RelWithDebInfo.

neon_simd.cpp missing in sources

Using this to build a package on Apple M1. Errored saying CPU_ProbeNEON not found. Is there a reason why this file is not included?

The following fixes builds locally for me:

diff --git a/cryptopp/sources.cmake b/cryptopp/sources.cmake
index ed49b2d..c14cad4 100644
--- a/cryptopp/sources.cmake
+++ b/cryptopp/sources.cmake
@@ -108,6 +108,7 @@ set(cryptopp_SOURCES
     mqueue.cpp
     mqv.cpp
     nbtheory.cpp
+    neon_simd.cpp
     oaep.cpp
     osrng.cpp
     padlkrng.cpp

Please pickup Commit 0b5747421b27 for CMake

Crypto++ is working around a code generation bug when using GCC 12 on Linux. The bug is, GCC 12 is removing live code and its causing the test program to crash. Also see Crypto++ Issue 1141 and Commit 0b5747421b27. This is a GCC bug and workaround. It is not a bug in Crypto++.

We have a workaround which uses the compile flag -fno-devirtualize. CMake needs the logic to add -fno-devirtualize when appropriate. Commit 0b5747421b27 adds a test program and the makefile runs the test program with the option -fno-devirtualize. If on Linux with GCC 12 or above, then the test program will succeed. Otherwise the test program will fail. If the test program succeeds, then CMake needs to do the equivalent to CXXFLAGS += -fno-devirtualize.

We released Crypto++ 8,7 on August 7, 2022. We are planning for a Crypto++ 8.8 release around September 7 to get the latest problems off the books. The 8.8 release will include this workaround.

For completeness, GCC 12 is starting to show up in distros. At the time of this writing, it is available in Debian Unstable, Fedora 37 and Gentoo. Eventually (in a couple of years) it will show up in a lot of places.

MacOS: Building Universal Binaries with XCode

The following situation:

  • Building a Universal Binary (x86_64 + arm64) on MacOS with XCode
  • Use XCode as cmake generator
  • XCode default for building Universal Binaries is to set architecture as $(ARCHS_STANDARD) via CMAKE_OSX_ARCHITECTURES
  • However, $(ARCHS_STANDARD) is not handled in TargetArch.cmake and cmake terminates with an error

IMHO this should be caught in TargetArch.cmake like this:

elseif("${osx_arch}" STREQUAL "$(ARCHS_STANDARD)")
  set(osx_arch_arm64 TRUE)
  set(osx_arch_x86_64 TRUE) 

For me, that's how it works in my fork. But I'm not sure if this has any side effects.

Errors using FetchContent_Declare and FetchContent_GetProperties to get cryptopp-cmake

If I understood it correctly, then from version 8_7_0 the Cryptopp library is being downloaded as a submodule. Which was the case for me so far until I've deleted my build folder with the _deps folder. But now I'm getting errors and I want to know if this is still the way to get cryptopp-cmake and if it's still getting cryptopp library as part of the process.

############################################################################################
# Get the CryptoPP CMakeLists.txt File for CryptoPP Package GIT_TAG Must be the Same 
############################################################################################
set(CRYPTOPP_CMAKE "cryptopp-cmake")
set(CRYPTOPP_CMAKE_GIT_TAG "CRYPTOPP_8_7_0")
message(CHECK_START "Fetching CryptoPP-CMAKE (${CRYPTOPP_CMAKE_GIT_TAG})")
FetchContent_Declare(
    ${CRYPTOPP_CMAKE}
    GIT_REPISITORY  https://github.com/abdes/cryptopp-cmake.git
    GIT_TAG         ${CRYPTOPP_CMAKE_GIT_TAG}
    GIT_SHALLOW     ON
)

FetchContent_GetProperties(${CRYPTOPP_CMAKE})
if(NOT ${CRYPTOPP_CMAKE}_POPULATED)
    FetchContent_Populate(${CRYPTOPP_CMAKE})
    add_subdirectory(${${CRYPTOPP_CMAKE}_SOURCE_DIR} ${${CRYPTOPP_CMAKE}_BINARY_DIR})
endif()

The error that I'm getting is related to FetchContent_Populate(${CRYPTOPP_CMAKE}) line.

-- Fetching CryptoPP-CMAKE (CRYPTOPP_8_7_0)
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/ExternalProject.cmake:2882 (message):
[cmake] No download info given for 'cryptopp-cmake-populate' and its source
[cmake] directory:
[cmake]
[cmake] F:/hmmenc_client/build/_deps/cryptopp-cmake-src
[cmake]
[cmake] is not an existing non-empty directory. Please specify one of:
[cmake]
[cmake] * SOURCE_DIR with an existing non-empty directory
[cmake] * DOWNLOAD_COMMAND
[cmake] * URL
[cmake] * GIT_REPOSITORY
[cmake] * SVN_REPOSITORY
[cmake] * HG_REPOSITORY
[cmake] * CVS_REPOSITORY and CVS_MODULE
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "F:/hmmenc_client/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "F:/hmmenc_client/build/CMakeFiles/CMakeError.log".
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.22/Modules/ExternalProject.cmake:3716 (_ep_add_download_command)
[cmake] CMakeLists.txt:15 (ExternalProject_Add)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "F:/hmmenc_client/build/_deps/cryptopp-cmake-subbuild/CMakeFiles/CMakeOutput.log".
[cmake]
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/FetchContent.cmake:1075 (message):
[cmake] CMake step for cryptopp-cmake failed: 1
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.22/Modules/FetchContent.cmake:1216:EVAL:2 (__FetchContent_directPopulate)
[cmake] C:/Program Files/CMake/share/cmake-3.22/Modules/FetchContent.cmake:1216 (cmake_language)
[cmake] CMakeLists.txt:123 (FetchContent_Populate)

I'm using VScode v1.72 and CMake v3.22.3 on Windows 11. CMakeOutput.log and CMakeError.log didn't show anything reasonable.

Release for Crypto++ 8.7.0

This is a tracker for general discussions regarding release 8.7.0, being prepared in the master branch.

Please provide feedback, and discuss potential changes here,

The issue will be closed when the release tag is published.

Facing build errors

After switching to this cmake script of cryptopp, I'm facing the following include error:
image

Lack of PEM pack support

The new build system currently has no support for the Crypto++ PEM pack. In the past, to compile Crypto++ with PEM Pack support, you had to copy over the files into the sources folder, which were then included in the build process due to it using GLOB. This is essentially what the vcpkg package for Crypto++ does to this day. Since the new script uses a file list instead of a GLOB, would it be possible to optionally include the PEM pack files so Crypto++ can again be compiled with PEM pack support?

A similar issue is also open at vcpkg. It looks like the person who reported it never reported it upstream. Or at least I have yet to see them post here.

Problem with building for raspberrypi4 with raspbian buster armv7l

I catcha problem with b13d402 cryptopp-cmake

=> Module : cryptopp
-- [cryptopp] CMake version 3.25.2
-- [cryptopp] System Linux
-- [cryptopp] Processor armv7l
-- [cryptopp] CMAKE_HOST_SYSTEM_PROCESSOR : armv7l
-- [cryptopp]      CMAKE_SYSTEM_PROCESSOR : armv7l
-- [cryptopp] Target architecture detected as: arm -> CRYPTOPP_ARM32
-- [cryptopp] Performing Test CRYPTOPP_ARM_NEON_HEADER
-- [cryptopp] Performing Test CRYPTOPP_ARM_NEON_HEADER - Success
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_NEON
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_NEON - Success
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- [cryptopp] Generating cmake package config files
-- [cryptopp] Generating pkgconfig files
-- [cryptopp] Platform: ARM-32
-- [cryptopp] NEON: TRUE

I got next errors on build stage:

In file included from <PATH>/cryptopp-cmake/build/_deps/cryptopp/blake2b_simd.cpp:49:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h: In function β€˜void CryptoPP::BLAKE2_Compress64_NEON(const byte*, CryptoPP::BLAKE2b_State&)’:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:10399:1: error: inlining failed in call to always_inline β€˜uint8x16_t vld1q_u8(const uint8_t*)’: target specific option mismatch
 vld1q_u8 (const uint8_t * __a)

reduce tests on pullrequest

If a PR is created the tests run for commit and PR. It's possible to retrieve the repo the PR is send in from, so it's enough to run the test if it comes from the someone who did a fork for this, as we can be sure if it comes from this repo, the commits have been checked already.

Cannot cross-compile to IOS on Apple Silicon

Hi,
When I used the latest version to compile the static library of ios, the following error occurred.
Git Tag: 7ae29c9

-- Crypto++ auto fetched at: /Users/yangjun/jerome/paddle/cryptopp-cmake/build_ios/_deps/cryptopp
-- Using branch master for tests
=> Module : cryptopp
-- [cryptopp] CMake version 3.23.1
-- [cryptopp] System iOS
-- [cryptopp] Processor 
-- [cryptopp]     CMAKE_OSX_ARCHITECTURES : armv7;arm64
-- [cryptopp] CMAKE_HOST_SYSTEM_PROCESSOR : arm64
-- [cryptopp]      CMAKE_SYSTEM_PROCESSOR : 
CMake Error at cmake/TargetArch.cmake:73 (message):
  Invalid OS X arch name: armv7
Call Stack (most recent call first):
  cryptopp/CMakeLists.txt:182 (target_architecture)
  cryptopp/CMakeLists.txt:210 (check_target_architecture)


-- Configuring incomplete, errors occurred!
See also "/Users/yangjun/jerome/paddle/cryptopp-cmake/build_ios/CMakeFiles/CMakeOutput.log".
See also "/Users/yangjun/jerome/paddle/cryptopp-cmake/build_ios/CMakeFiles/CMakeError.log".
objc[12694]: Class AppleTypeCRetimerRestoreInfoHelper is implemented in both /usr/lib/libauthinstall.dylib (0x1e4f55eb0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10928c4f8). One of the two will be used. Which one is undefined.
objc[12694]: Class AppleTypeCRetimerFirmwareAggregateRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x1e4f55f00) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10928c548). One of the two will be used. Which one is undefined.
objc[12694]: Class AppleTypeCRetimerFirmwareRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x1e4f55f50) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10928c598). One of the two will be used. Which one is undefined.
objc[12694]: Class ATCRTRestoreInfoFTABFile is implemented in both /usr/lib/libauthinstall.dylib (0x1e4f55fa0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10928c5e8). One of the two will be used. Which one is undefined.
objc[12694]: Class AppleTypeCRetimerFirmwareCopier is implemented in both /usr/lib/libauthinstall.dylib (0x1e4f55ff0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10928c638). One of the two will be used. Which one is undefined.
objc[12694]: Class ATCRTRestoreInfoFTABSubfile is implemented in both /usr/lib/libauthinstall.dylib (0x1e4f56040) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x10928c688). One of the two will be used. Which one is undefined.
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project cryptopp-cmake.xcodeproj build -target ALL_BUILD -parallelizeTargets -configuration Release -hideShellScriptEnvironment

User defaults from command line:
    HideShellScriptEnvironment = YES
    IDEPackageSupportUseBuiltinSCM = YES

xcodebuild: error: 'cryptopp-cmake.xcodeproj' does not exist.

Compile command:

cmake .. -GXcode \
    -DCMAKE_SYSTEM_NAME=iOS \
    "-DCMAKE_OSX_ARCHITECTURES=armv7;arm64" \
    -DCMAKE_OSX_SYSROOT=iphoneos\
    -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 \
    -DCMAKE_INSTALL_PREFIX=`pwd`/_install \
    -DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO \
    -DCMAKE_IOS_INSTALL_COMBINED=YES \
    -DENABLE_BITCODE=NO \
    -DCMAKE_BUILD_TYPE=Release \
    -DCRYPTOPP_BUILD_TESTING=OFF \

cmake --build . --config Release

Rename options

For better grouping in chainbuilds the cryptopp-options should all be prefixed (around the half atm.). For sure there needs to be a mechanism to use the old names. Also we should use an author-warning if the old name was used to encourage the users to adjust the users to switch, so we can remove the combat-layer in x+2 or somewhen like that.

Problem with building for Android armv7-a

Hi everyone
I used 15798ac of cryptopp-cmake with cryptopp v8.7.0

-- [cryptopp] CMake version 3.22.1-g37088a8
-- [cryptopp] System Android
-- [cryptopp] Processor armv7-a
-- [cryptopp] CMAKE_HOST_SYSTEM_PROCESSOR : x86_64
-- [cryptopp]      CMAKE_SYSTEM_PROCESSOR : armv7-a
-- [cryptopp] Target architecture detected as: arm -> CRYPTOPP_ARM32
-- [cryptopp] Performing Test CRYPTOPP_ARM_NEON_HEADER
-- [cryptopp] Performing Test CRYPTOPP_ARM_NEON_HEADER - Success
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_NEON
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_NEON - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- [cryptopp] Platform: ARM-32
-- [cryptopp] NEON: TRUE
-- [cryptopp] Compiler definitions:  CRYPTOPP_DATA_DIR="<PATH>/cryptopp";CRYPTOPP_ARM_NEON_HEADER=1
-- [cryptopp] Compiler options: -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security    
-- [cryptopp] Build type: RelWithDebInfo

And after thousands of lines

  ld: error: undefined symbol: cryptogams_AES_set_encrypt_key
  >>> referenced by rijndael.cpp:351 (<PATH>/cryptopp/rijndael.cpp:351)
  >>>               rijndael.cpp.o:(CryptoPP::Rijndael::Base::UncheckedSetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_AES_set_decrypt_key
  >>> referenced by rijndael.cpp:355 (<PATH>/cryptopp/rijndael.cpp:355)
  >>>               rijndael.cpp.o:(CryptoPP::Rijndael::Base::UncheckedSetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_AES_encrypt_block
  >>> referenced by rijndael.cpp:359 (<PATH>/cryptopp/rijndael.cpp:359)
  >>>               rijndael.cpp.o:(CryptoPP::Rijndael::Enc::ProcessAndXorBlock(unsigned char const*, unsigned char const*, unsigned char*) const) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_sha1_block_data_order_neon
  >>> referenced by sha.cpp:352 (<PATH>/cryptopp/sha.cpp:352)
  >>>               sha.cpp.o:(CryptoPP::SHA1::HashMultipleBlocks(unsigned int const*, unsigned int)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_sha1_block_data_order
  >>> referenced by sha.cpp:359 (<PATH>/cryptopp/sha.cpp:359)
  >>>               sha.cpp.o:(CryptoPP::SHA1::HashMultipleBlocks(unsigned int const*, unsigned int)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_sha256_block_data_order_neon
  >>> referenced by sha.cpp:940 (<PATH>/cryptopp/sha.cpp:940)
  >>>               sha.cpp.o:(CryptoPP::SHA256::HashMultipleBlocks(unsigned int const*, unsigned int)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_sha256_block_data_order
  >>> referenced by sha.cpp:947 (<PATH>/cryptopp/sha.cpp:947)
  >>>               sha.cpp.o:(CryptoPP::SHA256::HashMultipleBlocks(unsigned int const*, unsigned int)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

Related to: 3a24749
and possible #38

CRYPTOGAMS_ARM_AES defined in config_asm.h:377 and not used any cmake based variable except CRYPTOPP_DISABLE_ARM_NEON but related to preprocessor __linux__ variable

move call to project

The call to project is atm. done way down after almost anything else. While docs encourage a call to it at the top after cmake_minimum_version, this would set all version-vars, enable the languages etc. and we could get rid of at least the half of the META* vars defined.

Why standard usage can not success include cryptopp?

I'm new beginner of C/C++, I am using Android Studio with new C++ Project, and follow what standard usage:

  1. I add cryptopp-cmake with git submode.
  2. then add_subdirectory(xxxx) to my CMakeLists.txt
  3. then I want use cryptopp in native-lib.cpp, which is the default file of the new created projecte. but include not works
image image

is there any other step needed? but I see the offical readme said just need add_subdirectory(xxxx) , but it seems not works. I hava try this for 8 hours, no more idea for thisπŸ˜‚

CMake configure step fails if cryptopp-cmake is not checked out with Git

In the root CMakeLists.txt file, Git is used to determine the branch of the cryptopp-cmake sources when they are added in a parent CMake project with add_subdirectory. This call fails, however, if the release package of cryptopp-cmake is used, since no .git directory is found (and the parent project is not versioned with .git, either). In addition, the cryptopp_GIT_BRANCH variable will then be empty.

Thus, CMake will abort with the following subsequent error:

1>fatal: not a git repository (or any of the parent directories): .git
1>CMake Error at thirdparty/source/cryptopp-cmake/CMakeLists.txt:222 (string):
1>  string sub-command STRIP requires two arguments.

For reference, Windows 10/CMake 3.26.4 and cryptopp-cmake v8.8.0 were used for testing.

Make prefix test run with standard main.cpp

As test/example-src/main.cpp is able to use prefixed and non-prefixed include-dir it should be able to drop unit/include-prefix/main.cpp and use just one source for all tests.

Library no longer compiles for armv7hf architecture

Since the latest release (8.7.0), the library no longers compiles with gcc for the armv7hf architecture. Release 8.6.0 using noloader/cryptopp-cmake was building fine.

Build environment (https://github.com/conan-io/conan-docker-tools/blob/master/legacy/gcc_8-armv7hf/Dockerfile):

  • Ubuntu 18.04 x86-64
  • gcc 8.4.0
  • CMake 3.24.0

I am building the library through Conan. It appears it tries to parse the .S assembly code as a regular C++ file and fails with the following error:

-- Using Conan toolchain:
/home/conan/.conan/data/cryptopp/8.7.0/_/_/build/fba732cea6d52eeb078f49c2acc280005e07bd51/build/generators/conan_toolchain.cmake
-- Conan toolchain: Setting CMAKE_POSITION_INDEPENDENT_CODE=ON
(options.fPIC)
-- Conan toolchain: C++ Standard 17 with extensions OFF
-- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF
-- The CXX compiler identification is GNU 8.4.0
-- The C compiler identification is GNU 8.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++-8 -
skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/arm-linux-gnueabihf-gcc-8 -
skipped
-- Detecting C compile features
-- Detecting C compile features - done
=> Module : cryptopp
-- Crypto++ from user-specified location at:
/home/conan/.conan/data/cryptopp/8.7.0/_/_/build/fba732cea6d52eeb078f49c2acc280005e07bd51/src
-- [cryptopp] CMake version 3.24.0
-- [cryptopp] System Linux
-- [cryptopp] Processor armv7hf
-- [cryptopp] Performing Test CRYPTOPP_ARM_NEON_HEADER
-- [cryptopp] Performing Test CRYPTOPP_ARM_NEON_HEADER - Success
-- [cryptopp] Performing Test CRYPTOPP_ARMV7A_NEON
-- [cryptopp] Performing Test CRYPTOPP_ARMV7A_NEON - Success
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- [cryptopp] Generating cmake package config files
-- [cryptopp] Generating pkgconfig files
-- [cryptopp] Platform: ARM-32
-- [cryptopp] NEON: TRUE
-- [cryptopp] Compiler definitions:
CRYPTOPP_DATA_DIR="/home/conan/.conan/data/cryptopp/8.7.0/_/_/build/fba732cea6d52eeb078f49c2acc280005e07bd51/src"
-- [cryptopp] Compiler options:
-- [cryptopp] Build type: Release
-- Configuring done
-- Generating done
CMake Warning:
   Manually-specified variables were not used by the project:
     CMAKE_POLICY_DEFAULT_CMP0091
-- Build files have been written to:
/home/conan/.conan/data/cryptopp/8.7.0/_/_/build/fba732cea6d52eeb078f49c2acc280005e07bd51/build/Release
cryptopp/8.7.0: CMake command: cmake --build
"/home/conan/.conan/data/cryptopp/8.7.0/_/_/build/fba732cea6d52eeb078f49c2acc280005e07bd51/build/Release"
'--' '-j4'
[  1%] Building CXX object
cryptopp/CMakeFiles/cryptopp.dir/home/conan/.conan/data/cryptopp/8.7.0/_/_/build/fba732cea6d52eeb078f49c2acc280005e07bd51/src/3way.cpp.o
[  1%] Building CXX object
cryptopp/CMakeFiles/cryptopp.dir/home/conan/.conan/data/cryptopp/8.7.0/_/_/build/fba732cea6d52eeb078f49c2acc280005e07bd51/src/integer.cpp.o
...
[ 97%] Building CXX object
cryptopp/CMakeFiles/cryptopp.dir/home/conan/.conan/data/cryptopp/8.7.0/_/_/build/fba732cea6d52eeb078f49c2acc280005e07bd51/src/zlib.cpp.o
[ 97%] Building CXX object
cryptopp/CMakeFiles/cryptopp.dir/home/conan/.conan/data/cryptopp/8.7.0/_/_/build/fba732cea6d52eeb078f49c2acc280005e07bd51/src/aes_armv4.S.o
/home/conan/.conan/data/cryptopp/8.7.0/_/_/build/fba732cea6d52eeb078f49c2acc280005e07bd51/src/aes_armv4.S:1:1:
error: stray β€˜@’ in program
  @ Copyright 2007-2018 The OpenSSL Project Authors. All Rights Reserved.
  ^
/home/conan/.conan/data/cryptopp/8.7.0/_/_/build/fba732cea6d52eeb078f49c2acc280005e07bd51/src/aes_armv4.S:2:1:
error: stray β€˜@’ in program
  @
  ^
/home/conan/.conan/data/cryptopp/8.7.0/_/_/build/fba732cea6d52eeb078f49c2acc280005e07bd51/src/aes_armv4.S:3:1:
error: stray β€˜@’ in program
  @ ====================================================================
  ^
...

Changes, suggestions, new features, and fixes scheduled for 8.8.0

Put a comment below if you want to add/remove/modify something...

Fixes

  • gcc-12 workaround (#3) with (#25)
  • The test case for find_package was not robust enough, failing randomly in CI. It is now much better, explicitly guiding CMake to use the static library and to find the package config exactly where we install it. (#27)
  • Fix the ARMv7 build when ASM is enabled (#30).
  • Fix target architecture detection (#38)
  • Fix check_compile_link_option should use CRYPTOPP_COMPILE_DEFINITIONS (#37)
  • Fix detection of home-brewed libomp (#39 and #49)
  • Fix: typo in sources.cmake resulted in failed source deduplication (#41)
  • Fix: fix platform detection to properly work with cygwin and mingw (#54)
  • Fix: set compiler env for the tests for better control of the environment (#53)
  • Fix: use repos via CPM in tests consistently (#65)

Crypto++

  • Sync the compiler settings with crypto++ for the supported architecture and compilers. Note that some architectures/compilers could not be tested (IBM, SUN) and may fail. Help is needed from people who use/have such compilers.

Enhancements

  • More robust handling of compiler caching with ccache. Change the installation method to pull the latest version of ccache with much better hit rate and more stability with MSVC. This significantly reduces the rebuild times, locally, and on GitHub CI. (PR #28)
  • Upgrade GitHub actions (#36)
  • Prefix test names for easier filtering (#55)
  • Extract release workflow into a separate file (#56)
  • Split Mac actions in the CI workflow (#58)
  • Split Ubuntu actions in the Ci workflow (#59)
  • Set build type to Debug when building inside a git repo and Release otherwise and limit choices in CMake GUI to these two types (#57)
  • Add msbuild and nmake variants to Windows CI workflow (#63)
  • Simplify and enhance Mac tests (#66)
  • Add tests for msys (#86)
  • Add tests for cygwin (#87)
  • Several enhancements to simplify options and streamline the used variables (#85, #84)

Special Thanks

@Vollstrecker

Problem with building for M1 with arm64

Hi everyone
I used 15798ac of cryptopp-cmake with cryptopp v8.7.0

=> Project : cryptopp v8.7.0 (91409cd8f6fc)
-- Crypto++ from user-specified location at: <PATH>/cryptopp
=> Module : cryptopp
-- [cryptopp] CMake version 3.25.2
-- [cryptopp] System Darwin
-- [cryptopp] Processor arm64
-- [cryptopp]     CMAKE_OSX_ARCHITECTURES : 
-- [cryptopp] CMAKE_HOST_SYSTEM_PROCESSOR : arm64
-- [cryptopp]      CMAKE_SYSTEM_PROCESSOR : arm64
-- [cryptopp] Target architecture detected as: arm64 -> CRYPTOPP_ARMV8
-- [cryptopp] Performing Test CRYPTOPP_ARM_NEON_HEADER
-- [cryptopp] Performing Test CRYPTOPP_ARM_NEON_HEADER - Success
-- [cryptopp] Performing Test CRYPTOPP_ARM_ACLE_HEADER
-- [cryptopp] Performing Test CRYPTOPP_ARM_ACLE_HEADER - Success
-- [cryptopp] Performing Test CRYPTOPP_ARM_SIMD
-- [cryptopp] Performing Test CRYPTOPP_ARM_SIMD - Success
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_CRC32
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_CRC32 - Failed
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_AES
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_AES - Success
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_PMULL
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_PMULL - Failed
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_SHA1
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_SHA1 - Success
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_SHA2
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_SHA2 - Success
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_SM3
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_SM3 - Failed
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_SHA3
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_SHA3 - Failed
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_SHA512
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_SHA512 - Failed
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- [cryptopp] Platform: ARMv8
-- [cryptopp] Compiler definitions:  CRYPTOPP_DATA_DIR="<PATH>/cryptopp";CRYPTOPP_ARM_NEON_HEADER=1;CRYPTOPP_ARM_ACLE_HEADER=1;CRYPTOPP_DISABLE_ARM_CRC32=1;CRYPTOPP_DISABLE_ARM_PMULL=1
-- [cryptopp] Compiler options:   
-- [cryptopp] Build type: Release

And after thousands of lines

  ld: error: undefined symbol: cryptogams_AES_set_encrypt_key
  >>> referenced by rijndael.cpp:351 (<PATH>/cryptopp/rijndael.cpp:351)
  >>>               rijndael.cpp.o:(CryptoPP::Rijndael::Base::UncheckedSetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_AES_set_decrypt_key
  >>> referenced by rijndael.cpp:355 (<PATH>/cryptopp/rijndael.cpp:355)
  >>>               rijndael.cpp.o:(CryptoPP::Rijndael::Base::UncheckedSetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_AES_encrypt_block
  >>> referenced by rijndael.cpp:359 (<PATH>/cryptopp/rijndael.cpp:359)
  >>>               rijndael.cpp.o:(CryptoPP::Rijndael::Enc::ProcessAndXorBlock(unsigned char const*, unsigned char const*, unsigned char*) const) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_sha1_block_data_order_neon
  >>> referenced by sha.cpp:352 (<PATH>/cryptopp/sha.cpp:352)
  >>>               sha.cpp.o:(CryptoPP::SHA1::HashMultipleBlocks(unsigned int const*, unsigned int)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_sha1_block_data_order
  >>> referenced by sha.cpp:359 (<PATH>/cryptopp/sha.cpp:359)
  >>>               sha.cpp.o:(CryptoPP::SHA1::HashMultipleBlocks(unsigned int const*, unsigned int)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_sha256_block_data_order_neon
  >>> referenced by sha.cpp:940 (<PATH>/cryptopp/sha.cpp:940)
  >>>               sha.cpp.o:(CryptoPP::SHA256::HashMultipleBlocks(unsigned int const*, unsigned int)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_sha256_block_data_order
  >>> referenced by sha.cpp:947 (<PATH>/cryptopp/sha.cpp:947)
  >>>               sha.cpp.o:(CryptoPP::SHA256::HashMultipleBlocks(unsigned int const*, unsigned int)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

Related to: #38
and possible 3a24749

CRYPTOGAMS_ARM_AES defined in config_asm.h:377 and not used any cmake based variable except CRYPTOPP_DISABLE_ARM_NEON
I am not so deep in ARM arch but seems like we need to include cryptopp_SOURCES_ASM for arm64 too

Also i think it can be related to compile for Android

Dev: enable ccache in dev environment for faster change-build-test cycles

Two changes can accelerate the change-build-test cycles:

  • Caching can be enabled using ccache for faster re-builds during development/testing. Caching is active only when a special cmake cache variable USE_CCACHE is defined. That variable should be automatically defined in CMakePresets.txt, which is targeting dev environments only. Caching is optional and should not fail if ccache is not installed.

  • Fetch the dependencies for test projects in a common location (the base test directory) to reduce the time and effort required to fetch crypto++ and cryptopp-cmake for tests.

cryptest.dat missing when cross-compiling?

Hey:
Trying to use this project to cross-compile for Android and test, but cryptest.dat seems to be missing when doing a cross-compile, and grep through the sources doesnt seem to reveal how that's constructed?

Doc: document the usage scenario with build->install->find_package()

Add a scenario to the README file documenting how the project can help people use crypto++ via the following steps:

  • clone cryptopp-cmake
  • build
  • install
  • in the consuming project
find_package(cryptopp REQUIRED)

# compile and link a test program using crypto++
add_executable(myapp main.cpp)
target_link_libraries(myapp cryptopp::cryptopp)

Documentation should include all the commands used at each step.

Build generates PIC even for static library

This is a remanent from the old cmake file.

For static lib build, and given that we do not use the same intermediary object files for shared and static, the archive library should be built without -fPIC.

Windows compile help

Hi ,
I added the following code to my CMakeList.txt according to the cryptopp/CMakeLists.txt in the repo, and reported the following error. And I did not set any macro definitions
How can this be solved?

cryptopp version : 8.7.0

added code:

set(cryptopp_SOURCES_ASM)

if(MSVC AND NOT DISABLE_ASM)
  if(${CMAKE_GENERATOR} MATCHES ".*ARM")
    message(
      STATUS
        "[cryptopp] Disabling ASM because ARM is specified as target platform.")
  else()
    enable_language(ASM_MASM)
    if(NOT DISABLE_RDRAND)
      list(APPEND cryptopp_SOURCES_ASM ${CRYPTOPP_PROJECT_DIR}/rdrand.asm)
      if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
        # workaround https://github.com/abdes/cryptopp-cmake/issues/13
        set_source_files_properties(${CRYPTOPP_PROJECT_DIR}/rdrand.asm
                                    PROPERTIES COMPILE_OPTIONS
                                               "/Fo\$(IntDir)rdrand.asm.obj")
      endif()
    endif()
    if(NOT DISABLE_RDSEED)
      list(APPEND cryptopp_SOURCES_ASM ${CRYPTOPP_PROJECT_DIR}/rdseed.asm)
    endif()
    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
      list(APPEND cryptopp_SOURCES_ASM ${CRYPTOPP_PROJECT_DIR}/x64dll.asm
           ${CRYPTOPP_PROJECT_DIR}/x64masm.asm)
      set_source_files_properties(${cryptopp_SOURCES_ASM}
                                  PROPERTIES COMPILE_DEFINITIONS "_M_X64")
    else()
      set_source_files_properties(
        ${cryptopp_SOURCES_ASM} PROPERTIES COMPILE_DEFINITIONS "_M_X86"
                                           COMPILE_FLAGS "/safeseh")
    endif()
    set_source_files_properties(${cryptopp_SOURCES_ASM} PROPERTIES LANGUAGE
                                                                   ASM_MASM)
  endif()
endif()

compile error:

Checking Build System
  Building Custom Rule D:/jerome/DocumentAI/DocumentAI/CMakeLists.txt
  Assembling D:\jerome\DocumentAI\ThirdParty\cryptopp\rdrand.asm...
D:\jerome\DocumentAI\ThirdParty\cryptopp\rdrand.asm(1): fatal error A1000: cannot open file : DocumentAI.dir\Release\/__/ThirdParty/cryptopp/rdrand.asm.obj [D:\jerome\DocumentAI\cmake-build-license\DocumentAI\DocumentAI.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\BuildCustomizations\masm.targets(70,5): error MSB3721: ε‘½δ»€β€œml64.exe /c /nologo /Zi /Fo"DocumentAI.dir\Release\/__/ThirdParty/cryptopp/rdrand.asm.obj" /D"WIN32" /D"_WINDOWS" /D"NDEBUG"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.