Compilation Error When Building OpenSSL for iOS on macOS: 'inttypes.h' File Not Found

508 views Asked by At

I am currently in the process of compiling OpenSSL for iOS on my macOS system and have encountered a roadblock that I am hoping to get some assistance with. Here’s a step-by-step breakdown of what I’ve done so far and the issue that I am facing. 1: Cloning the OpenSSL Repository: I started by cloning the OpenSSL repository from GitHub using the following command in the terminal:

git clone https://github.com/openssl/openssl.git

2: Setting Environment Variables: Next, I set up the necessary environment variables for the cross-compilation process. Here are the commands I used:

export CROSS_TOP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/
export CROSS_SDK=iPhoneOS11.3.sdk
export CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64"

3: Configuring OpenSSL: After setting the environment variables, I ran the configure script for OpenSSL:

./Configure iphoneos-cross

4: Running Make: Finally, I attempted to build the project using the make command. Unfortunately, this is where I encountered the following error:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found
#include_next <inttypes.h>

What baffles me is that when I navigate to the include directory and list the contents using ls, I can clearly see that the inttypes.h file is present:

@Davids-MacBook-Pro include % ls
... (other files) ...
inttypes.h
... (other files) ...

Has anyone encountered a similar issue, or does anyone have insights on what might be going wrong here? I am using Xcode version 15.0 and my macOS version is 12.3. Any help or guidance would be greatly appreciated as I am currently at a standstill with this issue.

I have double-checked the paths and ensured that the environment variables are set correctly. Yet, the error persists. also i tried to run

xcode-select --install

my chip is Apple M1 Pro, macOS 14.0 (23A344), Xcode 15.0.1

i followed https://docs.pjsip.org/en/latest/get-started/ios/build_instructions.html#tls-openssl-support

Thank you in advance!

1

There are 1 answers

0
XiaoyunXi On

I encountered the same issue as you. I solved it by following the instructions on openssl official guide. Here is the full link: https://wiki.openssl.org/index.php/Compilation_and_Installation#64-bit

I hope this will help you.

Regards, Xiaoyun