我在使用 Clang-CL 构建 Conan 的 ICU 配方时遇到了一些麻烦。
我正在使用以下主机配置文件在 Linux 上编译 这个项目:
{% set msvc_install_root = os.getenv("HOME") + "/.cmake/toolchains/msvc" %}
{% set toolchain_path = os.getenv("HOME") + "/.cmake/toolchains/clang-cl-msvc.cmake" %}
[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=17
compiler.version=15
compiler.runtime=dynamic
compiler.runtime_version=v143
os=Windows
[buildenv]
CC=clang-cl
CXX=clang-cl
LD=lld
INCLUDE={{ msvc_install_root }}/vc/tools/msvc/14.34.31933/include;{{ msvc_install_root }}/kits/10/include/10.0.22621.0/shared;{{ msvc_install_root }}/kits/10/include/10.0.22621.0/ucrt;{{ msvc_install_root }}/kits/10/include/10.0.22621.0/um;{{ msvc_install_root }}/kits/10/include/10.0.22621.0/winrt
LIB={{ msvc_install_root }}/vc/tools/msvc/14.34.31933/lib/x64;{{ msvc_install_root }}/kits/10/lib/10.0.22621.0/ucrt/x64;{{ msvc_install_root }}/kits/10/lib/10.0.22621.0/um/x64
[conf]
tools.microsoft.msbuild:installation_path=
tools.gnu:host_triplet=x86_64-pc-windows
tools.build:exelinkflags=["-fuse-ld=lld"]
tools.cmake.cmaketoolchain:user_toolchain=["{{ toolchain_path }}"]
tools.cmake.cmaketoolchain:generator=Ninja
[options]
icu/*:shared=False
sable-text-converter/*:build_asar=False
sable-text-converter/*:use_system_boost=True
sable-text-converter/*:use_system_icu=False
msvc_install_root 是使用这些脚本安装的 MSVC 工具链的副本。
我尝试过不同版本的 ICU 配方,但在这一步都失败了:
checking for namespace support... no
configure: error: Namespace support is required to build ICU.
icu/74.2: ERROR:
Package '630871f36df7e455b54deb89876e2fe1e57d5653' build failed
知道我能做些什么来解决这个问题吗?
编辑:这是 config.log 中的错误:
configure:6848: checking for namespace support
configure:6867: clang-cl -o conftest -std=c++17 -MD -O3 -FS -DNDEBUG -DU_STATIC_IMPLEMENTATION -fuse-ld=lld conftest.cpp >&5
clang: warning: unknown argument ignored in clang-cl: '-std=c++17' [-Wunknown-argument]
clang: warning: argument unused during compilation: '-O3' [-Wunused-command-line-argument]
configure:6867: $? = 0
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "ICU"
| #define PACKAGE_TARNAME "International Components for Unicode"
| #define PACKAGE_VERSION "70.1"
| #define PACKAGE_STRING "ICU 70.1"
| #define PACKAGE_BUGREPORT "http://icu-project.org/bugs"
| #define PACKAGE_URL "http://icu-project.org"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define SIZEOF_VOID_P 8
| #define HAVE_INTTYPES_H 1
| /* end confdefs.h. */
| namespace x_version {void f(){}}
| namespace x = x_version;
| using namespace x_version;
|
| int
| main ()
| {
| f();
| ;
| return 0;
| }
configure:6876: result: no
configure:6880: error: Namespace support is required to build ICU.
所以问题似乎是配置传递无效标志。