Created attachment 197832 [details] cryptopp 7.0.0 build log on 2018Q4 / FreeBSD 11.2 amd64 By default, the SIMD option is off, resulting in disabling certain features: c++ -O2 -pipe -fstack-protector -fno-strict-aliasing -std=c++11 -stdlib=libc++ -Wno-deprecated-declarations -fPIC -DNDEBUG -DCRYPTOPP_DISABLE_ASM -DCRYPTOPP_DISABLE_SSE2 -DCRYPTOPP_DISABLE_SSSE3 -DCRYPTOPP_DISABLE_SSE4 -pthread -pipe -c misc.cpp Thus, the `AlignedDeallocate` function does not get compiled. Trying to use the shared object with `-lcryptopp` results in the above linker error because `config.h` determines enabled features by the `CRYPTOPP_DISABLE_*` macros. In this case: #if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64) && !defined(CRYPTOPP_DISABLE_ASM) #define CRYPTOPP_BOOL_ALIGN16 1 #else #define CRYPTOPP_BOOL_ALIGN16 0 #endif So a program linking against libcryptopp will think that CRYPTOPP_BOOL_ALIGN16=1 while it was actually compiled (using default option) with CRYPTOPP_BOOL_ALIGN16=0, leading to the missing function. Not sure how to approach this. Maybe write the chosen `CRYPTOPP_DISABLE_*` into the installed `config.h`?!
If you are linking something against libcryptopp, I recommend you use pkgconf to set the correct definitions. If cryptopp was built with ASM disabled, the -DCRYPTOPP_DISABLE_ASM definition will be added to the cflags in the pkg-config file. So, whatever you are building needs to have this definintion set correctly. All of the ports that currently depend on cryptopp have been fixed (AFAIK) to use pkgconf to set the correct definitions, so if this a private project, use the output of: pkgconf --cflags-only-other libcryptopp and add that to your CFLAGS/CXXFLAGS. If cryptopp was built without ASM, the output should be -DCRYPTOPP_DISABLE_ASM. If it was built with ASM, the output should be empty.
That makes sense, thank you! Here's what I did for a CMake project, in case it's helpful for someone else: # Try pkg-config in case cryptopp>=7.0.0 port is available pkg_check_modules(CRYPTOPP libcryptopp) if (CRYPTOPP_FOUND) # Apply to all targets (may not be what you want, was fine in my case) add_definitions(${CRYPTOPP_CFLAGS}) else() # Fall back to our previous solution (not included with CMake!) find_package(CryptoPP REQUIRED) set(CRYPTOPP_LIBRARIES ${CRYPTOPP_LIBRARY_RELEASE}) endif() # ...link to ${CRYPTOPP_LIBRARIES} in targets...