2

所以我的问题是,当我在 MacBook Pro M1 上运行终端时,安装 miniforge3 和 Conda 后,每当我运行终端时,首先出现的是:

Last login: Thu Jul  1 15:36:59 on ttys000
ERROR: CONDA_BUILD_SYSROOT or SDKROOT has to be set for cross-compiling
activate_clang:67: read-only file system: /meson_cross_file.txt
activate_clang:68: read-only file system: /meson_cross_file.txt
activate_clang:69: read-only file system: /meson_cross_file.txt
activate_clang:70: read-only file system: /meson_cross_file.txt
activate_clang:71: read-only file system: /meson_cross_file.txt

谷歌搜索错误显示没有任何可以帮助我的信息,或者我只是收到“无结果”消息。我该如何正确设置?

4

1 回答 1

0

在执行以下操作时,我遇到了与 miniforge、Apple Silicon (M1) 相同的场景:

# Exclude external factors in my environment
$> mv ~/.zshrc ~/.not_zshrc
<close/open terminal>

$> curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
$> sh Miniforge3-MacOSX-arm64.sh -b -p ~/miniforge3
$> export PATH=~/miniforge3/bin:$PATH
$> conda init zsh
<close/open terminal>

$> conda create -n test clang_osx-64
$> conda activate test

所涉及的激活脚本是这样构建的:

if [ "@CONDA_BUILD_CROSS_COMPILATION@" = "1" ]; then
  _CMAKE_ARGS="${_CMAKE_ARGS} -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=@UNAME_MACHINE@ -DCMAKE_SYSTEM_VERSION=@UNAME_KERNEL_RELEASE@"
  _MESON_ARGS="${_MESON_ARGS} --cross-file $BUILD_PREFIX/meson_cross_file.txt"
  echo "[host_machine]" > $BUILD_PREFIX/meson_cross_file.txt
  echo "system = 'darwin'" >> $BUILD_PREFIX/meson_cross_file.txt
  echo "cpu = '@UNAME_MACHINE@'" >> $BUILD_PREFIX/meson_cross_file.txt
  echo "cpu_family = '@MESON_CPU_FAMILY@'" >> $BUILD_PREFIX/meson_cross_file.txt
  echo "endian = 'little'" >> $BUILD_PREFIX/meson_cross_file.txt
fi

我相信这是由于 Conda-Forge 的原料持续集成无法访问 Apple Silicon,因为它们构建了我们都使用的可爱的二进制文件(他们使用 Intel/AMD 架构来构建 Arm64;即交叉编译)。然后设置并传播给那些实际使用所述硬件的人。

不幸的是,这会创建一个始终真实的激活:

if [ "1" = "1" ]; then
  _CMAKE_ARGS="${_CMAKE_ARGS} -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_SYSTEM_VERSION=13.4.0"
  _MESON_ARGS="${_MESON_ARGS} --cross-file $BUILD_PREFIX/meson_cross_file.txt"
  echo "[host_machine]" > $BUILD_PREFIX/meson_cross_file.txt
  echo "system = 'darwin'" >> $BUILD_PREFIX/meson_cross_file.txt
  echo "cpu = 'x86_64'" >> $BUILD_PREFIX/meson_cross_file.txt
  echo "cpu_family = 'x86_64'" >> $BUILD_PREFIX/meson_cross_file.txt
  echo "endian = 'little'" >> $BUILD_PREFIX/meson_cross_file.txt
fi

虽然不是修复,但您可以在激活事件之前将 BUILD_PREFIX 设置为某个可写区域:

BUILD_PREFIX="/some/writable/dir"
conda activate test

但是,我宁愿忽略这条消息。BUILD_PREFIX 实际上只在conda build操作期间使用(据我所知)。

于 2021-08-17T05:27:03.257 回答