Open shanzez opened 3 years ago
Also, it appears that the wrapper.c needs adjustment:
env(&sdk, "IOS_SDK_SYSROOT", sdkpath);
env(&cpu, "IOS_TARGET_CPU", TARGET_CPU);
env(&osmin, "IPHONEOS_DEPLOYMENT_TARGET", OS_VER_MIN);
unsetenv("IPHONEOS_DEPLOYMENT_TARGET");
snprintf(osvermin, sizeof(osvermin), "-miphoneos-version-min=%s", osmin);
Would it work if I just change those values to APPLETVOS|appletvos?
Finally, I just noticed this at the bottom of my build.sh execution:
*** checking toolchain ***
clang-12: warning: using sysroot for 'AppleTVOS' but targeting 'iPhone' [-Wincompatible-sysroot]
/usr/bin/ld: unrecognized option '-dynamic'
/usr/bin/ld: use the --help option for usage information
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
I assumed this is coming from this line in build.sh:
echo "int main(){return 0;}" | $TRIPLE-clang -xc -O2 -o test - 1>/dev/null || exit 1
I can't reproduce the variable-sized error. I have tested clang 3.5, 3.6, 3.7, 3.8, 3.9, 4.0.1, 5.0.2, 6.0.1, 7.0.1, 8.0.0, 9.0.0, 10.0.0, 11.0.0, and git ...
What's your OS and your compiler version?
It's -mtvos-version-min=x.x
, I think.
I'm very sorry for not getting back to you sooner.
I'm using Apple's llvm https://github.com/apple/llvm-project.git rev
8b8cdf9a9dc095e53269eaf5acfd803ee28c9083
I build it, then build a new version of it with the just built version (so llvm with llvm)
mkdir llddir && cd lldir &&\
git init &&\
git remote add origin https://github.com/apple/llvm-project.git &&\
git fetch origin 8b8cdf9a9dc095e53269eaf5acfd803ee28c9083 &&\
git reset --hard FETCH_HEAD && \
mkdir -p llvm/build clang/build1 clang/build2 &&\
cd llvm/build &&\
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=1 &&\
make -j$(nproc --all) install &&\
cd ${LLDIR}/clang/build1 &&\
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=1 &&\
make -j$(nproc --all) clang &&\
cd ../build2 &&\
CC=${LLDIR}/clang/build1/bin/clang CXX=${LLDIR}/clang/build1/bin/clang++ \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=1 &&\
make -j$(nproc --all) install &&\
The OS is Debian buster-20201209-slim and I start out with g++ and llvm-dev installed via apt. I use the above llvm build with my ios (cctools-port) and mac (osxcross) builds too and it has worked fine.
Thank you, sir.
Pulling in your patch 14ab64360c556c1263e022318ee4be1077d7a839 and changing -miphoneos-version-min
to -mtvos-version-min
has me building successfully.
I'm fine if you'd like to close this ticket @tpoechtrager. Thank you again.
Let's keep it open for reference. You might not be the only one who wants a tvOS toolchain. :)
For other OSs:
-mappletvos-version-min=
-mappletvsimulator-version-min=
-mios-simulator-version-min=
-mios-version-min=
-miphoneos-version-min=
-miphonesimulator-version-min=
-mmacos-version-min=
-mmacosx-version-min=
-mtvos-simulator-version-min=
-mtvos-version-min=
-mwatchos-simulator-version-min=
-mwatchos-version-min=
-mwatchsimulator-version-min=
I'm trying to copy the ios build.sh example usage to use for tvos and I've gotten pretty far, but need some help here:
Basically, I stripped out the same parts of the Xcode.xip for AppleTVOS that I stripped out for iPhoneOS and then made adjustments to the ios_toolchain/build.sh for tvos. It looks like I got pretty far, but maybe I deluding myself.