You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Apple M3芯片+Sonoma系统下编译Kivy iOS应用时libffi报‘C compiler cannot create executables’错误求助

Apple M3芯片+Sonoma系统下编译Kivy iOS应用时libffi报‘C compiler cannot create executables’错误求助

我现在在Apple M3芯片、Sonoma 14.6的Mac上尝试把一个简单的Kivy应用编译到iOS,结果在Kivy-iOS的toolchain build环节卡壳了,libffi编译时一直报C compiler cannot create executables错误,折腾了好久没解决,来求助大家!

我的环境与测试代码

环境信息

  • 系统:Sonoma 14.6,Apple M3芯片
  • Kivy-iOS版本:2024.3.17
  • Kivy版本:2.3.0
  • Xcode版本:16.1(已安装iOS&macOS平台工具)

测试用main.py代码

这是我用来测试的极简Kivy应用,本地运行完全正常:

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.label import Label

class MyApp(App):
    def build(self):
        self.label = Label(text="Hello!")
        button = Button(text="Change")
        button.bind(on_press=self.update_label)

        layout = BoxLayout(orientation='vertical')
        layout.add_widget(self.label)
        layout.add_widget(button)
        return layout

    def update_label(self, instance):
        self.label.text = "Button pressed!"

if __name__ == '__main__':
    MyApp().run()

已完成的操作步骤

我完全是跟着Kivy-iOS官方文档一步步来的:

  1. 在main.py同级目录创建Python 3.9虚拟环境:
    python3.9 -m venv venv
    
  2. 激活虚拟环境:
    . venv/bin/activate
    
  3. 安装kivy-ios:
    pip install kivy-ios
    
  4. 安装指定版本的Kivy(2.3.0):
    pip install kivy==2.3.0
    
  5. 本地运行测试:python main.py,应用正常启动,按钮功能也没问题,说明基础环境是好的
  6. 配置编译依赖:
    • 从App Store安装了Xcode 16.1,勾选了iOS&macOS平台工具
    • 执行了xcode-select --install
    • 用Homebrew装了必要组件:
      brew install autoconf automake libtool pkg-config
      brew link libtool
      

具体错误情况

当我执行toolchain build python3 kivy开始编译iOS版本时,前面的hostopenssl能正常下载安装,但到了libffi环节就失败了。

错误日志摘要

libffi 3.4.4下载解压正常,但执行配置脚本时出错:

[DEBUG   ] configure: error: in `/Users/mertmehmetaraz/synapp/Test1/build/libffi/iphoneos-arm64/libffi-3.4.4/build_iphoneos-armv7':
[DEBUG   ] configure: error: C compiler cannot create executables
[DEBUG   ] See `config.log' for more details

Config.log中的关键错误点

查看config.log后发现,是编译器链接测试程序时失败了,具体原因是:

configure:4597: xcrun -sdk iphoneos clang -target armv7-apple-ios -miphoneos-version-min=9.0 -fembed-bitcode   conftest.c  >&5 
ld: warning: -bitcode_bundle is no longer supported and will be ignored
ld: -mllvm and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我还尝试过手动把libffi版本换成3.4.5,但编译时还是出现一模一样的错误,实在不知道该怎么解决了,有没有遇到过类似问题的朋友,或者懂编译配置的大佬能给点建议?

备注:内容来源于stack exchange,提问作者320V

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 02:54:33