在Mac OS Mojave 10.14.5中进行交叉编译

时间:2020-02-16 12:03:18

标签: macos arm clang cross-compiling macos-mojave

我正在尝试交叉编译以下简单代码

Chip(
  backgroundColor: Colors.deepPurple,
  padding: EdgeInsets.all(0),
  label: Text('BADGE', style: TextStyle(color: Colors.white)),
),
Badge(
  badgeColor: Colors.deepPurple,
  shape: BadgeShape.square,
  borderRadius: 20,
  toAnimate: false,
  badgeContent:
      Text('BADGE', style: TextStyle(color: Colors.white)),
),

安装到具有Arm Cortex-M4处理器的nRF52840Dk板上。我的主机是带有MacOS Mojave 10.14.5 OS的Macbook Pro 15''。我希望首先运行程序裸机(没有任何操作系统)。

当我运行以下命令时:

#include <stdio.h> #include <stdlib.h> int main() { int i; for (i = 0; i < 100; i++) { printf("Hello World %d!\n", i); } do { i++; } while (1); } 我得到clang --target=armv7-none-gnueabi foo.c

现在我环顾四周,发现这个问题可能是由于foo.c:1:10: fatal error: 'stdio.h' file not found在较新的OSX变体中的位置不同所致。

我尝试了以下解决方案,但未取得任何进一步进展:

  1. /usr/include

已经完成。我已经安装了xcode命令行工具。

  1. 运行xcode-select --install并继续进行安装程序

我猜这可能是错误。运行此命令时,我遇到安装程序,并同意许可,但是随后收到此警告open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg。无论如何,每次安装都会失败。这与Mac禁止运行32位应用程序有关吗?那时人们如何交叉编译到较新的Mac上的ARM板上?

  1. Installing this package may damage your system, and the installation may fail. To stop the program and the installation, click “Cancel Installation”.环境变量设置为CPATH

也尝试这样做,但这会导致警告和错误激增。尽管似乎找到了/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include,但它引发了以下错误:

stdio.h

以及其他一系列错误。

所以我不确定如何继续进行。有人可以启发我吗?

0 个答案:

没有答案