Issue |
131509
|
Summary |
Cannot build when using @available option for darwin (osx) on linux system
|
Labels |
|
Assignees |
|
Reporter |
iamkhalidbashir
|
I'm trying to build a Darwin application on a Linux machine using osxcross, but whenever the application uses the `@available` option, I see the following error.
```
Undefined symbols for architecture arm64:
"___isPlatformVersionAtLeast", referenced from:
-[RTCMTLRenderer setupTexturesForFrame:] in Sinch(libSinch-dist.a-arm64-master.o)
-[RTCMTLVideoView frameRotation] in Sinch(libSinch-dist.a-arm64-master.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
I have narrowed down the error to a specific file named `libclang_rt.osx.a`, which does not get built when I build the LLVM binaries from source.
I am using the following building code
```dockerfile
RUN ARCH=$(uname -m) && \
echo "Building LLVM for (${ARCH}) Swift ${SWIFT_LLVM_VERSION}" && \
echo "Building LLVM from source..." && \
mkdir -p /tmp/llvm-project && cd /tmp/llvm-project && \
tar -xf /tmp/osxcross/tarballs/MacOSX${SDK_VERSION}.sdk.tar.xz -C /tmp && \
OSX_SDK_PATH=/tmp/MacOSX${SDK_VERSION}.sdk && \
curl -sSL "https://github.com/swiftlang/llvm-project/archive/refs/tags/swift-${SWIFT_LLVM_VERSION}-RELEASE.tar.gz" \
| tar -C /tmp/llvm-project --strip=1 -xzf - && \
mkdir build && cd build && \
cmake -DLLVM_ENABLE_PROJECTS="clang;compiler-rt" \
-DCMAKE_BUILD_TYPE="Release" \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DCMAKE_OSX_SYSROOT=${OSX_SDK_PATH} \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_EXAMPLES=Off \
-DLLVM_ENABLE_BACKTRACES=Off \
-DLLVM_BUILD_32_BITS=OFF \
-DCOMPILER_RT_BUILD_BUILTINS=ON \
-DCOMPILER_RT_BUILD_SANITIZERS=OFF \
-DCOMPILER_RT_BUILD_XRAY=OFF \
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
-DCOMPILER_RT_BUILD_PROFILE=OFF \
-DCOMPILER_RT_BUILD_MEMPROF=OFF \
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=OFF \
-DCOMPILER_RT_INCLUDE_TESTS=OFF \
-DCOMPILER_RT_ENABLE_IOS=OFF \
-DCOMPILER_RT_ENABLE_WATCHOS=OFF \
-DCOMPILER_RT_ENABLE_TVOS=OFF \
-DCOMPILER_RT_ENABLE_DARWIN=ON \
-DCOMPILER_RT_ENABLE_OSX=ON \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${OSX_VERSION_MIN} \
-DDARWIN_osx_ARCHS="x86_64;arm64" \
-DDARWIN_osx_BUILTIN_ARCHS="x86_64;arm64" \
/tmp/llvm-project/llvm && \
cmake --build . && \
cmake --build . --target package && \
rm -rf /tmp/MacOSX${SDK_VERSION}.sdk && \
ARCH=$(uname -m) && \
mv LLVM-*-Linux.tar.gz "LLVM-${SWIFT_LLVM_VERSION}-${ARCH}-Linux.tar.gz" && \
tar -xzf "LLVM-${SWIFT_LLVM_VERSION}-${ARCH}-Linux.tar.gz" --strip 1 -C /usr/local && \
mv "LLVM-${SWIFT_LLVM_VERSION}-${ARCH}-Linux.tar.gz" /; \
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs