conda 中的 c++ 中的uncaught_exceptions 不可用?

问题描述 投票:0回答:1

我在 conda 环境中使用 Rstudio 来安装

recount
软件包,当它安装
tzdb
依赖项时,出现以下错误:

* installing *source* package ‘tzdb’ ...
** package ‘tzdb’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: ‘clang version 17.0.6’
using SDK: ‘MacOSX10.15.sdk’
clang++ -I"~/anaconda3/envs/CONDA_ENV/lib/R/include" -DNDEBUG  -I'~/anaconda3/envs/CONDA_ENV/lib/R/library/cpp11/include' -D_FORTIFY_SOURCE=2 -isystem ~/anaconda3/envs/CONDA_ENV/include -mmacosx-version-min=10.9 -I~/anaconda3/envs/CONDA_ENV/include   -I../inst/include -DINSTALL=dummy -DAUTO_DOWNLOAD=0 -DHAS_REMOTE_API=0 -DUSE_OS_TZDB=0 -DONLY_C_LOCALE=1 -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem ~/anaconda3/envs/CONDA_ENV/include -fdebug-prefix-map=/Users/runner/miniforge3/conda-bld/r-base-split_1709218322135/work=/usr/local/src/conda/r-base-4.3.3 -fdebug-prefix-map=~/anaconda3/envs/CONDA_ENV=/usr/local/src/conda-prefix  -c api.cpp -o api.o
In file included from api.cpp:1:

In file included from ../inst/include/date/tz.h:99:
../inst/include/date/date.h:1067:22: error: 'uncaught_exceptions' is unavailable: introduced in macOS 10.12 - see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk
 1067 |                 std::uncaught_exceptions() == 0 &&
      |                      ^
~/anaconda3/envs/CONDA_ENV/bin/../include/c++/v1/exception:185:63: note: 'uncaught_exceptions' has been explicitly marked unavailable here
  185 | _LIBCPP_FUNC_VIS _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS int uncaught_exceptions() _NOEXCEPT;

我可以看到 uncaught_exceptions 在 c++ 标准库头的异常文件中不可用。

我知道 uncaught_exceptions 被引入到 mac10.12+ 中的 libcpp 系统文件中(我的版本是 12.6.3),但无论哪种方式,conda 本身都会安装自己版本的系统文件,所以这不应该是一个问题。我尝试在 conda 上更新我的 libcxx 库文件,但这没有改变任何内容。是否可以更改 c++ 的标准库头?

c++ conda libc++
1个回答
0
投票

解决此问题的最简单方法是告诉

date.h
不要使用
std::uncaught_exceptions()
。这是通过在编译器命令行上使用此选项进行编译来完成的:

-DHAS_UNCAUGHT_EXCEPTIONS=0

或者以其他方式确保在编译器看到

HAS_UNCAUGHT_EXCEPTIONS
时将日期配置宏
0
设置为
date.h

© www.soinside.com 2019 - 2024. All rights reserved.