使用 Clang-CL 跨 Windows 构建 ICU(来自 Conan)

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

我在使用 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.

所以问题似乎是配置传递无效标志。

c++ clang cross-compiling icu conan
1个回答
0
投票

我最终在我的个人资料中使用编译器 = msvc 来获取我的依赖项,这避免了需要完全构建 ICU。这会导致我的另一个依赖项(Boost locale)出现问题,但我能够“更改配方”来解决这些问题。最后,我可能有能力消除对 Boost 的依赖,因为我没有使用 ICU 本身不提供的任何东西。

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