You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: IDE/apple-universal/README.md
+42-3Lines changed: 42 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This example shows how to build a wolfSSL static library for Apple targets on al
4
4
The example was created using Xcode version 14.3.1.
5
5
6
6
# Why?
7
-
Configuring and building wolfSSL through the `configure` interface can be simpler and more user friendly than manually adding the wolfSSL source files to your project and customizing through `user_settings.h`. Building via `configure` also streamlines integration with other open-source projects that expect an installation directory, such as `cURL`'s `--with-wolfssl` option. Finally, some developer teams might prefer to build wolfSSL once with the desired settings and then distribute it as a library framework for app developers to use. Packaging wolfSSL as a framework makes it highly portable and allows for drag-and-drop integration into Xcode projects without needing to worry about compiling the library every time they build their app.
7
+
Configuring and building wolfSSL through the `configure` interface can be simpler and more user friendly than manually adding the wolfSSL source files to your project and customizing through `user_settings.h`. Building via `configure` also streamlines integration with other open-source projects that expect an installation directory, such as `curl`'s `--with-wolfssl` option. Finally, some developer teams might prefer to build wolfSSL once with the desired settings and then distribute it as a library framework for app developers to use. Packaging wolfSSL as a framework makes it highly portable and allows for drag-and-drop integration into Xcode projects without needing to worry about compiling the library every time they build their app.
8
8
9
9
However, if you do want to compile wolfSSL from source manually in your Xcode project using `user_settings.h`, see the example in [IDE/XCODE](https://github.com/wolfSSL/wolfssl/tree/master/IDE/XCODE).
10
10
@@ -16,7 +16,7 @@ This example consists of a build script and an Xcode example project. The build
16
16
17
17
To use the build script, you can run it without arguments to build a default configuration, or you can use the `-c` option to pass in a quoted string containing any additional flags to `configure` that you need. Note that `--enable-static --disable-shared` is always passed to `configure` by default. Consider the following usage example, with descriptions in the comments:
18
18
19
-
```
19
+
```sh
20
20
# default configuration
21
21
./build-wolfssl-framework.sh
22
22
@@ -60,7 +60,7 @@ If you are developing on a macOS machine and want to compile wolfSSL to run on m
60
60
61
61
The generic `configure` invocation required to cross compile a static library for an Apple device is as follows:
62
62
63
-
```
63
+
```sh
64
64
./configure --disable-shared --enable-static \
65
65
--prefix=${INSTALL_DIR} \
66
66
--host=${HOST} \
@@ -89,4 +89,43 @@ Low-level programming in the Apple ecosystem is sparsely documented, and certain
89
89
90
90
2. Cross compiling for the **iOS simulator** with a min version specifier present (`-miphoneos-version-min`) requires the `-target ${ARCH}-apple-ios-simulator` compiler flag in order to build . It is unclear why this is required, as The GNU documentation claims that the `target` option is only required if cross-compiling a compiler to run on architecture X but emit code for architecture Y (known as a canadian cross-compilation scenario). Regardless, if you do not include a `-target` option, the build will generate a large number of warnings when linking against system libraries with messages like: `ld: warning: building for iOS, but linking in .tbd file (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk/usr/lib/libnetwork.tbd) built for iOS Simulator`. It was thought that perhaps the host option should instead be `--host=${ARCH}-apple-ios-simulator` but this is not a valid option, and `configure` will fail with a different error: `checking host system type... Invalid configuration 'arm64-apple-ios-simulator': Kernel 'ios' not known to work with OS 'simulator`. If you do not specify a min iOS version, this is not required. Mysteriously, the other simulators (tvOS, watchOS) do not have this issue....
91
91
92
+
## Building wolfSSL and curl
93
+
94
+
Building curl with wolfSSL for Apple targets using configure/autotools can be accomplished with the following procedure:
95
+
96
+
1. Build wolfSSL as described in the above steps with curl compatibility enabled, either as a framework using the helper script, or as a cross-compiled library for your desired platform
97
+
98
+
```sh
99
+
cd /path/to/wolfssl/IDE/apple-universal
100
+
101
+
# build wolfSSL as a framework using the helper script
102
+
./build-wolfssl-framework.sh -c "--enable-curl"
103
+
104
+
# or build as a static library for one platform (using iOS as an example)
2. Configure and build curl to use the wolfSSL library for your platform that was built in step 1. Note that you must use `--with-wolfssl` to point curl to the wolfSSL *library install* for your specific platform, not to the xcframework.
117
+
118
+
```sh
119
+
cd /path/to/curl
120
+
121
+
# Note that it is necessary to manually link curl against the Apple CoreFoundation and Security frameworks,
122
+
# as they are required by wolfSSL on Apple platforms. Using iOS as an example:
0 commit comments