c - 在 Azure Pipeline 中的 macOS 上构建 32 位 dylib
问题描述
我正在尝试从 Azure Pipeline 中 macOS 代理上的 C 文件构建 32 位 dylib。重要提示:我需要将 CoreServices 与我的共享库链接。我最初的构建脚本是:
gcc -c test.c
gcc -shared -framework CoreServices -o test.dylib test.o -m32
所以我用-m32
switch 来输出 32 位文件。但在这里我得到错误:
ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks//CoreServices.framework/CoreServices.tbd, missing required architecture i386 in file /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks//CoreServices.framework/CoreServices.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd
Undefined symbols for architecture i386:
"_CFAbsoluteTimeGetCurrent", referenced from:
_StartHighPrecisionTickGenerator in NativeApi-macOS.o
"_CFRunLoopAddTimer", referenced from:
_RunLoopThreadRoutine in NativeApi-macOS.o
...
"_memset", referenced from:
_StartHighPrecisionTickGenerator in NativeApi-macOS.o
"_pthread_create", referenced from:
_StartHighPrecisionTickGenerator in NativeApi-macOS.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
据我所知,构建 32 位应用程序的能力已从最新的 macOS 版本中删除。
我发现我们可以使用 Xcode 9 来构建 32 位 dylib。Azure Pipelines 中还有一项特殊任务:Xcode@5。但我无法弄清楚如何使用此任务从原始 C 文件而不是 Xcode 项目/工作区构建 dylib。可能吗?我谈论的是 Azure Pipeline 任务,当然是命令行界面,而不是 GUI。
或者现在构建 32 位 dylib 可能是完全愚蠢的想法?这对 Windows 来说绝对重要(例如,对于标记为 .NET Framework 的应用程序prefer 32-bit
),但也许 macOS 的 32 位应用程序是旧垃圾?
解决方案
推荐阅读
- c# - 指示 Resharper 忽略 C# 的文件夹
- javascript - 用另一个指令包装 Angular 2+ 指令
- c# - 绑定到 UserControl 中 ComboBox 的 SelectedItem
- ios - 如何为 iPhone 获取新的 UDID 以在 Apple 门户中注册
- mysql - 您如何在 MySQL 工作台中为多个 SQL 查询计时?
- html - 如何在具有不同背景颜色的div中间显示文本?
- c# - 如何将值从存储过程控制器输出到 PostMan
- php - 需要在laravel中创建一个下拉列表,并将结果插入到一个新的数据库中
- r - R使用下标和上标创建具有不同标题和轴名称的多个图形
- r - ggplot 扩展图例颜色条