Segfault on iOS Simulator (x86_64)

Skip to first unread message

Cameron G

Sep 21, 2022, 3:41:53 AM9/21/22
to Crypto++ Users
Hi, I'm receiving a segfault on iOS Simulator (x86_64) in some trivial code that works on other platforms. I think I may have built the library incorrectly, but I followed the wiki instructions and tried various combinations. The segfault happens when declaring

CryptoPP::AutoSeededRandomPool rng;

The stack frame is
Screen Shot 2022-09-21 at 3.29.55 PM.png

Here's how I built the library:

IOS_SDK=iPhoneSimulator IOS_CPU=x86_64 source ./
Configuring for iPhoneSimulator (x86_64)
XCODE_TOOLCHAIN: /Applications/
IOS_SDK: iPhoneSimulator
IOS_CPU: x86_64
IOS_CFLAGS: -arch x86_64 -miphonesimulator-version-min=6 -fno-common
IOS_CXXFLAGS: -arch x86_64 -miphonesimulator-version-min=6 -stdlib=libc++ -fno-common
IOS_SYSROOT: /Applications/

It looks the the environment is set correctly. Your next step is build
the library with 'make -f GNUmakefile-cross'.

Then, I ran 'make -f GNUmakefile-cross' :
Here's what we found... IS_X86: 0, IS_X64: 1, IS_ARM32: 0, IS_ARMV8: 0
Using testing flags: -g2 -O3 -fPIC -arch x86_64 -miphonesimulator-version-min=6 -stdlib=libc++ -fno-common --sysroot /Applications/

clang++ -DCRYPTOPP_DISABLE_ASM -isysroot /Applications/ -Wall -g2 -O3 -fPIC -arch x86_64 -miphonesimulator-version-min=6 -stdlib=libc++ -fno-common --sysroot /Applications/ -Wall -c cryptlib.cpp

Most of the simulators use x86_64 now - especially iPhone ones, so that's why I'm compiling for that architecture.

Thanks for any help!

Cameron G

Sep 24, 2022, 6:12:50 AM9/24/22
to Crypto++ Users

Jeffrey Walton

Sep 24, 2022, 2:08:53 PM9/24/22
to Crypto++ Users List
The library was built with IOS_CPPFLAGS: -DCRYPTOPP_DISABLE_ASM. You have to add the flag to your project's settings, too.

The other settings, like IOS_CXXFLAGS and IOS_LDFLAGS, should already be present in your project since they are [mostly?] Xcode default. But -DCRYPTOPP_DISABLE_ASM is not a default - you have to add it manually.

Reply all
Reply to author
0 new messages