Skip to content

Conversation

@jnavarrom
Copy link
Contributor

Allow to build cryptopp for macOS Catalyst, macOS Catalyst requires a specific target architecture.

Examples building for x86_64 and arm64 outputs

Using positional arg, MACOS_CPU=x86_64
Using positional arg, MACOS_CATALYST=1
Configuring for MacOSX (x86_64)
XCODE_TOOLCHAIN: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/
MACOS_SDK: MacOSX
MACOS_CPU: x86_64
MACOS_CFLAGS: -arch x86_64  -fno-common
MACOS_CXXFLAGS: -arch x86_64 -target x86_64-apple-ios15.0-macabi   -fno-common
MACOS_SYSROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk
MACOS_CATALYST: 1

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

Using testing flags: -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -g2 -O3 -fPIC -arch x86_64 -target x86_64-apple-ios15.0-macabi -fno-common
...
Using positional arg, MACOS_CPU=arm64
Using positional arg, MACOS_CATALYST=1
Configuring for MacOSX (arm64)
XCODE_TOOLCHAIN: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/
MACOS_SDK: MacOSX
MACOS_CPU: arm64
MACOS_CFLAGS: -arch arm64  -fno-common
MACOS_CXXFLAGS: -arch arm64 -target arm64-apple-ios15.0-macabi   -fno-common
MACOS_SYSROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk
MACOS_CATALYST: 1

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

Using testing flags: -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -g2 -O3 -fPIC -arch arm64 -target arm64-apple-ios15.0-macabi -fno-common
...

@noloader
Copy link
Collaborator

@jnavarrom
Copy link
Contributor Author

Hi @noloader, thanks for checking this.

Yes, I took a look at this file.

I can compile cryptopp for MacOS using setenv-macos.sh, but I can't build cryptopp for Catalyst using setenv-macos.sh as it currently is. This is the main reason of this pull request: add support for building crytopp for macOS Catalyst.

If I build cryptopp for macOS, without adding Catalyst support, and I want to build an app (that uses cryptopp) for Catalyst target, I won't be able to do it. Following error will happen:

libcryptopp.xcframework:1:1 While building for Mac Catalyst, no library for this platform was found in libcryptopp.xcframework

This is how the libcryptopp.xcframework looks like:

Screenshot 2023-10-11 at 12 26 14

If I build cryptopp for Catalyst target, I will be able to run the app in Catalyst:

Screenshot 2023-10-11 at 12 26 36 Screenshot 2023-10-11 at 12 31 11

@noloader
Copy link
Collaborator

@jnavarrom,

Thanks.

I don't know anything about Catalyst. And I don't have any modern Apple machines for Xcode testing.

So how about creating a setenv-catalyst.sh? Start with setenv-macos.sh, and assume the Catalyst gear so you can do away with the extra env var.

If there are problems using it, I will point folks to you.

@jnavarrom
Copy link
Contributor Author

@noloader thanks

So how about creating a setenv-catalyst.sh?

Sure, I will create it. Thanks

# If your Autotools project results in "configure:6560: error: C preprocessor
# cpp fails sanity check", then file a bug report with Autotools.
#
# See http://www.cryptopp.com/wiki/MacOS_(Command_Line) for more details
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this one doesn't exist

@jnavarrom
Copy link
Contributor Author

setenv-catalyst.sh created.

@jnavarrom
Copy link
Contributor Author

Hi @noloader .

Would you mind to take a look at this pull request?

I just created the setenv-catalyst.sh based on setenv-mac.sh.

Let me know if I need to update something.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants