question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[question] msys2_installer build requirement seems to only work in conan profile

See original GitHub issue

Environment Details

  • Operating System+version: Windows 10
  • Compiler+version: GCC 7.3 (MinGW)
  • Conan version: conan 1.21.0
  • Python version: Python 3.7.2

Conan profile

[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=7.3
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]
CC=C:\Qt\Tools\mingw730_64\bin\gcc.exe
CXX=C:\Qt\Tools\mingw730_64\bin\g++.exe

My question

I’m trying to build my own package that requires the qt/5.13.2 package. I followed the Creating Packages Tutorial and managed to get it working without any requirements.
I then added the requires = "qt/5.13.2@bincrafters/stable" line to my conanfile.py. So the conanfile.py now looks like this:

from conans import ConanFile, CMake, tools

class MypackageConan(ConanFile):
    name = "my_package"
    version = "0.0.1"
    license = "<Put the package license here>"
    url = "<Package recipe repository url here, for issues about the package>"
    description = "<Description of Hello here>"
    settings = "os", "compiler", "build_type", "arch"
    options = {"shared": [True, False]}
    default_options = {"shared": False}
    requires = "qt/5.13.2@bincrafters/stable"
    generators = "cmake"

    def configure(self):
        # I don't need GUI support for this project
        self.options["qt"].GUI = False
        self.options["qt"].widgets = False
        self.options["openssl].with_asm = False
...

The rest of the file is just the standard contents produced by conan new.

Now, when I try to test my package by running conan create . demo/testing --build, I get the following error:

libpq/11.5: Copying sources to build folder
libpq/11.5: Building your package in D:\.conan\626fe3\1
libpq/11.5: Generator txt created conanbuildinfo.txt
libpq/11.5: Calling build()
libpq/11.5: WARN: Error running `configure --help`: Cannot recognize the Windows subsystem, install MSYS2/cygwin or specify a build_require to apply it.
libpq/11.5: Calling:
 > /d/.conan/626fe3/1/source_subfolder/configure --without-readline --with-zlib --without-openssl --prefix=D:/.conan/a06d08/1      
libpq/11.5:
libpq/11.5: ERROR: Package '19bba9ca9ea809d2dbc44f00c9fa42db1eb66ec1' build failed
libpq/11.5: WARN: Build folder D:\.conan\626fe3\1
ERROR: libpq/11.5: Error in build() method, line 113
        autotools = self._configure_autotools()
while calling '_configure_autotools', line 69
        self._autotools.configure(args=args)
        ConanException: Cannot recognize the Windows subsystem, install MSYS2/cygwin or specify a build_require to apply it.
Click to expand full log
>conan create . demo/testing --build
Exporting package recipe
my_package/0.0.1@demo/testing: The stored package has not changed
my_package/0.0.1@demo/testing: Exported revision: ad73f5bc39f4e931aff14fe990dad5d7
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=7.3
os=Windows
os_build=Windows
[options]
[build_requires]
[env]
CC=C:\Qt\Tools\mingw730_64\bin\gcc.exe
CXX=C:\Qt\Tools\mingw730_64\bin\g++.exe
bzip2/1.0.8: Forced build from source
double-conversion/3.1.5: Forced build from source
sqlite3/3.29.0: Forced build from source
zlib/1.2.11: Forced build from source
libpq/11.5: Forced build from source
openssl/1.1.1d: Forced build from source
pcre2/10.33: Forced build from source
qt/5.13.2@bincrafters/stable: Forced build from source
my_package/0.0.1@demo/testing: Forced build from source
nasm/2.14: Forced build from source
msys2_installer/20161025@bincrafters/stable: Forced build from source
7z_installer/1.0@conan/stable: Forced build from source
my_package/0.0.1@demo/testing (test package): Installing package
Requirements
    bzip2/1.0.8 from 'conan-center' - Cache
    double-conversion/3.1.5 from 'conan-center' - Cache
    libpq/11.5 from 'conan-center' - Cache
    openssl/1.1.1d from 'conan-center' - Cache
    pcre2/10.33 from 'conan-center' - Cache
    qt/5.13.2@bincrafters/stable from 'bincrafters' - Cache
    my_package/0.0.1@demo/testing from local cache - Cache
    sqlite3/3.29.0 from 'conan-center' - Cache
    zlib/1.2.11 from 'conan-center' - Cache
Packages
    bzip2/1.0.8:93d07331e82e053326d7a22b782c7c69c4eb834f - Build
    double-conversion/3.1.5:3b35a37f78849b878a5d086da27790c957afa6ef - Build
    libpq/11.5:19bba9ca9ea809d2dbc44f00c9fa42db1eb66ec1 - Build
    openssl/1.1.1d:34c14cb158f170a1ac11591fc08ddea87a9bfed0 - Build
    pcre2/10.33:56b9cb25bdfe0d68d0bf112d2ba76808ebde4cb5 - Build
    qt/5.13.2@bincrafters/stable:35d35d211f943d58d067515665fb7d9deead2a7e - Build
    my_package/0.0.1@demo/testing:93898184236b679fb8eaa1d3d0f8278d12bfa199 - Build
    sqlite3/3.29.0:588b780aca5e9ede0d5e5c41c813abdbe8af63e6 - Build
    zlib/1.2.11:040db29ed48cb6d2bb9f4c6d13e74d5e319c7ad8 - Build
Build requirements
    7z_installer/1.0@conan/stable from 'conan-center' - Cache
    msys2_installer/20161025@bincrafters/stable from 'conan-center' - Cache
    nasm/2.14 from 'conan-center' - Cache
Build requirements packages
    7z_installer/1.0@conan/stable:60b04a80ac4dd5c23f1acffacc679e9902e636e5 - Build
    msys2_installer/20161025@bincrafters/stable:3cbd862cb7a3ea47ed1220dc027f344262d5224f - Build
    nasm/2.14:456f15897172eef340fcbac8a70811f2beb26a93 - Build

7z_installer/1.0@conan/stable: Copying sources to build folder
7z_installer/1.0@conan/stable: Building your package in D:\.conan\94301f\1
7z_installer/1.0@conan/stable: Generator txt created conanbuildinfo.txt
7z_installer/1.0@conan/stable: Calling build()
7z_installer/1.0@conan/stable: WARN: This conanfile has no build step
7z_installer/1.0@conan/stable: Package '60b04a80ac4dd5c23f1acffacc679e9902e636e5' built
7z_installer/1.0@conan/stable: Build folder D:\.conan\94301f\1
7z_installer/1.0@conan/stable: Generated conaninfo.txt
7z_installer/1.0@conan/stable: Generated conanbuildinfo.txt
7z_installer/1.0@conan/stable: Generating the package
7z_installer/1.0@conan/stable: Package folder D:\.conan\ef63db\1
7z_installer/1.0@conan/stable: Calling package()
7z_installer/1.0@conan/stable package(): Packaged 3 '.dll' files: 7z.dll, 7zip.dll, 7zip32.dll
7z_installer/1.0@conan/stable package(): Packaged 3 '.exe' files: 7z.exe, 7zFM.exe, 7zG.exe
7z_installer/1.0@conan/stable package(): Packaged 2 '.sfx' files: 7z.sfx, 7zCon.sfx
7z_installer/1.0@conan/stable package(): Packaged 1 '.chm' file: 7zip.chm
7z_installer/1.0@conan/stable package(): Packaged 90 '.txt' files
7z_installer/1.0@conan/stable package(): Packaged 1 '.ion' file: descript.ion
7z_installer/1.0@conan/stable package(): Packaged 1 '.ttt' file: en.ttt
7z_installer/1.0@conan/stable: Package '60b04a80ac4dd5c23f1acffacc679e9902e636e5' created
7z_installer/1.0@conan/stable: Created package revision 13ffc7fb91da11d4ed332800bd094d11
bzip2/1.0.8: Copying sources to build folder
bzip2/1.0.8: Building your package in D:\.conan\838546\1
bzip2/1.0.8: Generator cmake created conanbuildinfo.cmake
bzip2/1.0.8: Calling build()
-- The C compiler identification is GNU 7.3.0
-- Check for working C compiler: C:/Qt/Tools/mingw730_64/bin/gcc.exe
-- Check for working C compiler: C:/Qt/Tools/mingw730_64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- This project seems to be plain C, using 'GNU' compiler
-- Conan: Compiler GCC>=5, checking major version 7.3
-- Conan: Checking correct version: 7.3
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EXPORT_NO_PACKAGE_REGISTRY


-- Build files have been written to: D:/.conan/838546/1
Scanning dependencies of target bz2
[ 20%] Building C object CMakeFiles/bz2.dir/source_subfolder/crctable.c.obj
[ 20%] Building C object CMakeFiles/bz2.dir/source_subfolder/compress.c.obj
[ 30%] Building C object CMakeFiles/bz2.dir/source_subfolder/blocksort.c.obj
[ 40%] Building C object CMakeFiles/bz2.dir/source_subfolder/bzlib.c.obj
[ 50%] Building C object CMakeFiles/bz2.dir/source_subfolder/decompress.c.obj
[ 70%] Building C object CMakeFiles/bz2.dir/source_subfolder/randtable.c.obj
[ 60%] Building C object CMakeFiles/bz2.dir/source_subfolder/huffman.c.obj
[ 80%] Linking C static library lib\libbz2.a
[ 80%] Built target bz2
Scanning dependencies of target bzip2
[ 90%] Building C object CMakeFiles/bzip2.dir/source_subfolder/bzip2.c.obj
[100%] Linking C executable bin\bzip2.exe
[100%] Built target bzip2
bzip2/1.0.8: Package '93d07331e82e053326d7a22b782c7c69c4eb834f' built
bzip2/1.0.8: Build folder D:\.conan\838546\1
bzip2/1.0.8: Generated conaninfo.txt
bzip2/1.0.8: Generated conanbuildinfo.txt
bzip2/1.0.8: Generating the package
bzip2/1.0.8: Package folder D:\.conan\c603cf\1
bzip2/1.0.8: Calling package()
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- This project seems to be plain C, using 'GNU' compiler
-- Conan: Compiler GCC>=5, checking major version 7.3
-- Conan: Checking correct version: 7.3
-- Configuring done
-- Generating done
-- Build files have been written to: D:/.conan/838546/1
[ 80%] Built target bz2
[100%] Built target bzip2
Install the project...
-- Install configuration: "Release"
-- Installing: D:/.conan/c603cf/1/lib/libbz2.a
-- Installing: D:/.conan/c603cf/1/bin/bzip2.exe
-- Installing: D:/.conan/c603cf/1/include/bzlib.h
-- Installing: D:/.conan/c603cf/1/lib/cmake/bzip2/BZip2Config.cmake
-- Installing: D:/.conan/c603cf/1/lib/cmake/bzip2/BZip2Config-release.cmake
bzip2/1.0.8 package(): Packaged 1 '.exe' file: bzip2.exe
bzip2/1.0.8 package(): Packaged 1 '.h' file: bzlib.h
bzip2/1.0.8 package(): Packaged 1 '.a' file: libbz2.a
bzip2/1.0.8 package(): Packaged 1 file: LICENSE
bzip2/1.0.8: Package '93d07331e82e053326d7a22b782c7c69c4eb834f' created
bzip2/1.0.8: Created package revision bb751b73d4a8e1b42e2f7b878fe79bc1
double-conversion/3.1.5: Copying sources to build folder
double-conversion/3.1.5: Building your package in D:\.conan\052d3b\1
double-conversion/3.1.5: Generator cmake created conanbuildinfo.cmake
double-conversion/3.1.5: Calling build()
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: C:/Qt/Tools/mingw730_64/bin/gcc.exe
-- Check for working C compiler: C:/Qt/Tools/mingw730_64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Qt/Tools/mingw730_64/bin/g++.exe
-- Check for working CXX compiler: C:/Qt/Tools/mingw730_64/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan CMake Wrapper
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: Compiler GCC>=5, checking major version 7.3
-- Conan: Checking correct version: 7.3
-- Conan: C++ stdlib: libstdc++11
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EXPORT_NO_PACKAGE_REGISTRY


-- Build files have been written to: D:/.conan/052d3b/1/build_subfolder
Scanning dependencies of target double-conversion
[ 11%] Building CXX object source_subfolder/CMakeFiles/double-conversion.dir/double-conversion/bignum.cc.obj
[ 33%] Building CXX object source_subfolder/CMakeFiles/double-conversion.dir/double-conversion/bignum-dtoa.cc.obj
[ 33%] Building CXX object source_subfolder/CMakeFiles/double-conversion.dir/double-conversion/cached-powers.cc.obj
[ 44%] Building CXX object source_subfolder/CMakeFiles/double-conversion.dir/double-conversion/diy-fp.cc.obj
[ 55%] Building CXX object source_subfolder/CMakeFiles/double-conversion.dir/double-conversion/double-conversion.cc.obj
[ 66%] Building CXX object source_subfolder/CMakeFiles/double-conversion.dir/double-conversion/fast-dtoa.cc.obj
[ 77%] Building CXX object source_subfolder/CMakeFiles/double-conversion.dir/double-conversion/fixed-dtoa.cc.obj
[ 88%] Building CXX object source_subfolder/CMakeFiles/double-conversion.dir/double-conversion/strtod.cc.obj
[100%] Linking CXX static library ..\lib\libdouble-conversion.a
[100%] Built target double-conversion
double-conversion/3.1.5: Package '3b35a37f78849b878a5d086da27790c957afa6ef' built
double-conversion/3.1.5: Build folder D:\.conan\052d3b\1
double-conversion/3.1.5: Generated conaninfo.txt
double-conversion/3.1.5: Generated conanbuildinfo.txt
double-conversion/3.1.5: Generating the package
double-conversion/3.1.5: Package folder D:\.conan\7bca3b\1
double-conversion/3.1.5: Calling package()
-- Conan CMake Wrapper
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: Compiler GCC>=5, checking major version 7.3
-- Conan: Checking correct version: 7.3
-- Conan: C++ stdlib: libstdc++11
-- Configuring done
-- Generating done
-- Build files have been written to: D:/.conan/052d3b/1/build_subfolder
[100%] Built target double-conversion
Install the project...
-- Install configuration: "Release"
-- Installing: D:/.conan/7bca3b/1/lib/libdouble-conversion.a
-- Installing: D:/.conan/7bca3b/1/include/double-conversion/bignum.h
-- Installing: D:/.conan/7bca3b/1/include/double-conversion/cached-powers.h
-- Installing: D:/.conan/7bca3b/1/include/double-conversion/diy-fp.h
-- Installing: D:/.conan/7bca3b/1/include/double-conversion/double-conversion.h
-- Installing: D:/.conan/7bca3b/1/include/double-conversion/fast-dtoa.h
-- Installing: D:/.conan/7bca3b/1/include/double-conversion/fixed-dtoa.h
-- Installing: D:/.conan/7bca3b/1/include/double-conversion/ieee.h
-- Installing: D:/.conan/7bca3b/1/include/double-conversion/strtod.h
-- Installing: D:/.conan/7bca3b/1/include/double-conversion/utils.h
-- Installing: D:/.conan/7bca3b/1/lib/cmake/double-conversion/double-conversionConfig.cmake
-- Installing: D:/.conan/7bca3b/1/lib/cmake/double-conversion/double-conversionConfigVersion.cmake
-- Installing: D:/.conan/7bca3b/1/lib/cmake/double-conversion/double-conversionTargets.cmake
-- Installing: D:/.conan/7bca3b/1/lib/cmake/double-conversion/double-conversionTargets-release.cmake
double-conversion/3.1.5 package(): Packaged 9 '.h' files
double-conversion/3.1.5 package(): Packaged 1 '.a' file: libdouble-conversion.a
double-conversion/3.1.5 package(): Packaged 1 file: LICENSE
double-conversion/3.1.5: Package '3b35a37f78849b878a5d086da27790c957afa6ef' created
double-conversion/3.1.5: Created package revision 166993e67108e15ee24dd4a63d73d299
sqlite3/3.29.0: Copying sources to build folder
sqlite3/3.29.0: Building your package in D:\.conan\06d9d4\1
sqlite3/3.29.0: Generator cmake created conanbuildinfo.cmake
sqlite3/3.29.0: Calling build()
-- The C compiler identification is GNU 7.3.0
-- Check for working C compiler: C:/Qt/Tools/mingw730_64/bin/gcc.exe
-- Check for working C compiler: C:/Qt/Tools/mingw730_64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- This project seems to be plain C, using 'GNU' compiler
-- Conan: Compiler GCC>=5, checking major version 7.3
-- Conan: Checking correct version: 7.3
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EXPORT_NO_PACKAGE_REGISTRY
    CMAKE_INSTALL_BINDIR
    CMAKE_INSTALL_DATAROOTDIR
    CMAKE_INSTALL_INCLUDEDIR
    CMAKE_INSTALL_LIBDIR
    CMAKE_INSTALL_LIBEXECDIR
    CMAKE_INSTALL_OLDINCLUDEDIR
    CMAKE_INSTALL_SBINDIR
    SQLITE_ENABLE_UNLOCK_NOTIFY


-- Build files have been written to: D:/.conan/06d9d4/1
Scanning dependencies of target sqlite3
[ 50%] Building C object CMakeFiles/sqlite3.dir/source_subfolder/sqlite3.c.obj
[100%] Linking C static library lib\libsqlite3.a
[100%] Built target sqlite3
sqlite3/3.29.0: Package '588b780aca5e9ede0d5e5c41c813abdbe8af63e6' built
sqlite3/3.29.0: Build folder D:\.conan\06d9d4\1
sqlite3/3.29.0: Generated conaninfo.txt
sqlite3/3.29.0: Generated conanbuildinfo.txt
sqlite3/3.29.0: Generating the package
sqlite3/3.29.0: Package folder D:\.conan\023733\1
sqlite3/3.29.0: Calling package()
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- This project seems to be plain C, using 'GNU' compiler
-- Conan: Compiler GCC>=5, checking major version 7.3
-- Conan: Checking correct version: 7.3
-- Configuring done
-- Generating done
-- Build files have been written to: D:/.conan/06d9d4/1
[100%] Built target sqlite3
Install the project...
-- Install configuration: "Release"
-- Installing: D:/.conan/023733/1/lib/libsqlite3.a
-- Installing: D:/.conan/023733/1/include
-- Installing: D:/.conan/023733/1/include/sqlite3.h
-- Installing: D:/.conan/023733/1/include/sqlite3ext.h
sqlite3/3.29.0 package(): Packaged 2 '.h' files: sqlite3.h, sqlite3ext.h
sqlite3/3.29.0 package(): Packaged 1 '.a' file: libsqlite3.a
sqlite3/3.29.0 package(): Packaged 1 file: LICENSE
sqlite3/3.29.0: Package '588b780aca5e9ede0d5e5c41c813abdbe8af63e6' created
sqlite3/3.29.0: Created package revision e7736a4815e1fff5621ff6cbf7de1b9b
zlib/1.2.11: Copying sources to build folder
zlib/1.2.11: Building your package in D:\.conan\8f0332\1
zlib/1.2.11: Generator cmake created conanbuildinfo.cmake
zlib/1.2.11: Calling build()
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: C:/Qt/Tools/mingw730_64/bin/gcc.exe
-- Check for working C compiler: C:/Qt/Tools/mingw730_64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Qt/Tools/mingw730_64/bin/g++.exe
-- Check for working CXX compiler: C:/Qt/Tools/mingw730_64/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan CMake Wrapper
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: Compiler GCC>=5, checking major version 7.3
-- Conan: Checking correct version: 7.3
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Renaming
--     D:/.conan/8f0332/1/source_subfolder/zconf.h
-- to 'zconf.h.included' because this file is included with zlib
-- but CMake generates it automatically in the build directory.
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EXPORT_NO_PACKAGE_REGISTRY
    CMAKE_INSTALL_BINDIR
    CMAKE_INSTALL_DATAROOTDIR
    CMAKE_INSTALL_INCLUDEDIR
    CMAKE_INSTALL_LIBDIR
    CMAKE_INSTALL_LIBEXECDIR
    CMAKE_INSTALL_OLDINCLUDEDIR
    CMAKE_INSTALL_SBINDIR


-- Build files have been written to: D:/.conan/8f0332/1/source_subfolder/_build
Scanning dependencies of target zlibstatic
[  6%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/adler32.obj
[ 25%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/deflate.obj
[ 25%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/crc32.obj
[ 25%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/compress.obj
[ 31%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/gzclose.obj
[ 37%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/gzlib.obj
[ 43%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/gzread.obj
[ 50%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/gzwrite.obj
[ 56%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/inflate.obj
[ 62%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/infback.obj
[ 68%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/inftrees.obj
[ 75%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/inffast.obj
[ 87%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/uncompr.obj
[ 81%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/trees.obj
[ 93%] Building C object source_subfolder/CMakeFiles/zlibstatic.dir/zutil.obj
[100%] Linking C static library ..\lib\libzlibstatic.a
[100%] Built target zlibstatic
zlib/1.2.11: Package '040db29ed48cb6d2bb9f4c6d13e74d5e319c7ad8' built
zlib/1.2.11: Build folder D:\.conan\8f0332\1
zlib/1.2.11: Generated conaninfo.txt
zlib/1.2.11: Generated conanbuildinfo.txt
zlib/1.2.11: Generating the package
zlib/1.2.11: Package folder D:\.conan\160a4a\1
zlib/1.2.11: Calling package()
zlib/1.2.11 package(): Packaged 2 '.h' files: zconf.h, zlib.h
zlib/1.2.11 package(): Packaged 1 '.a' file: libzlib.a
zlib/1.2.11 package(): Packaged 1 file: LICENSE
zlib/1.2.11: Package '040db29ed48cb6d2bb9f4c6d13e74d5e319c7ad8' created
zlib/1.2.11: Created package revision 659ddb8cdafe7ce0fe627c9e2d5635d7
libpq/11.5: Copying sources to build folder
libpq/11.5: Building your package in D:\.conan\626fe3\1
libpq/11.5: Generator txt created conanbuildinfo.txt
libpq/11.5: Calling build()
libpq/11.5: WARN: Error running `configure --help`: Cannot recognize the Windows subsystem, install MSYS2/cygwin or specify a build_require to apply it.
libpq/11.5: Calling:
 > /d/.conan/626fe3/1/source_subfolder/configure --without-readline --with-zlib --without-openssl --prefix=D:/.conan/a06d08/1      
libpq/11.5:
libpq/11.5: ERROR: Package '19bba9ca9ea809d2dbc44f00c9fa42db1eb66ec1' build failed
libpq/11.5: WARN: Build folder D:\.conan\626fe3\1
ERROR: libpq/11.5: Error in build() method, line 113
        autotools = self._configure_autotools()
while calling '_configure_autotools', line 69
        self._autotools.configure(args=args)
        ConanException: Cannot recognize the Windows subsystem, install MSYS2/cygwin or specify a build_require to apply it.

I researched a bit and found that I can add a build requirement to my package by adding a corresponding line to the conanfile.py. So I added the following

    requires = "qt/5.13.2@bincrafters/stable"
    build_requires = "msys2_installer/latest@bincrafters/stable" # added this line
    generators = "cmake"

The logs indicate that msys2 is now a build requirement but for some reason libpq still does not recognize it.

Click to expand log
>conan create . demo/testing --build
Exporting package recipe
my_package/0.0.1@demo/testing: A new conanfile.py version was exported
my_package/0.0.1@demo/testing: Folder: D:\.conan-cache\my_package\0.0.1\demo\testing\export
my_package/0.0.1@demo/testing: Exported revision: 857c315ef6ebe869e806f61d1b6c2510
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=7.3
os=Windows
os_build=Windows
[options]
[build_requires]
[env]
CC=C:\Qt\Tools\mingw730_64\bin\gcc.exe
CXX=C:\Qt\Tools\mingw730_64\bin\g++.exe
bzip2/1.0.8: Forced build from source
double-conversion/3.1.5: Forced build from source
sqlite3/3.29.0: Forced build from source
zlib/1.2.11: Forced build from source
libpq/11.5: Forced build from source
openssl/1.1.1d: Forced build from source
pcre2/10.33: Forced build from source
qt/5.13.2@bincrafters/stable: Forced build from source
my_package/0.0.1@demo/testing: Forced build from source
msys2_installer/20161025@bincrafters/stable: Forced build from source
7z_installer/1.0@conan/stable: Forced build from source
my_package/0.0.1@demo/testing (test package): Installing package
Requirements
    bzip2/1.0.8 from 'conan-center' - Cache
    double-conversion/3.1.5 from 'conan-center' - Cache
    libpq/11.5 from 'conan-center' - Cache
    openssl/1.1.1d from 'conan-center' - Cache
    pcre2/10.33 from 'conan-center' - Cache
    qt/5.13.2@bincrafters/stable from 'bincrafters' - Cache
    my_package/0.0.1@demo/testing from local cache - Cache
    sqlite3/3.29.0 from 'conan-center' - Cache
    zlib/1.2.11 from 'conan-center' - Cache
Packages
    bzip2/1.0.8:93d07331e82e053326d7a22b782c7c69c4eb834f - Build
    double-conversion/3.1.5:3b35a37f78849b878a5d086da27790c957afa6ef - Build
    libpq/11.5:19bba9ca9ea809d2dbc44f00c9fa42db1eb66ec1 - Build
    openssl/1.1.1d:a6fb1a4d2b8dfb2238f5ca24c0b8043a6b8c3445 - Build
    pcre2/10.33:56b9cb25bdfe0d68d0bf112d2ba76808ebde4cb5 - Build
    qt/5.13.2@bincrafters/stable:35d35d211f943d58d067515665fb7d9deead2a7e - Build
    my_package/0.0.1@demo/testing:93898184236b679fb8eaa1d3d0f8278d12bfa199 - Build
    sqlite3/3.29.0:588b780aca5e9ede0d5e5c41c813abdbe8af63e6 - Build
    zlib/1.2.11:040db29ed48cb6d2bb9f4c6d13e74d5e319c7ad8 - Build
Build requirements
    7z_installer/1.0@conan/stable from 'conan-center' - Cache
    msys2_installer/20161025@bincrafters/stable from 'conan-center' - Cache
Build requirements packages
    7z_installer/1.0@conan/stable:60b04a80ac4dd5c23f1acffacc679e9902e636e5 - Build
    msys2_installer/20161025@bincrafters/stable:3cbd862cb7a3ea47ed1220dc027f344262d5224f - Build

[snip]

libpq/11.5: WARN: Build folder is dirty, removing it: D:\.conan\626fe3\1
libpq/11.5: Copying sources to build folder
libpq/11.5: Building your package in D:\.conan\626fe3\1
libpq/11.5: Generator txt created conanbuildinfo.txt
libpq/11.5: Calling build()
libpq/11.5: WARN: Error running `configure --help`: Cannot recognize the Windows subsystem, install MSYS2/cygwin or specify a build_require to apply it.
libpq/11.5: Calling:
 > /d/.conan/626fe3/1/source_subfolder/configure --without-readline --with-zlib --without-openssl --prefix=D:/.conan/a06d08/1      
libpq/11.5:
libpq/11.5: ERROR: Package '19bba9ca9ea809d2dbc44f00c9fa42db1eb66ec1' build failed
libpq/11.5: WARN: Build folder D:\.conan\626fe3\1
ERROR: libpq/11.5: Error in build() method, line 113
        autotools = self._configure_autotools()
while calling '_configure_autotools', line 69
        self._autotools.configure(args=args)
        ConanException: Cannot recognize the Windows subsystem, install MSYS2/cygwin or specify a build_require to apply it.

I finally managed to get libpq compiled by adding the build requirement not to the conanfile.py but to my conan profile. There I can explicitly specify that msys2 is a build requirement of libpq:

...
[build_requires]
libpq/11.5: msys2_installer/latest@bincrafters/stable
...

I tried to do this in the conanfile.py, as well, but that gave me the following error:

ERROR: The reference has too many '/'

However, libpq is not the only package where I need to explicitly specify the build requirement. openssl/1.1.1d (also required by qt) and nasm:1.24 (required by openssl) are also affected by this. So the only way I managed to get the complete build working was to specify the build requirements explicitly in my conan profile:

[build_requires]
libpq/11.5: msys2_installer/latest@bincrafters/stable
openssl/1.1.1d: msys2_installer/latest@bincrafters/stable
nasm/2.14: msys2_installer/latest@bincrafters/stable

Am I doing something wrong regarding build requirements in the conanfile.py or is it not intended to specify them in the same way as in a conan profile? Is there another way how I can specify build requirements I’m not yet aware of?
I hope, I included all of the necessary information. If not, just let me know and I’ll add anything that’s missing.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ericLemanissiercommented, Dec 19, 2019

you could put this in your profile:

[build_requires]
msys2/20190524

so that msys2 build requirement is applied to all the packages. That would be a workaround until libpq, openssl and nasm recipe declare the build_requirement when MinGW is used

0reactions
sinallcommented, Mar 11, 2021

Ok, so this works for me now. When I just add msys2/20190524 as a general build requirement in my profile, as you suggested above, it gets applied to all packages just as one would expect. I must have had a corrupted 7zip package from a previous time when I tried to build it from sources. Removing the package from the local cache and running conan create again, finally solved the issue.

Thanks again for all your help with this 😄

So the problem is still existing? I mean buid_requires only works in profile.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Conan does not detect MinGW gcc - Stack Overflow
SOLUTION 1. using the conan dev packages you can install msys2 or mingw64. Conan has setup some bins you can clone via build...
Read more >
Cross building — conan 1.56.0 documentation
Cross building¶. Cross building (or cross compilation) is the process of generating binaries for a platform that is not the one where the...
Read more >
Downsides to Conan.io? : r/cpp - Reddit
However I recently found Conan.io and it seemed to just work. ... will no longer build with cmake, instead conan is required to...
Read more >
3D Install Qt6 | Qt Forum
ConanException : Error 2 while executing cmake --build . If the Vulkan game DoTA runs, which implies that Vulkan is correctly installed, then...
Read more >
AVs - River Thames Conditions - Environment Agency - GOV.UK
Fiddlesticks mid lane guide, Ananya saha ifim, Labeling inversions music, Nifty live chart rsi, Brain circulation anatomy ppt, Live poll result 2014, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found