j***@126.com
j***@126.com
  • 发布:2026-01-12 11:09
  • 更新:2026-01-12 17:19
  • 阅读:63

iOS 开发的 uts插件,本地编译运行正常,云打包失败

分类:uts

以下是HBuilderX云打包编译错误信息,分析一下是什么原因?

Error code = -5000
Error message:
UTS plugin uni_modules/msq-modbus-tcp compile error!

uni_modules/msq-modbus-tcp

[PackagePath]/wgtRoot/UNI5AAFC06/uni_modules/msq-modbus-tcp/utssdk/app-ios/Frameworks/MsqModbusTcp.framework/Modules/MsqModbusTcp.swiftmodule/arm64-apple-ios.private.swiftinterface:4:8: error: no such module 'CLibModbus'
[PackagePath]/wgtRoot/UNI5AAFC06/uni_modules/msq-modbus-tcp/utssdk/app-ios/src/index.swift:4:8: error: failed to build module 'MsqModbusTcp'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)', while this compiler is 'Apple Swift version 6.0.2 effective-5.10 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)'). Please select a toolchain which matches the SDK.
[PackagePath]/wgtRoot/UNI5AAFC06/uni_modules/msq-modbus-tcp/utssdk/app-ios/Frameworks/MsqModbusTcp.framework/Modules/MsqModbusTcp.swiftmodule/arm64-apple-ios.private.swiftinterface:4:8: error: no such module 'CLibModbus'
BUILD FAILED The following build commands failed:
SwiftCompile normal arm64 [PackagePath]/wgtRoot/UNI5AAFC06/uni_modules/msq-modbus-tcp/utssdk/app-ios/src/index.swift (in target 'unimoduleMsqModbusTcp' from project 'UTS')
SwiftEmitModule normal arm64 Emitting\ module\ for\ unimoduleMsqModbusTcp (in target 'unimoduleMsqModbusTcp' from project 'UTS')
(2 failures)

2026-01-12 11:09 负责人:无 分享
已邀请:
Ask小助手

Ask小助手

该问题请在专业群( uni-app x技术交流群 ) 咨询,群中有相关专业的管理员和群友。

根据错误日志分析,主要问题是Swift版本不兼容和模块缺失:

  1. Swift版本冲突:插件使用Swift 5.10编译(swiftlang-5.10.0.13),但云打包环境使用Swift 6.0.2(swiftlang-6.0.2.1.2)。虽然标记为"effective-5.10",但实际编译器版本更高,导致模块构建失败。

  2. CLibModbus模块缺失:Swift代码中尝试导入C语言库CLibModbus,但该模块未正确集成。

解决方案:

  • 确保插件编译时使用的Xcode版本与云打包环境一致或更低
  • 对于C语言库,在Swift中需通过桥接头文件引入,参考文档
  • 在Xcode中设置Build Libraries for Distribution为YES以保证二进制兼容性
  • 检查MsqModbusTcp.framework是否包含必要的模块映射文件

本地编译成功而云打包失败,通常是因为本地Xcode版本与云打包环境不一致。建议使用HBuilderX 4.87正式版,并确保插件依赖的第三方库与云打包环境兼容。

内容为 AI 生成,仅供参考
j***@126.com

j***@126.com (作者) - 不一样的我

引入的是c库 使用的是module.modulemap 方式,Build Libraries for Distribution 也是yes ,就是无法云打包。。我都服了。。。

j***@126.com

j***@126.com (作者) - 不一样的我

没法子,只能改modulemap 方式为c函数 库声明方式了,真无语
,有没有大佬告知用module map 怎么打包的?

要回复问题请先登录注册