BelledonneCommunications / linphone-sdk

Mirror for linphone-sdk (https://gitlab.linphone.org/BC/public/linphone-sdk.git)
GNU Affero General Public License v3.0
105 stars 81 forks source link

Error building openssl library. #399

Open raposeidon opened 4 months ago

raposeidon commented 4 months ago

Build option is cmake --preset=ios-arm64 -B build-ios \ -DLINPHONESDK_IOS_PLATFORM=Iphone \ -DLINPHONESDK_IOS_ARCHS="arm64" \ -DLINPHONESDK_BUILD_TYPE="IOS" \ -DENABLE_FAT_BINARY=OFF \ -DCMAKE_CONFIGURATION_TYPES="Debug" \ -DENABLE_MBEDTLS=OFF \ -DENABLE_OPENSSL=ON \ -DBUILD_OPENSSL_SHARED_LIBS=OFF

I'm trying to build an openssl, but I get an error as below.

xcrun -sdk iphoneos cc -Iinclude -Iproviders/implementations/include -Iproviders/common/include -I../../../../../external/openssl/include -I../../../../../external/openssl/providers/implementations/include -I../../../../../external/openssl/providers/common/include -fPIC -arch armv7 -mios-version-min=6.0.0 -fno-common -O3 -arch arm64 -D_REENTRANT -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -I/Users/ymkim/Desktop/workspace/linphone-sdk/build-ios/linphone-sdk/ios-arm64/include -MMD -MF providers/legacy-dso-legacyprov.d.tmp -MT providers/legacy-dso-legacyprov.o -c -o providers/legacy-dso-legacyprov.o ../../../../../external/openssl/providers/legacyprov.c xcrun -sdk iphoneos cc -fPIC -arch armv7 -mios-version-min=6.0.0 -fno-common -O3 -arch arm64 -L. -bundle -Wl,-search_paths_first -L/Users/ymkim/Desktop/workspace/linphone-sdk/build-ios/linphone-sdk/ios-arm64/lib \ -o providers/legacy.dylib \ providers/legacy-dso-legacyprov.o \ providers/liblegacy.a providers/libcommon.a -lcrypto -lm

-- stderr output is: ../../../../../external/openssl/crypto/threads_pthread.c:230:16: warning: misaligned atomic operation may incur significant performance penalty; the expected alignment (8 bytes) exceeds the actual alignment (4 bytes) [-Watomic-alignment] *ret = atomic_or_fetch(val, op, ATOMIC_ACQ_REL); ^ ../../../../../external/openssl/crypto/threads_pthread.c:255:9: warning: misaligned atomic operation may incur significant performance penalty; the expected alignment (8 bytes) exceeds the actual alignment (4 bytes) [-Watomic-alignment] atomic_load(val, ret, __ATOMIC_ACQUIRE); ^ 2 warnings generated. ranlib: for architecture: armv7 file: libcrypto.a(libcrypto-lib-async_posix.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libcrypto-lib-async_win.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libcrypto-lib-cms_cd.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libcrypto-lib-dso_dl.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libcrypto-lib-dso_openssl.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libcrypto-lib-dso_vms.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libcrypto-lib-dso_win32.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libcrypto-lib-f_impl64.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libcrypto-lib-e_rc5.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libcrypto-lib-ebcdic.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libcrypto-lib-threads_none.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libcrypto-lib-threads_win.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libcrypto-lib-rand_deprecated.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libdefault-lib-rand_cpu_x86.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libdefault-lib-rand_tsc.o) has no symbols ranlib: for architecture: armv7 file: libcrypto.a(libdefault-lib-rand_win.o) has no symbols ranlib: for architecture: armv7 file: libssl.a(libssl-lib-ssl_utst.o) has no symbols ranlib: for architecture: armv7 file: providers/libdefault.a(libdefault-lib-rand_cpu_x86.o) has no symbols ranlib: for architecture: armv7 file: providers/libdefault.a(libdefault-lib-rand_tsc.o) has no symbols ranlib: for architecture: armv7 file: providers/libdefault.a(libdefault-lib-randwin.o) has no symbols Undefined symbols for architecture armv7: "atomic_fetch_or_8", referenced from: _CRYPTO_atomic_or in libcrypto.a(libcrypto-lib-threads_pthread.o) "___atomic_load", referenced from: _CRYPTO_atomic_load in libcrypto.a(libcrypto-lib-threads_pthread.o) ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [providers/legacy.dylib] Error 1 make: [build_sw] Error 2

Bitcode was deprecated in xcode14, which is still used in build scripts. This also needs to be revised.