Skip to content

Commit 9159476

Browse files
committed
fix: iOS build to work with the updated setup
1 parent 27ecf09 commit 9159476

File tree

5 files changed

+80
-68
lines changed

5 files changed

+80
-68
lines changed

examples/rn-app/ios/Podfile.lock

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ PODS:
99
- hermes-engine/Pre-built (= 0.81.0)
1010
- hermes-engine/Pre-built (0.81.0)
1111
- LicensePlist (3.27.1)
12-
- NitroModules (0.29.2):
12+
- NitroModules (0.29.6):
1313
- boost
1414
- DoubleConversion
1515
- fast_float
@@ -1780,7 +1780,7 @@ PODS:
17801780
- React-RCTFBReactNativeSpec
17811781
- ReactCommon/turbomodule/core
17821782
- SocketRocket
1783-
- react-native-safe-area-context (5.5.2):
1783+
- react-native-safe-area-context (5.6.1):
17841784
- boost
17851785
- DoubleConversion
17861786
- fast_float
@@ -1798,8 +1798,8 @@ PODS:
17981798
- React-graphics
17991799
- React-ImageManager
18001800
- React-jsi
1801-
- react-native-safe-area-context/common (= 5.5.2)
1802-
- react-native-safe-area-context/fabric (= 5.5.2)
1801+
- react-native-safe-area-context/common (= 5.6.1)
1802+
- react-native-safe-area-context/fabric (= 5.6.1)
18031803
- React-NativeModulesApple
18041804
- React-RCTFabric
18051805
- React-renderercss
@@ -1810,7 +1810,7 @@ PODS:
18101810
- ReactCommon/turbomodule/core
18111811
- SocketRocket
18121812
- Yoga
1813-
- react-native-safe-area-context/common (5.5.2):
1813+
- react-native-safe-area-context/common (5.6.1):
18141814
- boost
18151815
- DoubleConversion
18161816
- fast_float
@@ -1838,7 +1838,7 @@ PODS:
18381838
- ReactCommon/turbomodule/core
18391839
- SocketRocket
18401840
- Yoga
1841-
- react-native-safe-area-context/fabric (5.5.2):
1841+
- react-native-safe-area-context/fabric (5.6.1):
18421842
- boost
18431843
- DoubleConversion
18441844
- fast_float
@@ -1867,7 +1867,7 @@ PODS:
18671867
- ReactCommon/turbomodule/core
18681868
- SocketRocket
18691869
- Yoga
1870-
- react-native-skia (2.1.1):
1870+
- react-native-skia (2.2.19):
18711871
- boost
18721872
- DoubleConversion
18731873
- fast_float
@@ -1954,7 +1954,7 @@ PODS:
19541954
- ReactCommon/turbomodule/core
19551955
- SocketRocket
19561956
- Yoga
1957-
- react-native-vector-icons-material-design-icons (12.2.0)
1957+
- react-native-vector-icons-material-design-icons (12.3.0)
19581958
- React-NativeModulesApple (0.81.0):
19591959
- boost
19601960
- DoubleConversion
@@ -2459,7 +2459,7 @@ PODS:
24592459
- React-perflogger (= 0.81.0)
24602460
- React-utils (= 0.81.0)
24612461
- SocketRocket
2462-
- ReactNativeLegal (1.5.2):
2462+
- ReactNativeLegal (1.6.0):
24632463
- boost
24642464
- DoubleConversion
24652465
- fast_float
@@ -2670,9 +2670,9 @@ PODS:
26702670
- ReactCommon/turbomodule/core
26712671
- SocketRocket
26722672
- Yoga
2673-
- RNDeviceInfo (14.0.4):
2673+
- RNDeviceInfo (14.1.1):
26742674
- React-Core
2675-
- RNScreens (4.13.1):
2675+
- RNScreens (4.16.0):
26762676
- boost
26772677
- DoubleConversion
26782678
- fast_float
@@ -2699,10 +2699,10 @@ PODS:
26992699
- ReactCodegen
27002700
- ReactCommon/turbomodule/bridging
27012701
- ReactCommon/turbomodule/core
2702-
- RNScreens/common (= 4.13.1)
2702+
- RNScreens/common (= 4.16.0)
27032703
- SocketRocket
27042704
- Yoga
2705-
- RNScreens/common (4.13.1):
2705+
- RNScreens/common (4.16.0):
27062706
- boost
27072707
- DoubleConversion
27082708
- fast_float
@@ -3007,7 +3007,7 @@ SPEC CHECKSUMS:
30073007
glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
30083008
hermes-engine: e7491a2038f2618c8cd444ed411a6deb350a3742
30093009
LicensePlist: 5a4ff2e9e038a1203cc058b6335d2eebd3313491
3010-
NitroModules: 33aca4acd8fd5c2a29dc99976680cd99e7263573
3010+
NitroModules: 7d693306799405ca141ef5c24efc0936f20a09c0
30113011
NitroOttreliteConsumerLib: 2f1860e73bdf3f1aaa185241406a095e8291d811
30123012
RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669
30133013
RCTDeprecation: 0735ab4f6b3ec93a7f98187b5da74d7916e2cf4c
@@ -3042,10 +3042,10 @@ SPEC CHECKSUMS:
30423042
React-logger: 04ce9229cb57db2c2a8164eaec1105f89da7fb22
30433043
React-Mapbuffer: e402e7a0535b2213c50727553621480fe8cd8ade
30443044
React-microtasksnativemodule: a63ce5595016996a9bac1f10c70a7a7fe6506649
3045-
react-native-safe-area-context: 84a754cad3fbb25117482cde6b8defca6c6f6a53
3046-
react-native-skia: a3f5566cde7cad24c97b88739786b238c531b6db
3045+
react-native-safe-area-context: c6e2edd1c1da07bdce287fa9d9e60c5f7b514616
3046+
react-native-skia: 0284cd0e07444cde3b8dd11463da7effcfe4b587
30473047
react-native-slider: 663776e5683e257de8df8091abc2d93ff6ec67db
3048-
react-native-vector-icons-material-design-icons: e406b4fc1787999a5d150c897837150543e90b9c
3048+
react-native-vector-icons-material-design-icons: c502df5b988ce85d6c7d2b7ee909818315760b82
30493049
React-NativeModulesApple: b3766e1f87b08064ebc459b9e1538da2447ca874
30503050
React-oscompat: 34f3d3c06cadcbc470bc4509c717fb9b919eaa8b
30513051
React-perflogger: a1edb025fd5d44f61bf09307e248f7608d7b2dcf
@@ -3076,13 +3076,13 @@ SPEC CHECKSUMS:
30763076
ReactAppDependencyProvider: c91900fa724baee992f01c05eeb4c9e01a807f78
30773077
ReactCodegen: 8125d6ee06ea06f48f156cbddec5c2ca576d62e6
30783078
ReactCommon: 116d6ee71679243698620d8cd9a9042541e44aa6
3079-
ReactNativeLegal: 245741f8e5c1074632334ed3855f046366482a5a
3079+
ReactNativeLegal: e51f65c65dd6375d1c5f1a4615838ae86aea794f
30803080
ReactNativeOttrelite: 8a38e46c9492df1473f5e1d853fd56e1ad239bfe
30813081
ReactNativeOttreliteBackendPlatform: fba8c4dbea090d01d6e24cb39c239effae52fff5
30823082
ReactNativeOttreliteBackendTracy: b7bb5b016abd2ea9a0c442d9c3d6996fa4fd4a17
30833083
ReactNativeOttreliteInteropOTEL: 12ffbcfa0ba04ad891efda1c7efacab537c114fd
3084-
RNDeviceInfo: d863506092aef7e7af3a1c350c913d867d795047
3085-
RNScreens: 40264381e0eca3f0c368c78f192f547ef40caa39
3084+
RNDeviceInfo: bcce8752b5043a623fe3c26789679b473f705d3c
3085+
RNScreens: 0bbf16c074ae6bb1058a7bf2d1ae017f4306797c
30863086
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
30873087
Yoga: b01392348aeea02064c21a2762a42893d82b60a7
30883088

packages/interop-otel/ReactNativeOttreliteInteropOTEL.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Pod::Spec.new do |s|
7878
# patch the umbrella header to fix Swift compilation - remove unnecessary headers, from which protobuf causes Swift errors
7979
UMBRELLA_HEADER_PATH="${PODS_ROOT}/Headers/Public/ReactNativeOttreliteInteropOTEL/ReactNativeOttreliteInteropOTEL-umbrella.h"
8080
if [ -f "$UMBRELLA_HEADER_PATH" ]; then
81-
# replace all non-relative imports with commented-out lines
81+
# comment out all files that should not be exposed to Swift compiler as they would break compilation
8282
sed -E '/^#import "(OttreliteInteropOTEL.hpp|SpanConverter.hpp|InstrumentationScopeStore.hpp|nlohmann|google|opentelemetry|curl|openssl|brotli|zconf|zlib)[^"]*"/ s@^#import @// #import @' "$UMBRELLA_HEADER_PATH" > new_umbrella.h
8383
mv new_umbrella.h "$UMBRELLA_HEADER_PATH"
8484

packages/interop-otel/android/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ tasks.register("buildAndInstallZlib") {
399399
"-DZLIB_BUILD_STATIC=ON",
400400
"-DZLIB_BUILD_MINIZIP=OFF",
401401
"-DZLIB_INSTALL=ON",
402+
"-DZLIB_BUILD_EXAMPLES=OFF",
402403
"-DCMAKE_INSTALL_PREFIX=${cmakeInstallDir}"
403404
}
404405

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
protoc
22
brotli
33
curl
4-
third_party
4+
ios-cmake
55
opentelemetry-cpp
66
openssl-apple
77
openssl_for_android
88
openssl
9-
protobuf
9+
third_party
1010
zlib

packages/interop-otel/third_party/buildIOS.sh

Lines changed: 56 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set +e
1+
set -e
22

33
# validate number of arguments
44
if [ "$#" -ne 3 ]; then
@@ -44,11 +44,18 @@ fi
4444

4545
THIS_BUILD_INFO="$CMAKE_IOS_PLATFORM"
4646

47+
# === ios-cmake ===
48+
49+
if [ ! -d "ios-cmake" ]; then
50+
echo "⏳ Cloning ios-cmake..."
51+
git clone --depth 1 --branch 4.5.0 https://github.com/leetal/ios-cmake.git
52+
fi
53+
4754
# === OpenSSL ===
4855

4956
if [ ! -d openssl-apple ]; then
5057
echo "⏳ Cloning openssl-apple..."
51-
git clone --branch 3.5.200 https://github.com/passepartoutvpn/openssl-apple.git
58+
git clone --depth 1 --branch 3.5.200 https://github.com/passepartoutvpn/openssl-apple.git
5259
fi
5360

5461
if [ "$PLATFORM" = "iphonesimulator" ]; then
@@ -80,13 +87,38 @@ echo "ℹ️ OpenSSL prepared in ${first_openssl_sdk_dir}"
8087

8188
OPENSSL_ROOT_DIR=$(realpath ${first_openssl_sdk_dir})
8289

83-
# === OTEL wrapper ===
90+
# === OpenTelemetry C++ SDK ===
8491

8592
if [ ! -d "opentelemetry-cpp" ]; then
8693
echo "⏳ Cloning opentelemetry-cpp..."
8794
git clone --depth 1 --branch v1.23.0 https://github.com/open-telemetry/opentelemetry-cpp.git
8895
fi
8996

97+
# === Brotli ===
98+
99+
if [ ! -d "brotli" ]; then
100+
echo "⏳ Cloning Brotli..."
101+
git clone --depth 1 --branch v1.1.0 https://github.com/google/brotli.git
102+
fi
103+
104+
# === Zlib ===
105+
106+
if [ ! -d "zlib" ]; then
107+
echo "⏳ Cloning Zlib..."
108+
git clone --depth 1 --branch v1.3.1 https://github.com/madler/zlib.git
109+
fi
110+
111+
# === Curl ===
112+
113+
if [ ! -d "curl" ]; then
114+
echo "⏳ Cloning curl..."
115+
git clone --depth 1 --branch curl-8_15_0 https://github.com/curl/curl.git
116+
fi
117+
118+
### ========== End of dependency cloning section ==========
119+
120+
# === Wrapper build ===
121+
90122
echo "⏳ Preparing opentelemetry-cpp wrapper for iOS with CMake..."
91123

92124
mkdir -p "wrapper/ios/${BUILD_TYPE}"
@@ -100,28 +132,11 @@ cp -R ${OPENSSL_ROOT_DIR}/* install/
100132

101133
# === Brotli ===
102134

103-
if [ ! -d "brotli" ]; then
104-
echo "⏳ Cloning Brotli..."
105-
git clone --branch v1.1.0 https://github.com/google/brotli.git
106-
fi
107-
108-
cd brotli
109-
110135
echo "⏳ Building Brotli for iOS..."
111136

112137
mkdir -p brotli
113138
cd brotli
114139

115-
# === ios-cmake ===
116-
117-
if [ ! -d "ios-cmake" ]; then
118-
echo "⏳ Cloning ios-cmake..."
119-
git clone --branch v4.5.0 https://github.com/leetal/ios-cmake.git
120-
cd ios-cmake
121-
git checkout 6fa909e133b92343db2d099e0478448c05ffec1a
122-
cd ..
123-
fi
124-
125140
# check if lastBuildInfo.txt has the current CMAKE_IOS_PLATFORM
126141
BUILD_BROTLI=$CMAKE_FORCE_REBUILD
127142
if [ -f lastBuildInfo.txt ]; then
@@ -143,10 +158,14 @@ if [ "$BUILD_BROTLI" -eq 1 ]; then
143158
-DCMAKE_SYSTEM_NAME="iOS" \
144159
-DBUILD_SHARED_LIBS=OFF \
145160
-DCMAKE_INSTALL_PREFIX="$(realpath ../install)" \
146-
-DCMAKE_TOOLCHAIN_FILE=../ios-cmake/ios.toolchain.cmake
161+
-DCMAKE_TOOLCHAIN_FILE=../ios-cmake/ios.toolchain.cmake \
162+
-DBROTLI_BUNDLED_MODE=ON # disable install, which is failing for iOS
147163

148164
cmake --build . --config $BUILD_TYPE -j$(sysctl -n hw.ncpu)
149-
cmake --install . --prefix "$(realpath ../install)"
165+
# cmake --install . --prefix "$(realpath ../install)" - this won't do anything since BROTLI_BUNDLED_MODE=ON
166+
# we need to manually copy the libs & headers instead
167+
cp libbrotli*.a ../install/lib/
168+
cp -R ../../../../brotli/c/include/ ../install/include/
150169

151170
echo "$THIS_BUILD_INFO" > lastBuildInfo.txt
152171
else
@@ -157,11 +176,6 @@ cd ..
157176

158177
# === Zlib ===
159178

160-
if [ ! -d "zlib" ]; then
161-
echo "⏳ Cloning Zlib..."
162-
git clone --branch v1.3.1 https://github.com/madler/zlib.git
163-
fi
164-
165179
echo "⏳ Building Zlib for iOS..."
166180

167181
mkdir -p zlib
@@ -188,6 +202,7 @@ if [ "$BUILD_ZLIB" -eq 1 ]; then
188202
-DZLIB_BUILD_SHARED=OFF \
189203
-DZLIB_BUILD_STATIC=ON \
190204
-DZLIB_BUILD_MINIZIP=OFF \
205+
-DZLIB_BUILD_EXAMPLES=OFF \
191206
-DZLIB_INSTALL=ON \
192207
-DCMAKE_SYSTEM_NAME="iOS" \
193208
-DCMAKE_INSTALL_PREFIX="$(realpath ../install)" \
@@ -196,19 +211,20 @@ if [ "$BUILD_ZLIB" -eq 1 ]; then
196211
cmake --build . --config $BUILD_TYPE -j$(sysctl -n hw.ncpu)
197212
cmake --install . --prefix "$(realpath ../install)"
198213

214+
# to avoid issues with linker, remove .dylib files; the current release does not yet respect BUILD_SHARED=OFF
215+
# TODO: remove the below as a new version is released (BUILD_SHARED=OFF is already on main branch)
216+
rm -f ../install/lib/libz*.dylib
217+
199218
echo "$THIS_BUILD_INFO" > lastBuildInfo.txt
200219
else
201220
echo "⏭️ Zlib already built for ${CMAKE_IOS_PLATFORM}, skipping..."
202221
fi
203222

204223
cd ..
205224

206-
mkdir -p curl
225+
# === Curl ===
207226

208-
if [ ! -d "curl" ]; then
209-
echo "⏳ Cloning curl..."
210-
git clone --depth 1 --branch curl-8_15_0 https://github.com/curl/curl.git
211-
fi
227+
mkdir -p curl
212228

213229
echo "⏳ Building curl for iOS..."
214230

@@ -265,11 +281,11 @@ if [ "$BUILD_CURL" -eq 1 ]; then
265281
cmake --build . --config $BUILD_TYPE -j$(sysctl -n hw.ncpu)
266282
cmake --install . --prefix "$(realpath ../install)"
267283

268-
if [ "$BUILD_TYPE" = "Debug" ]; then
269-
# cocoapods would hardcode -llib*d flags if the debug files existed, which would break compilation
270-
# when switching between configurations, therefore all *d libs are renamed to non-d-suffixed in Debug
271-
mv ../install/lib/libcurl-d.a ../install/lib/libcurl.a
272-
fi
284+
# if [ "$BUILD_TYPE" = "Debug" ]; then
285+
# # cocoapods would hardcode -llib*d flags if the debug files existed, which would break compilation
286+
# # when switching between configurations, therefore all *d libs are renamed to non-d-suffixed in Debug
287+
# mv ../install/lib/libcurl-d.a ../install/lib/libcurl.a
288+
# fi
273289

274290
echo "$THIS_BUILD_INFO" > lastBuildInfo.txt
275291
else
@@ -278,6 +294,8 @@ fi
278294

279295
cd ..
280296

297+
# === Wrapper build ===
298+
281299
echo "⏳ Configuring wrapper for iOS with CMake..."
282300

283301
BUILD_WRAPPER=$CMAKE_FORCE_REBUILD
@@ -305,13 +323,6 @@ if [ "$BUILD_WRAPPER" -eq 1 ]; then
305323
cmake --build . --config $BUILD_TYPE -j$(sysctl -n hw.ncpu)
306324
cmake --install . --prefix ./install
307325

308-
if [ "$BUILD_TYPE" = "Debug" ]; then
309-
# cocoapods would hardcode -llib*d flags if the debug files existed, which would break compilation
310-
# when switching between configurations, therefore all *d libs are renamed to non-d-suffixed in Debug
311-
mv ../install/lib/libprotobufd.a ../install/lib/libprotobuf.a
312-
mv ../install/lib/libprotobuf-lited.a ../install/lib/libprotobuf-lite.a
313-
fi
314-
315326
echo "$THIS_BUILD_INFO" > lastBuildInfo.txt
316327
else
317328
echo "⏭️ Wrapper already built for ${CMAKE_IOS_PLATFORM}, skipping..."
@@ -322,5 +333,5 @@ if [ -d ../install ]; then
322333
rm -rf ../install
323334
fi
324335

325-
echo "Creating install dir copy"
336+
echo "Copying this variant's install dir to ../install"
326337
cp -R "$(realpath ./install)" ../install

0 commit comments

Comments
 (0)