Search code examples
c++visual-studiocmakeconan

Error when using conan to install dependencies


Today I downloaded Conan, cmake, Visual studio code (including the C++, C++ makefile, Cmake, Cmake tools, and conan-tools extensions).

In order to get started, I began with the following tutorial. Everything went smoothly up until step 5, where I got the following error:

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

after entering 'conan install ..' in the command line.

I have been trying to solve the problem for a few hours now, but do not know how to continue. Does anyone have any ideas as to what I am doing wrong?

My conan profile currently looks as follows:

[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]

Solution

  • The getting started section at step 5 says:

    If you are using GCC compiler >= 5.1, Conan will set the compiler.libcxx to the old ABI for backwards compatibility. You can change this with the following commands:

    But you are using Visual Studio, which is not that case, thus you have to skip that step.

    As your default profile contains libcxx now, you should remove it:

    conan profile remove settings.compiler.libcxx default