首页 > 解决方案 > 使用柯南安装依赖时出错

问题描述

今天我下载了 Conan、cmake、Visual Studio 代码(包括 C++、C++ makefile、Cmake、Cmake 工具和 conan-tools 扩展)。

为了开始,我从以下教程开始。一切都很顺利,直到第 5 步,我收到以下错误:

C:\Users\rik>conan profile new default --detect
ERROR: Profile already exists

C:\Users\rik>conan profile update settings.compiler.libcxx=libstdc++11 default

C:\Users\rik>cd build

C:\Users\rik\build>conan install .. --build=missing
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=6.3
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

WARN: apr-util/1.6.1: requirement expat/2.2.9 overridden by poco/1.10.0 to expat/2.2.10
WARN: libmysqlclient/8.0.17: requirement openssl/1.1.1i overridden by poco/1.10.0 to openssl/1.1.1h
apr/1.7.0: WARN: Package binary is corrupted, removing: 75bcd663b0f2f789317e8f347afd187fc180604d
conanfile.txt: Installing package
Requirements
    apr/1.7.0 from 'conan-center' - Cache
    apr-util/1.6.1 from 'conan-center' - Cache
    bzip2/1.0.8 from 'conan-center' - Cache
    expat/2.2.10 from 'conan-center' - Cache
    libmysqlclient/8.0.17 from 'conan-center' - Cache
    libpq/11.5 from 'conan-center' - Cache
    openssl/1.1.1h from 'conan-center' - Cache
    pcre/8.41 from 'conan-center' - Cache
    poco/1.10.0 from 'conan-center' - Cache
    sqlite3/3.33.0 from 'conan-center' - Cache
    zlib/1.2.11 from 'conan-center' - Cache
Packages
    apr/1.7.0:75bcd663b0f2f789317e8f347afd187fc180604d - Build
    apr-util/1.6.1:8b2f670f1c54911ff5c244c18d6d4a4abee1db7f - Build
    bzip2/1.0.8:3aee75d6bdc58b782dbb09a2263ed3abf7aa35f8 - Build
    expat/2.2.10:7bc8c2c85db7a618e5320dc997f27fc33e1df074 - Build
    libmysqlclient/8.0.17:6560d88fd23bd54e819a26efa6d498a7747d4f45 - Build
    libpq/11.5:9fc28f1bce9db80921859269566418c1997aa229 - Build
    openssl/1.1.1h:7bc8c2c85db7a618e5320dc997f27fc33e1df074 - Build
    pcre/8.41:00ce0eb92ff18fdcef18d35149ff79f2e13475f7 - Build
    poco/1.10.0:8c9967587910223da108c1617f97f979dda1fea1 - Build
    sqlite3/3.33.0:d7a5a0159ffdae5dbeca410940686c7d66bbd521 - Build
    zlib/1.2.11:7bc8c2c85db7a618e5320dc997f27fc33e1df074 - Build
Build requirements
    msys2/20190524 from 'conan-center' - Cache
    msys2/20200517 from 'conan-center' - Cache
    nasm/2.14 from 'conan-center' - Cache
Build requirements packages
    msys2/20190524:3cbd862cb7a3ea47ed1220dc027f344262d5224f - Cache
    msys2/20200517:3cbd862cb7a3ea47ed1220dc027f344262d5224f - Cache
    nasm/2.14:456f15897172eef340fcbac8a70811f2beb26a93 - Cache

Installing (downloading, building) binaries...
apr/1.7.0: WARN: Build folder is dirty, removing it: C:\Users\rik\.conan\data\apr\1.7.0\_\_\build\75bcd663b0f2f789317e8f347afd187fc180604d
apr/1.7.0: Copying sources to build folder
apr/1.7.0: Building your package in C:\Users\rik\.conan\data\apr\1.7.0\_\_\build\75bcd663b0f2f789317e8f347afd187fc180604d
apr/1.7.0: Generator cmake created conanbuildinfo.cmake
apr/1.7.0: Calling build()
apr/1.7.0: WARN: Error running `configure --help`: Error 1 while executing source_subfolder/configure --help
apr/1.7.0: Calling:
 > source_subfolder/configure --with-installbuilddir=${prefix}/bin/build-1 --disable-shared --enable-static --prefix=C:/Users/rik/.conan/data/apr/1.7.0/_/_/package/75bcd663b0f2f789317e8f347afd187fc180604d
'source_subfolder' is not recognized as an internal or external command,
operable program or batch file.
apr/1.7.0:
apr/1.7.0: ERROR: Package '75bcd663b0f2f789317e8f347afd187fc180604d' build failed
apr/1.7.0: WARN: Build folder C:\Users\rik\.conan\data\apr\1.7.0\_\_\build\75bcd663b0f2f789317e8f347afd187fc180604d
ERROR: apr/1.7.0: Error in build() method, line 90
        autotools = self._configure_autotools()
while calling '_configure_autotools', line 74
        self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder)
        ConanException: Error 1 while executing source_subfolder/configure --with-installbuilddir=${prefix}/bin/build-1 --disable-shared --enable-static --prefix=C:/Users/rik/.conan/data/apr/1.7.0/_/_/package/75bcd663b0f2f789317e8f347afd187fc180604d

在命令行中输入“conan install ..”后。

我已经尝试解决这个问题几个小时了,但不知道如何继续。有人对我做错了什么有任何想法吗?

我的柯南个人资料目前如下所示:

[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=16
build_type=Release
compiler.libcxx=libstdc++11
[options]
[build_requires]
[env]

标签: c++visual-studiocmakeconan

解决方案


5 步的入门部分说:

如果您使用 GCC 编译器 >= 5.1,Conan 会将 compiler.libcxx 设置为旧 ABI 以实现向后兼容性。您可以使用以下命令更改此设置:

但是您使用的是 Visual Studio,但情况并非如此,因此您必须跳过该步骤。

由于您的默认配置文件现在包含libcxx,您应该将其删除:

conan profile remove settings.compiler.libcxx default 

推荐阅读