Does cctools generate/support iPhone Simulator arm64 arch #102
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi,
We are facing a problem with the library generated by cctools as it's doesn't contain arm64 simulator architecture, which is expected by simulators on the M1 mac machine.
Does cctools generate iPhone simulator arm64 arch slice for a library?
Here is the error:
building for iOS Simulator, but linking in object file (libxyz.a(filename.o)) built for iOS
Thanks,
Dayananda
iPhone Simulator is currently not supported. Do you depend on Simulator support? I might be able to get it working.
@tpoechtrager Thanks for the response.
I've a M1 based macbook whose simulator also has arm64 so wanted to try it out. That will be cool if it works.
Thanks a lot.
@tpoechtrager I have the same issue while trying to build
arm64tvOS simulator binary.Resulting binary is considered to be built for tvOS.
arm64tvOS andx86_64tvOS simulator binaries are built correctly.@naithar To be honest, I don't know. I can't do any testing either. Maybe it's just a warning and we have to wait for the next
ld64open source release.Could you try building with Apple's Compiler instead of Mainline LLVM? https://github.com/apple/llvm-project
I will try, thanks. But I don't have any experience in this, so it might take a while.
Could the problem be related to the way target platform gets determined in some way? Using arm64 arch for simulator platform seems to force device platform. Is there a way to trace where target platform gets incorrectly defined?
Yes, absolutely possible. You could start with adding
-vto the compile command.For which command should I use this flag? For
https://github.com/tpoechtrager/cctools-port/blob/master/usage_examples/ios_toolchain/build.shor somewhere else? Thanks :)Edit:
I think I've found flags that I need
-tvos_simulator_version_min? But it didn't help.Changing
PlatformSupport.cppto return only simulator platforms, since it seems like the only place where platform is used, didn't help also.The compiler is (probably) doing something wrong not the linker. You must examine the compiler.
Add
-vto the compiler args.For example:
Seems that clang toolchain assumes only x86 iphone (and tvos probably) simulator atm, this patch should fix this:
This patch may not follow official coding style of llvm, but should be able to workaround the problem for now
I'm using apple-llvm, but I think official clang should be the same too, can you try?
my result: (i use my own bash wrapper)
And by the way x86_64 simulator works for me too without any patches:
For the record, as of Apple Clang based on LLVM 15.0.0, I seem to be able to build iPhoneSimulator for arm64 (using SDK 16.4 from Xcode 14.3.1).
I haven't tried with upstream LLVM 15.0.0.
Edit: It builds, but doesn't work it seems. Building an app for iOS simulator with our Godot library built with ioscross, we get:
Are you using the correct SDK and correct target triple? According to ChatGPT it should be something like
x86_64-apple-iosXX.Y-simulatorI can build for arm64 iOS simulator just fine with upstream clang 16.0.6 on Linux, the ChatGPT target triple is correct except for the arch, which should be arm64 as they are building for arm64.
You can also use
darwinXXas the OS instead ofiosXX.Y-simulator, but you might have to add-mios-simulator-version-min=XXto clang arguementsI'm using the correct SDK, but I'm not sure I'm using the target triple correctly.
I was using the default in
usage_examples/ios_toolchain/build.sh, after patching the SDK dir:Now reading you I see that I might need to patch
usage_examples/ios_toolchain/build.shfurther, or do all build steps manually to fully control the parameters.But I can't seem to pass a target triple as suggested for the cctools-port build:
It seems my Clang install (from latest osxcross with Apple Clang 15.0.0) doesn't recognize
arm64-appleas a valid machine.arm-appleworks. But then I can't find a system variant that works for the simulator. The defaultarm-apple-darwin11works ok.For the record, this is my current setup:
It's actually autogen that doesn't recognize the architecture. The best way to work around this would be to use
--target=aarch64-...instead ofarm64and then in the wrapper add-arch arm64to the compiler flags. There might be a chanceaarch64-works out of the box without the need of-arch arm64. Depends on what Clang does in the compiler driver.Or use
--target=arm-....and when compiling stuff add-arch arm64to the compiler flags.