Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[package] bzip2/1.0.8: Cannot build with MSVC, seemingly incorrect CMake generator detection #8420

Closed
tkhyn opened this issue Dec 14, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@tkhyn
Copy link
Contributor

tkhyn commented Dec 14, 2021

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: bzip2/1.0.8
  • Operating System+version: Windows 10
  • Compiler+version: msvc 193 (= Visual Studio 2022)
  • Conan version: conan 1.43.0
  • Python version: Python 3.10.1

Conan profile (output of conan profile show default or conan profile show <profile> if custom profile is in use)

[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

Steps to reproduce (Include if Applicable)

cd recipes\bzip2\all
conan create conanfile.py bzip2/1.0.8@ --build=bzip2

Logs (Include/Attach if Applicable)

The build fails on configuring CMake, which uses the `Mingw Makefiles` generator instead of Visual Studio 17 as per the profile. It seems wrong, maybe I am missing a step or have forgotten to setup something? I encountered this issue while trying to update the boost recipe to use the newly released 1.78.0 version.
 D:\dev\lib\conan-center-index\recipes\bzip2\all>conan create conanfile.py bzip2/1.0.8@ --build=bzip2
[HOOK - conan-center.py] pre_export(): [DEPRECATED GLOBAL CPPSTD (KB-H001)] OK
[HOOK - conan-center.py] pre_export(): [REFERENCE LOWERCASE (KB-H002)] OK
[HOOK - conan-center.py] pre_export(): [RECIPE METADATA (KB-H003)] OK
[HOOK - conan-center.py] pre_export(): [HEADER_ONLY, NO COPY SOURCE (KB-H005)] OK
[HOOK - conan-center.py] pre_export(): [FPIC OPTION (KB-H006)] OK
[HOOK - conan-center.py] pre_export(): [VERSION RANGES (KB-H008)] OK
[HOOK - conan-center.py] pre_export(): [RECIPE FOLDER SIZE (KB-H009)] Total recipe size: 66.37890625 KB
[HOOK - conan-center.py] pre_export(): [RECIPE FOLDER SIZE (KB-H009)] OK
[HOOK - conan-center.py] pre_export(): [EXPORT LICENSE (KB-H023)] exports: None
[HOOK - conan-center.py] pre_export(): [EXPORT LICENSE (KB-H023)] exports: ['CMakeLists.txt', 'patches/**']
[HOOK - conan-center.py] pre_export(): [EXPORT LICENSE (KB-H023)] OK
[HOOK - conan-center.py] pre_export(): [TEST PACKAGE FOLDER (KB-H024)] OK
[HOOK - conan-center.py] pre_export(): [META LINES (KB-H025)] OK
[HOOK - conan-center.py] pre_export(): [CONAN CENTER INDEX URL (KB-H027)] OK
[HOOK - conan-center.py] pre_export(): [CMAKE MINIMUM VERSION (KB-H028)] OK
[HOOK - conan-center.py] pre_export(): [TEST PACKAGE - RUN ENVIRONMENT (KB-H029)] OK
[HOOK - conan-center.py] pre_export(): [SYSTEM REQUIREMENTS (KB-H032)] OK
[HOOK - conan-center.py] pre_export(): [CONANDATA.YML FORMAT (KB-H030)] OK
[HOOK - conan-center.py] pre_export(): [TEST PACKAGE - NO IMPORTS() (KB-H034)] OK
[HOOK - conan-center.py] pre_export(): [NO AUTHOR (KB-H037)] OK
[HOOK - conan-center.py] pre_export(): [NO TARGET NAME (KB-H040)] OK
[HOOK - conan-center.py] pre_export(): [NO FINAL ENDLINE (KB-H041)] OK
[HOOK - conan-center.py] pre_export(): [NO REQUIRES.ADD() (KB-H044)] OK
[HOOK - conan-center.py] pre_export(): [DELETE OPTIONS (KB-H045)] OK
[HOOK - conan-center.py] pre_export(): [CMAKE VERBOSE MAKEFILE (KB-H046)] OK
[HOOK - conan-center.py] pre_export(): [CMAKE VERSION REQUIRED (KB-H048)] OK
[HOOK - conan-center.py] pre_export(): [CMAKE WINDOWS EXPORT ALL SYMBOLS (KB-H049)] OK
[HOOK - conan-center.py] pre_export(): [DEFAULT OPTIONS AS DICTIONARY (KB-H051)] OK
[HOOK - conan-center.py] pre_export(): [CONFIG.YML HAS NEW VERSION (KB-H052)] OK
[HOOK - conan-center.py] pre_export(): [PRIVATE IMPORTS (KB-H053)] OK
[HOOK - conan-center.py] pre_export(): [SINGLE REQUIRES (KB-H055)] OK
[HOOK - conan-center.py] pre_export(): [TOOLS RENAME (KB-H057)] OK
[HOOK - conan-center.py] pre_export(): [ILLEGAL CHARACTERS (KB-H058)] OK
[HOOK - conan-center.py] pre_export(): [CLASS NAME (KB-H059)] OK
[HOOK - conan-center.py] pre_export(): ERROR: [NO CRLF (KB-H060)] The file 'test_package.c' uses CRLF. Please, replace by LF. (https://github.com/conan-io/conan-center-index/blob/master/docs/error_knowledge_base.md#KB-H060) 
[HOOK - conan-center.py] pre_export(): [NO BUILD SYSTEM FUNCTIONS (KB-H061)] OK
[HOOK - conan-center.py] pre_export(): WARN: [TOOLS CROSS BUILDING (KB-H062)] The 'tools.cross_building(self.settings)' syntax in D:\dev\lib\conan-center-index\recipes\bzip2\all\test_package\conanfile.py may not work correctly in some scenarios. Consider using tools
.cross_building(self).
[HOOK - conan-center.py] pre_export(): [TOOLS CROSS BUILDING (KB-H062)] OK
[HOOK - conan-center.py] pre_export(): WARN: [INVALID TOPICS (KB-H064)] The topic 'conan' is invalid and should be removed from topics attribute.
[HOOK - conan-center.py] pre_export(): [INVALID TOPICS (KB-H064)] OK
Exporting package recipe
bzip2/1.0.8 exports: File 'conandata.yml' found. Exporting it...
bzip2/1.0.8 exports: Copied 1 '.yml' file: conandata.yml
bzip2/1.0.8 exports_sources: Copied 1 '.txt' file: CMakeLists.txt
bzip2/1.0.8 exports_sources: Copied 1 '.patch' file: 0001-fix-sys-stat-include.patch
[HOOK - conan-center.py] post_export(): [CONANDATA.YML REDUCE (KB-H031)] Saving conandata.yml: {'sources': {'1.0.8': {'url': 'https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz', 'sha256': 'ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269'}}}       
[HOOK - conan-center.py] post_export(): [CONANDATA.YML REDUCE (KB-H031)] New conandata.yml contents: sources:
  1.0.8:
    sha256: ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269
    url: https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz

[HOOK - conan-center.py] post_export(): [CONANDATA.YML REDUCE (KB-H031)] OK
[HOOK - conan-center.py] post_export(): [DEFAULT SHARED OPTION VALUE (KB-H050)] OK
[HOOK - conan-center.py] post_export(): [LICENSE PUBLIC DOMAIN (KB-H056)] OK
bzip2/1.0.8: A new conanfile.py version was exported
bzip2/1.0.8: Folder: D:\dev\.conan\data\bzip2\1.0.8\_\_\export
bzip2/1.0.8: Using the exported files summary hash as the recipe revision: a8210c6edbe554578ad1944e23c9b324 
bzip2/1.0.8: Exported revision: a8210c6edbe554578ad1944e23c9b324
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

bzip2/1.0.8: Forced build from source
bzip2/1.0.8 (test package): Installing package
Requirements
    bzip2/1.0.8 from local cache - Cache
Packages
    bzip2/1.0.8:8225dbb52b22259f8b88b3bddfc249d0262dd87a - Build

Installing (downloading, building) binaries...
[HOOK - conan-center.py] pre_source(): [IMMUTABLE SOURCES (KB-H010)] OK
bzip2/1.0.8: Configuring sources in D:\dev\.conan\data\bzip2\1.0.8\_\_\source
Downloading bzip2-1.0.8.tar.gz completed [791.04k]                                       

[HOOK - conan-center.py] post_source(): [LIBCXX MANAGEMENT (KB-H011)] OK
[HOOK - conan-center.py] post_source(): [CPPSTD MANAGEMENT (KB-H022)] OK
bzip2/1.0.8: Copying sources to build folder
bzip2/1.0.8: Building your package in D:\dev\.conan\data\bzip2\1.0.8\_\_\build\8225dbb52b22259f8b88b3bddfc249d0262dd87a
bzip2/1.0.8: Generator cmake created conanbuildinfo.cmake
bzip2/1.0.8: Aggregating env generators
[HOOK - conan-center.py] pre_build(): [FPIC MANAGEMENT (KB-H007)] 'fPIC' option not found
[HOOK - conan-center.py] pre_build(): [FPIC MANAGEMENT (KB-H007)] OK
bzip2/1.0.8: Calling build()
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
bzip2/1.0.8: 
bzip2/1.0.8: ERROR: Package '8225dbb52b22259f8b88b3bddfc249d0262dd87a' build failed
bzip2/1.0.8: WARN: Build folder D:\dev\.conan\data\bzip2\1.0.8\_\_\build\8225dbb52b22259f8b88b3bddfc249d0262dd87a
ERROR: bzip2/1.0.8: Error in build() method, line 63
        cmake = self._configure_cmake()
while calling '_configure_cmake', line 57
        self._cmake.configure()
        ConanException: Error 1 while executing cd D:\dev\.conan\data\bzip2\1.0.8\_\_\build\8225dbb52b22259f8b88b3bddfc249d0262dd87a && cmake -G "MinGW Makefiles" -DCONAN_LINK_RUNTIME="/dynamic" -DCMAKE_BUILD_TYPE="Release" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPIL
ER="msvc" -DCONAN_COMPILER_VERSION="193" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="D:\dev\.conan\data\bzip2\1.0.8\_\_\package\8225dbb52b22259f8b88b3bddfc249d0262dd87a" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin
" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -DBZ2_VERSION_STRING="1.0.8" -DBZ2_VERSION_MAJOR="1" -DBZ2_BU
ILD_EXE="True" -Wno-dev D:\dev\.conan\data\bzip2\1.0.8\_\_\build\8225dbb52b22259f8b88b3bddfc249d0262dd87a
@tkhyn tkhyn added the bug Something isn't working label Dec 14, 2021
@SpaceIm
Copy link
Contributor

SpaceIm commented Dec 14, 2021

Set CC and CXX to cl.exe in your profile. CMake is confused because you have several compilers in your path.

Anyway, compiler=msvc is not properly supported yet in CCI recipes. compiler=Visual Studio is still recommended.

@tkhyn
Copy link
Contributor Author

tkhyn commented Dec 14, 2021

Thanks for your quick reply.

Set CC and CXX to cl.exe in your profile. CMake is confused because you have several compilers in your path.

Sorry, I forgot to mention I had done that previously and it did not make a difference. I regenerated the profile using --detect and forgot the CC / CXX environment variables weren't added automatically.

Anyway, compiler=msvc is not properly supported yet in CCI recipes.

Copy, it looks like compiler=Visual Studio and compiler.version=17 don't work either. What is needed to support VS2022? Does it require updates on the conan client side?

@SpaceIm
Copy link
Contributor

SpaceIm commented Dec 14, 2021

[settings]
os=Windows
arch=x86_64
compiler=Visual Studio
compiler.version=17
build_type=Release
[options]
[build_requires]
[env]
CC=cl.exe
CXX=cl.exe

It works on my computer, and I have also MinGW.

@tkhyn
Copy link
Contributor Author

tkhyn commented Dec 14, 2021

Found the issue: I had to update my system cmake to allow Visual Studio 17 2022 generator to be recognised. Works now, thanks a lot!

By any chance, would you know if there is a way to cue --detect to generate a Visual Studio profile rather than msvc ?

@SSE4
Copy link
Contributor

SSE4 commented Dec 14, 2021

By any chance, would you know if there is a way to cue --detect to generate a Visual Studio profile rather than msvc ?

it was changed specifically that --detect always usesmsvc compiler for Visual Studio 2022 and later. since Visual Studio compiler is getting deprecated in 2.0, it's no longer recommended. you still can compose profile manually, though.

@SpaceIm
Copy link
Contributor

SpaceIm commented Dec 14, 2021

msvc is recommended, but none CCI recipe supports it 😐

@SSE4
Copy link
Contributor

SSE4 commented Dec 14, 2021

msvc is recommended, but none CCI recipe supports it 😐

once we add Visual Studio 2022, it will be msvc in CCI for sure

@tkhyn
Copy link
Contributor Author

tkhyn commented Dec 14, 2021

you still can compose profile manually, though.

Yeah I wanted to avoid that as in my case the profile is automatically generated, but if it's temporary I can afford handling the VS2022 case separately with a few conan profile update commands for now

once we add Visual Studio 2022, it will be msvc in CCI for sure

Great, I'll watch this space!

I guess that issue can be closed. Sorry for my naive questions, I used conan a few years ago and did not really keep up with the latest developments...

@tkhyn tkhyn closed this as completed Dec 14, 2021
@SpaceIm
Copy link
Contributor

SpaceIm commented Dec 14, 2021

#6155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants