conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
7.95k stars 951 forks source link

[bug] MSVC build issue not reproduceable on linux #16492

Closed sav-chris closed 5 days ago

sav-chris commented 2 weeks ago

Describe the bug

All the details are described here: https://stackoverflow.com/questions/78615645/installing-cgal-using-conan-io

How to reproduce it

The Stack overflow link contains scripts showing how to reproduce the issue

sav-chris commented 2 weeks ago

conanfile.txt

[requires]
cgal/5.6.1
[generators]
CMakeDeps
CMakeToolchain
[layout]
cmake_layout

CMakeLists.txt

cmake_minimum_required(VERSION 3.29)
project(example)

find_package(CGAL REQUIRED)

add_executable(${PROJECT_NAME} src/hull.cpp)
target_link_libraries(${PROJECT_NAME} CGAL::CGAL )

conan install . --output-folder=build --build=missing

memsharded commented 2 weeks ago

Hi @sav-chris

Thanks for your report.

conan install . --output-folder=build --build=missing

If you are using the cmake_layout, do not use the --output-folder argument, this not necessary and creates a redundant nested "build" folder.

The error that seems to happen in https://stackoverflow.com/questions/78615645/installing-cgal-using-conan-io is that boost was still not ready to be built with the latest VS 2022 update, the 17.10 update. The boost library build system b2 got some recent changes and released a new b2/5.2.0 version. With this version it should be possible to build it.

Please clean your boost package from your cache and try again:

conan remove "boost*" -c
conan install . 

I have just tested this with my current profile (note the version of compiler.version for VS 17.10 update is compiler.version=194):

[settings]                   
arch=x86_64                  
build_type=Release           
compiler=msvc                
compiler.cppstd=14           
compiler.runtime=dynamic     
compiler.runtime_type=Release
compiler.version=194         
os=Windows                  

And it install without having to build anything from source, so without --build=missing it also works.

Please try that and let us know.

sav-chris commented 1 week ago

image

Looks like I don't have compiler.version=194

I tried setting compiler.version=193


conan install . 

======== Input profiles ========
Profile host:     
[settings]        
arch=x86_64       
build_type=Release
compiler=msvc     
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
[conf]
tools.files.download:verify=False

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
[conf]
tools.files.download:verify=False

======== Computing dependency graph ========
Graph root
    conanfile.txt: C:\archive\programming\C++\bug\conanfile.txt
Requirements
    boost/1.83.0#26a5100d8e5011c6771a0e03d404397c - Cache
    bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4 - Cache
    cgal/5.6.1#adce769ac280b52840ed3563b4cee52a - Cache
    eigen/3.4.0#2e192482a8acff96fe34766adca2b24c - Cache
    gmp/6.3.0#df20ffb6d21c34d67704305bcd1dea9e - Cache
    mpfr/4.2.1#9387ed9b72866b2dda9690b287def172 - Cache
    zlib/1.2.11#fca992a7d96a1b92bd956caa8a97d18f - Cache
Build requirements
    autoconf/2.71#f9307992909d7fb3df459340f1932809 - Cache
    automake/1.16.5#058bda3e21c36c9aa8425daf3c1faf50 - Cache
    b2/5.2.1#91bc73931a0acb655947a81569ed8b80 - Cache
    m4/1.4.19#b38ced39a01e31fef5435bc634461fd2 - Cache
    msys2/cci.latest#5a31efa2bde593541fd5ac3bcc50c01c - Cache
    yasm/1.3.0#fb800a15413dca19bfaef9e4b5d50694 - Cache
Resolved version ranges
    b2/[>=5.2 <6]: b2/5.2.1
    zlib/[>=1.2.11 <2]: zlib/1.2.11

======== Computing necessary packages ========
boost/1.83.0: Checking 3 compatible configurations
boost/1.83.0: Compatible configurations not found in cache, checking servers
boost/1.83.0: '3704e86ea3b676c78b148f286f95e66f9e33c849': compiler.cppstd=17
boost/1.83.0: '0146877bf063af920c4c51d9218cc9b7230dbca6': compiler.cppstd=20
boost/1.83.0: 'f147c12bd86a7f2ce9ff2bf34b71689138aea72e': compiler.cppstd=23
Requirements
    boost/1.83.0#26a5100d8e5011c6771a0e03d404397c:3becda85e285acf424c7e0743f5974d5b1669ddc - Missing
    bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4:67bfcb7b4b78262b9d05495e479dcd92f747316b#cea9c0f0dfa41e83aebd5d39c5a5cbf3 - Cache
    cgal/5.6.1#adce769ac280b52840ed3563b4cee52a:da39a3ee5e6b4b0d3255bfef95601890afd80709#6c41a0f1ab2f92be588bbca7d3cb0070 - Cache
    eigen/3.4.0#2e192482a8acff96fe34766adca2b24c:da39a3ee5e6b4b0d3255bfef95601890afd80709#b2e7c2d86c5d1dbefc534889aa72e12c - Cache
    gmp/6.3.0#df20ffb6d21c34d67704305bcd1dea9e:deeb86d617ccfdc956de72096fc3225aebe5b266#c5d497c392ea453fb070f1e9319e68cf - Cache
    mpfr/4.2.1#9387ed9b72866b2dda9690b287def172:8306b040b04c609be10d1d4aee729c5b80267dd4#857ce021033d851482bde03a6d24b1a2 - Cache
    zlib/1.2.11#fca992a7d96a1b92bd956caa8a97d18f:7bfde258ff4f62f75668d0896dbddedaa7480a0f#cbbc6789c50217b730b84a1dfe10d8a2 - Cache
Build requirements
Skipped binaries
    autoconf/2.71, automake/1.16.5, b2/5.2.1, m4/1.4.19, msys2/cci.latest, yasm/1.3.0
ERROR: Missing binary: boost/1.83.0:3becda85e285acf424c7e0743f5974d5b1669ddc

boost/1.83.0: WARN: Can't find a 'boost/1.83.0' package binary '3becda85e285acf424c7e0743f5974d5b1669ddc' for the configuration:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
[options]
asio_no_deprecated=False
bzip2=True
diagnostic_definitions=False
error_code_header_only=False
filesystem_no_deprecated=False
filesystem_use_std_fs=False
header_only=False
i18n_backend_iconv=off
i18n_backend_icu=False
layout=system
lzma=False
magic_autolink=False
multithreading=True
namespace=boost
namespace_alias=False
numa=True
segmented_stacks=False
shared=False
system_no_deprecated=False
system_use_utf8=False
visibility=hidden
without_atomic=False
without_chrono=False
without_container=False
without_context=False
without_contract=False
without_coroutine=False
without_date_time=False
without_exception=False
without_fiber=False
without_filesystem=False
without_graph=False
without_graph_parallel=True
without_iostreams=False
without_json=False
without_locale=False
without_log=False
without_math=False
without_mpi=True
without_nowide=False
without_program_options=False
without_python=True
without_random=False
without_regex=False
without_serialization=False
without_stacktrace=False
without_system=False
without_test=False
without_thread=False
without_timer=False
without_type_erasure=False
without_url=False
without_wave=False
zlib=True
zstd=False
[requires]
bzip2/1.0.Z
zlib/1.2.Z

ERROR: Missing prebuilt package for 'boost/1.83.0'. You can try:
    - List all available packages using 'conan list boost/1.83.0:* -r=remote'
    - Explain missing binaries: replace 'conan install ...' with 'conan graph explain ...'
    - Try to build locally from sources using the '--build=boost/1.83.0' argument

More Info at 'https://docs.conan.io/2/knowledge/faq.html#error-missing-prebuilt-package'
sav-chris commented 1 week ago

if I include the option --build=missing I get this error

conan install . --build=missing

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release    
compiler.version=193
os=Windows
[conf]
tools.files.download:verify=False

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release    
compiler.version=193
os=Windows
[conf]
tools.files.download:verify=False

======== Computing dependency graph ========
Graph root
    conanfile.txt: C:\archive\programming\C++\bug\conanfile.txt
Requirements
    boost/1.83.0#26a5100d8e5011c6771a0e03d404397c - Cache
    bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4 - Cache
    cgal/5.6.1#adce769ac280b52840ed3563b4cee52a - Cache
    eigen/3.4.0#2e192482a8acff96fe34766adca2b24c - Cache
    gmp/6.3.0#df20ffb6d21c34d67704305bcd1dea9e - Cache
    mpfr/4.2.1#9387ed9b72866b2dda9690b287def172 - Cache
    zlib/1.2.11#fca992a7d96a1b92bd956caa8a97d18f - Cache
Build requirements
    autoconf/2.71#f9307992909d7fb3df459340f1932809 - Cache
    automake/1.16.5#058bda3e21c36c9aa8425daf3c1faf50 - Cache
    b2/5.2.1#91bc73931a0acb655947a81569ed8b80 - Cache
    m4/1.4.19#b38ced39a01e31fef5435bc634461fd2 - Cache
    msys2/cci.latest#5a31efa2bde593541fd5ac3bcc50c01c - Cache
    yasm/1.3.0#fb800a15413dca19bfaef9e4b5d50694 - Cache
Resolved version ranges
    b2/[>=5.2 <6]: b2/5.2.1
    zlib/[>=1.2.11 <2]: zlib/1.2.11

======== Computing necessary packages ========
boost/1.83.0: Checking 3 compatible configurations
boost/1.83.0: Compatible configurations not found in cache, checking servers
boost/1.83.0: '3704e86ea3b676c78b148f286f95e66f9e33c849': compiler.cppstd=17
boost/1.83.0: '0146877bf063af920c4c51d9218cc9b7230dbca6': compiler.cppstd=20
boost/1.83.0: 'f147c12bd86a7f2ce9ff2bf34b71689138aea72e': compiler.cppstd=23
Requirements
    boost/1.83.0#26a5100d8e5011c6771a0e03d404397c:3becda85e285acf424c7e0743f5974d5b1669ddc - Build
    bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4:67bfcb7b4b78262b9d05495e479dcd92f747316b#cea9c0f0dfa41e83aebd5d39c5a5cbf3 - Cache
    cgal/5.6.1#adce769ac280b52840ed3563b4cee52a:da39a3ee5e6b4b0d3255bfef95601890afd80709#6c41a0f1ab2f92be588bbca7d3cb0070 - Cache
    eigen/3.4.0#2e192482a8acff96fe34766adca2b24c:da39a3ee5e6b4b0d3255bfef95601890afd80709#b2e7c2d86c5d1dbefc534889aa72e12c - Cache
    gmp/6.3.0#df20ffb6d21c34d67704305bcd1dea9e:deeb86d617ccfdc956de72096fc3225aebe5b266#c5d497c392ea453fb070f1e9319e68cf - Cache
    mpfr/4.2.1#9387ed9b72866b2dda9690b287def172:8306b040b04c609be10d1d4aee729c5b80267dd4#857ce021033d851482bde03a6d24b1a2 - Cache
    zlib/1.2.11#fca992a7d96a1b92bd956caa8a97d18f:7bfde258ff4f62f75668d0896dbddedaa7480a0f#cbbc6789c50217b730b84a1dfe10d8a2 - Cache
Build requirements
    b2/5.2.1#91bc73931a0acb655947a81569ed8b80:522dcea5982a3f8a5b624c16477e47195da2f84f#5f19dadaa36632e4f4999a053c9edf2c - Download (conancenter)
Skipped binaries
    autoconf/2.71, automake/1.16.5, m4/1.4.19, msys2/cci.latest, yasm/1.3.0

======== Installing packages ========

-------- Downloading 1 package --------
b2/5.2.1: Retrieving package 522dcea5982a3f8a5b624c16477e47195da2f84f from remote 'conancenter'
b2/5.2.1: Package installed 522dcea5982a3f8a5b624c16477e47195da2f84f
b2/5.2.1: Downloaded package revision 5f19dadaa36632e4f4999a053c9edf2c
bzip2/1.0.8: Already installed! (2 of 8)
eigen/3.4.0: Already installed! (3 of 8)
zlib/1.2.11: Already installed! (4 of 8)
gmp/6.3.0: Already installed! (5 of 8)
boost/1.83.0: Sources downloaded from 'conancenter'
boost/1.83.0: Calling source() in C:\Users\savini\.conan2\p\boost43b5efc49a319\s\src
boost/1.83.0: Downloading 122.9MB boost_1_83_0.tar.bz2
boost/1.83.0: Downloaded 96.7MB 78% boost_1_83_0.tar.bz2
boost/1.83.0: Apply patch (conan): Optional flag to specify iconv from either libc of libiconv
boost/1.83.0: Apply patch (official): Fix compilation on windows when NOMINMAX is not defined

-------- Installing package boost/1.83.0 (6 of 8) --------
boost/1.83.0: Building from source
boost/1.83.0: Package boost/1.83.0:3becda85e285acf424c7e0743f5974d5b1669ddc
boost/1.83.0: Building your package in C:\Users\savini\.conan2\p\b\boost83cea14074d13\b
boost/1.83.0: Calling generate()
boost/1.83.0: Generators folder: C:\Users\savini\.conan2\p\b\boost83cea14074d13\b\build-release\conan
boost/1.83.0: Generating aggregated env files
boost/1.83.0: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
boost/1.83.0: Calling build()
boost/1.83.0: WARN: replace_in_file didn't find pattern '/* thread_local */' in 'C:\Users\savini\.conan2\p\boost43b5efc49a319\s\src\boost\stacktrace\detail\libbacktrace_impls.hpp' file.
boost/1.83.0: WARN: replace_in_file didn't find pattern '/* static __thread */' in 'C:\Users\savini\.conan2\p\boost43b5efc49a319\s\src\boost\stacktrace\detail\libbacktrace_impls.hpp' file.
boost/1.83.0: WARN: replace_in_file didn't find pattern 'local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux ] ;' in 'C:\Users\savini\.conan2\p\boost43b5efc49a319\s\src\tools\build\src\tools\gcc.jam' file.
boost/1.83.0: WARN: replace_in_file didn't find pattern 'local no-threading = android beos haiku sgi darwin vxworks ;' in 'C:\Users\savini\.conan2\p\boost43b5efc49a319\s\src\tools\build\src\tools\gcc.jam' file.
boost/1.83.0: WARN: Patching user-config.jam
boost/1.83.0: WARN: 
using zlib : 1.2.11 : <include>"C:/Users/savini/.conan2/p/zlib2d61c477734e9/p/include" <search>"C:/Users/savini/.conan2/p/zlib2d61c477734e9/p/lib" <name>zlib ;
using bzip2 : 1.0.8 : <include>"C:/Users/savini/.conan2/p/bzip2e06444d88ab4f/p/include" <search>"C:/Users/savini/.conan2/p/bzip2e06444d88ab4f/p/lib" <name>bz2 ;
using "msvc" : 14.3 :  :
 ;
boost/1.83.0: WARN: b2 -q numa=on target-os=windows architecture=x86 address-model=64 binary-format=pe abi=ms --layout=system --user-config=C:\Users\savini\.conan2\p\boost43b5efc49a319\s\src\tools\build\user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=off --disable-iconv runtime-link=shared runtime-debugging=off threading=multi visibility=hidden link=static variant=release --with-atomic 
--with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-url --with-wave toolset=msvc cxxstd=14 pch=on linkflags="" cxxflags="-fPIC" install --prefix=C:\Users\savini\.conan2\p\b\boost83cea14074d13\p -j24 --abbreviate-paths -d0 --debug-configuration --build-dir="C:\Users\savini\.conan2\p\b\boost83cea14074d13\b\build-release"
boost/1.83.0: RUN: b2 -q numa=on target-os=windows architecture=x86 address-model=64 binary-format=pe abi=ms --layout=system --user-config=C:\Users\savini\.conan2\p\boost43b5efc49a319\s\src\tools\build\user-config.jam -sNO_ZLIB=0 
-sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=off --disable-iconv runtime-link=shared runtime-debugging=off threading=multi visibility=hidden link=static variant=release --with-atomic --with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-url --with-wave toolset=msvc cxxstd=14 pch=on linkflags="" cxxflags="-fPIC" install --prefix=C:\Users\savini\.conan2\p\b\boost83cea14074d13\p -j24 --abbreviate-paths -d0 --debug-configuration --build-dir="C:\Users\savini\.conan2\p\b\boost83cea14074d13\b\build-release"
conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - winsdk_version=None - vcvars_ver=14.3
[ERROR:vcvars.bat] Toolset directory for version '14.3' was not found.
[ERROR:VsDevCmd.bat] *** VsDevCmd.bat encountered errors. Environment may be incomplete and/or incorrect. ***
[ERROR:VsDevCmd.bat] In an uninitialized command prompt, please 'set VSCMD_DEBUG=[value]' and then re-run
[ERROR:VsDevCmd.bat] vsdevcmd.bat [args] for additional details.
[ERROR:VsDevCmd.bat] Where [value] is:
[ERROR:VsDevCmd.bat]    1 : basic debug logging
[ERROR:VsDevCmd.bat]    2 : detailed debug logging
[ERROR:VsDevCmd.bat]    3 : trace level logging. Redirection of output to a file when using this level is recommended.
[ERROR:VsDevCmd.bat] Example: set VSCMD_DEBUG=3
[ERROR:VsDevCmd.bat]          vsdevcmd.bat > vsdevcmd.trace.txt 2>&1

boost/1.83.0: ERROR: 
Package '3becda85e285acf424c7e0743f5974d5b1669ddc' build failed
boost/1.83.0: WARN: Build folder C:\Users\savini\.conan2\p\b\boost83cea14074d13\b\build-release
ERROR: boost/1.83.0: Error in build() method, line 1130
        self.run(full_command)
        ConanException: Error 1 while executing
sav-chris commented 1 week ago

I've installed visual studio 2022

I've managed to get my program working on Linux, so I'm happy for you to close this ticket. However, if it is useful to you, feel free to keep it open.

I hope the information in it is helpful

Thanks for the help

memsharded commented 1 week ago

Quick question, what is your Conan version?

It seems your settings.yml haven't been updated, so maybe you aren't in the latest Conan or you have manually modified the settings.yml and they haven't been updated.

If you are using the latest VS 2022 (update 17.10, the correct compiler.version=194, so forcing a downgrade to 193 could be the main issue).

sav-chris commented 6 days ago

This is my version image

Looks like it's not the latest version

memsharded commented 5 days ago

The latest MSVC version needs the latest Conan, please update Conan to latest 2.4.1 and try again (we don't maintain the winget package, so we cannot update it. Please try with the pip installer.

sav-chris commented 5 days ago

That seems to be working better thanks :)