Hello people, I am trying to install and use CryptoPP library in my Macbook Air M1. I did all the make, install step. When I tried to execute a sample program, I get an error as Undefined symbols for architecture arm64: I give the details below.
LCG.cpp // sample.cpp : Defines the entry point for the console application. // #include "StdAfx.h" // Runtime Library Includes #include <string> #include <iostream> #include <iomanip> // Crypto++ Include #include <cryptopp/osrng.h>// PRNG int main(int argc, char* argv[]) { // Scratch Area // Use as seed to the LCG const unsigned int BLOCKSIZE = 16 * 8; byte pcbScratch[ BLOCKSIZE ]; std::cout << "Seed:" << BLOCKSIZE << std::endl << std::endl; // 1st LCG CryptoPP::LC_RNG lcg1( BLOCKSIZE /*32 bit word */); lcg1.GenerateBlock( pcbScratch, BLOCKSIZE ); // Output std::cout << "The 1st LCG produced:" << std::endl; for( unsigned int i = 0; i < BLOCKSIZE; i++ ) { std::cout << "0x" << std::setbase(16) << std::setw(2) << std::setfill('0'); std::cout << static_cast<unsigned int>( pcbScratch[ i ] ) << " "; } std::cout << std::endl; // @nd LCG CryptoPP::LC_RNG lcg2( BLOCKSIZE /*32 bit word */); lcg2.GenerateBlock( pcbScratch, BLOCKSIZE ); // Output std::cout << "The 2nd LCG produced:" << std::endl; for( unsigned int i = 0; i < BLOCKSIZE; i++ ) { std::cout << "0x" << std::setbase(16) << std::setw(2) << std::setfill('0'); std::cout << static_cast<unsigned int>( pcbScratch[ i ] ) << " "; } std::cout << std::endl; return 0; } g++ LCG.cpp LCG.cpp:20:5: error: unknown type name 'byte'; did you mean 'CryptoPP::byte'? byte pcbScratch[ BLOCKSIZE ]; ^~~~ CryptoPP::byte /usr/local/include/cryptopp/config_int.h:56:23: note: 'CryptoPP::byte' declared here typedef unsigned char byte; ^ 1 error generated. when I add CryptoPP::byte, i get, g++ LCG.cpp Undefined symbols for architecture arm64: "CryptoPP::LC_RNG::GenerateBlock(unsigned char*, unsigned long)", referenced from: _main in LCG-9973ee.o "CryptoPP::Algorithm::Algorithm(bool)", referenced from: CryptoPP::RandomNumberGenerator::RandomNumberGenerator() in LCG-9973ee.o "vtable for CryptoPP::RandomNumberGenerator", referenced from: CryptoPP::RandomNumberGenerator::RandomNumberGenerator() in LCG-9973ee.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for CryptoPP::LC_RNG", referenced from: CryptoPP::LC_RNG::LC_RNG(unsigned int) in LCG-9973ee.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) arivarasan@Arivarasan Sample % g++ LCG.cpp LCG.cpp:12:10: fatal error: 'cryptopp/*.h' file not found #include <cryptopp/*.h>// PRNG ^~~~~~~~~~~~~~ 1 error generated. g++ LCG.cpp -v Apple clang version 13.1.6 (clang-1316.0.21.2.5) Target: arm64-apple-darwin21.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple arm64-apple-macosx12.0.0 -Wundef-prefix=TARGET_OS_ -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -main-file-name LCG.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -fno-strict-return -fno-rounding-math -munwind-tables -target-sdk-version=12.3 -fvisibility-inlines-hidden-static-local-var -target-cpu apple-m1 -target-feature +v8.5a -target-feature +fp-armv8 -target-feature +neon -target-feature +crc -target-feature +crypto -target-feature +dotprod -target-feature +fp16fml -target-feature +ras -target-feature +lse -target-feature +rdm -target-feature +rcpc -target-feature +zcm -target-feature +zcz -target-feature +fullfp16 -target-feature +sm4 -target-feature +sha3 -target-feature +sha2 -target-feature +aes -target-abi darwinpcs -fallow-half-arguments-and-returns -debugger-tuning=lldb -target-linker-version 763 -v -resource-dir /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -stdlib=libc++ -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Library/Developer/CommandLineTools/usr/include -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -Wno-reserved-identifier -Wno-gnu-folding-constant -Wno-objc-load-method -fdeprecated-macro -fdebug-compilation-dir=/Users/arivarasan/Sample -ferror-limit 19 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fno-cxx-modules -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcommon -fcolor-diagnostics -clang-vendor-feature=+messageToSelfInClassMethodIdReturnType -clang-vendor-feature=+disableInferNewAvailabilityFromInit -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -clang-vendor-feature=+enableAggressiveVLAFolding -clang-vendor-feature=+revert09abecef7bbf -clang-vendor-feature=+thisNoAlignAttr -clang-vendor-feature=+thisNoNullAttr -mllvm -disable-aligned-alloc-awareness=1 -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /var/folders/2f/5wlt_kpd3x1b6k4s0y67s6540000gn/T/LCG-737774.o -x c++ LCG.cpp clang -cc1 version 13.1.6 (clang-1316.0.21.2.5) default target arm64-apple-darwin21.6.0 ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include" ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks" #include "..." search starts here: #include <...> search starts here: /usr/local/include /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1 /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include /Library/Developer/CommandLineTools/usr/include /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory) End of search list. "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch arm64 -platform_version macos 12.0.0 12.3 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -o a.out -L/usr/local/lib /var/folders/2f/5wlt_kpd3x1b6k4s0y67s6540000gn/T/LCG-737774.o -lc++ -lSystem /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/lib/darwin/libclang_rt.osx.a Undefined symbols for architecture arm64: "CryptoPP::LC_RNG::GenerateBlock(unsigned char*, unsigned long)", referenced from: _main in LCG-737774.o "CryptoPP::Algorithm::Algorithm(bool)", referenced from: CryptoPP::RandomNumberGenerator::RandomNumberGenerator() in LCG-737774.o "vtable for CryptoPP::RandomNumberGenerator", referenced from: CryptoPP::RandomNumberGenerator::RandomNumberGenerator() in LCG-737774.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for CryptoPP::LC_RNG", referenced from: CryptoPP::LC_RNG::LC_RNG(unsigned int) in LCG-737774.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) What should I do? Actually I want to measure the time for ECC point arithmetics for my project. How can I do it for my Macbook Air with M1 chip? -- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/cryptopp-users/038ac3a9-e9ee-401f-932d-b766e8e468a3n%40googlegroups.com.