Open radiofan opened 3 months ago
Hi @radiofan, I've just opened https://github.com/conan-io/conan-center-index/pull/24962 When this gets merged this problem should be solved.
Thank you, good catch!
You are cool, but it's a pity they rejected the fix
@radiofan I guess there is a misconfiguration in your case, I don't see the need to using a cmake user preset injected to your profile to this case. For instance the recommended profile for mingw on Windows is different from yours: https://docs.conan.io/2/examples/dev_flow/tool_requires/mingw.html
So, adapting it to use in Linux, the host profile should look:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.exception=sjlj
compiler.libcxx=libstdc++11
compiler.threads=posix
compiler.version=10
os=Windows
[conf]
tools.build:compiler_executables={'c': '/usr/bin/x86_64-w64-mingw32-gcc-10', 'cpp': '/usr/bin/x86_64-w64-mingw32-g++'}
I can build without errors: https://gist.github.com/uilianries/f55896b641abbafc16b1c2d2eb2f4895
Then, in order to run cmake --preset conan-release
, you need a CMakeLists.txt (not listed in this issue).
If you need to inject more variables, you could use Conan config directly in your profile as well.
https://docs.conan.io/2/reference/config_files/global_conf.html
tools.build:cflags=["-static"]
tools.build:cxxflags=["-static"]
Could you please check if this solution fits your case?
Sorry, I dropped out of work a little bit. Thank you, i check this solution as soon as I can.
Hello, @uilianries , thank you for your answer. I tried to use your configuration, it not help to build. I get same error when cmake --preset
:
CMake Error at build/Release/generators/cmakedeps_macros.cmake:67 (message):
Library 'SDL2_image-static' not found in package. If 'SDL2_image-static'
is a system library, declare it with 'cpp_info.system_libs' property
Call Stack (most recent call first):
build/Release/generators/SDL2_image-Target-release.cmake:23 (conan_package_library_targets)
build/Release/generators/SDL2_imageTargets.cmake:28 (include)
build/Release/generators/SDL2_imageConfig.cmake:16 (include)
CMakeLists.txt:28 (find_package)
@RADIOFAN, could you please share your entire build using the solution that I proposed before? Including profiles and CMakeLists.txt (partially) if possible. As I commented before, it's working for me™, but there is a difference between our environments for sure that's resulting in your error, probably a small detail that we are missing.
Description
Hello. I try build program with static sdl_image/2.6.3 by MinGW on Arch Linux for Windows. Conan packets are installed successfully, but cmake preset failed. CMake try find sdl_image-static, because Conan think that my OS is Windows. https://github.com/conan-io/conan-center-index/blob/4f3d305b303c56e4c8537f620c6a9b4e6437783c/recipes/sdl_image/all/conanfile.py#L203-L204
Correcting
self.settings.os == "Windows"
toself.settings_build.os == "Windows"
solves the problem. This work with MinGW and MSVC.Package and Environment Details
Conan profile
Build profile:
win-mingw.jinja:
win-mingw.cmake:
conanfile.py:
Steps to reproduce
Logs
Conan install log
``` WARN: legacy: Unscoped option definition is ambiguous. Use '&:BOARD=HOST' to refer to the current package. Use '*:BOARD=HOST' or other pattern if the intent was to apply to dependencies ======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Release compiler=gcc compiler.cppstd=20 compiler.libcxx=libstdc++11 compiler.version=13 os=Windows [options] BOARD=HOST [conf] tools.cmake.cmaketoolchain:user_toolchain=['win-mingw.cmake'] [buildenv] CMAKE_TOOLCHAIN_FILE=win-mingw.cmake Profile build: [settings] arch=x86_64 build_type=Release compiler=gcc compiler.cppstd=gnu17 compiler.libcxx=libstdc++11 compiler.version=14 os=Linux ======== Computing dependency graph ======== boost/1.84.0: Not found in local cache, looking in remotes... boost/1.84.0: Checking remote: conancenter boost/1.84.0: Downloaded recipe revision 85fab16ba3b744074ca9733d2ed5fe5a libiconv/1.17: Not found in local cache, looking in remotes... libiconv/1.17: Checking remote: conancenter libiconv/1.17: Downloaded recipe revision 9d9082101394d053c67e95d3bc9f1e78 sdl/2.28.5: Not found in local cache, looking in remotes... sdl/2.28.5: Checking remote: conancenter sdl/2.28.5: Downloaded recipe revision e1be2b96f805dd72b290e34727b86428 cmake/3.30.0: Not found in local cache, looking in remotes... cmake/3.30.0: Checking remote: conancenter cmake/3.30.0: Downloaded recipe revision b93985853f6298c398c76dd4c2ac02a2 sdl_image/2.6.3: Not found in local cache, looking in remotes... sdl_image/2.6.3: Checking remote: conancenter sdl_image/2.6.3: Downloaded recipe revision 52a97d235594273a10267a0ca5b3f9ec libpng/1.6.43: Not found in local cache, looking in remotes... libpng/1.6.43: Checking remote: conancenter libpng/1.6.43: Downloaded recipe revision c219d8f01983bac10c404fc613605eef zlib/1.3.1: Not found in local cache, looking in remotes... zlib/1.3.1: Checking remote: conancenter zlib/1.3.1: Downloaded recipe revision f52e03ae3d251dec704634230cd806a2 Graph root conanfile.py (project/None): /conanfile.py Requirements boost/1.84.0#85fab16ba3b744074ca9733d2ed5fe5a - Downloaded (conancenter) libiconv/1.17#9d9082101394d053c67e95d3bc9f1e78 - Downloaded (conancenter) libpng/1.6.43#c219d8f01983bac10c404fc613605eef - Downloaded (conancenter) sdl/2.28.5#e1be2b96f805dd72b290e34727b86428 - Downloaded (conancenter) sdl_image/2.6.3#52a97d235594273a10267a0ca5b3f9ec - Downloaded (conancenter) zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Downloaded (conancenter) Build requirements cmake/3.30.0#b93985853f6298c398c76dd4c2ac02a2 - Downloaded (conancenter) Resolved version ranges cmake/[>3.27 <4]: cmake/3.30.0 cmake/[>=3.16 <4]: cmake/3.30.0 libpng/[>=1.6 <2]: libpng/1.6.43 zlib/[>=1.2.11 <2]: zlib/1.3.1 Overrides sdl/2.28.3: ['sdl/2.28.5'] ======== Computing necessary packages ======== Requirements boost/1.84.0#85fab16ba3b744074ca9733d2ed5fe5a:da39a3ee5e6b4b0d3255bfef95601890afd80709#4d8e4eaa714ea2a7038d012658db0946 - Download (conancenter) libiconv/1.17#9d9082101394d053c67e95d3bc9f1e78:74fce2c720f804facc619f996bab77ff99796c4d - Build libpng/1.6.43#c219d8f01983bac10c404fc613605eef:cf51190da154c41f82d86a4f8b509d2cd71c2952 - Build sdl/2.28.5#e1be2b96f805dd72b290e34727b86428:e0cfb1d31a8ee3e04d68bd0fec7a1c85c8459b0c - Build sdl_image/2.6.3#52a97d235594273a10267a0ca5b3f9ec:27acdfab78522b010a679b10b58ccac2d8119b6d - Build zlib/1.3.1#f52e03ae3d251dec704634230cd806a2:74fce2c720f804facc619f996bab77ff99796c4d - Build Build requirements cmake/3.30.0#b93985853f6298c398c76dd4c2ac02a2:63fead0844576fc02943e16909f08fcdddd6f44b#d7d754a5f57bf0f76caef273545cfd89 - Download (conancenter) ======== Installing packages ======== -------- Downloading 2 packages -------- ... ======== Finalizing install (deploy, generators) ======== conanfile.py (project/None): Writing generators to /build/Release/generators conanfile.py (project/None): Generator 'CMakeDeps' calling 'generate()' conanfile.py (project/None): CMakeDeps necessary find_package() and targets for your CMakeLists.txt find_package(Boost) find_package(SDL2_image) find_package(SDL2) find_package(Iconv) target_link_libraries(... boost::boost SDL2_image::SDL2_image SDL2::SDL2main Iconv::Iconv) conanfile.py (project/None): Calling generate() conanfile.py (project/None): Generators folder: /build/Release/generators conanfile.py (project/None): CMakeToolchain generated: conan_toolchain.cmake conanfile.py (project/None): CMakeToolchain: Preset 'conan-release' added to CMakePresets.json. (cmake>=3.23) cmake --preset conan-release (cmake<3.23) cmakecmake preset log
``` Preset CMake variables: CMAKE_BUILD_TYPE="Release" CMAKE_POLICY_DEFAULT_CMP0091="NEW" CMAKE_TOOLCHAIN_FILE:FILEPATH="generators/conan_toolchain.cmake" Preset environment variables: CMAKE_TOOLCHAIN_FILE="win-mingw.cmake" -- Using Conan toolchain: /build/Release/generators/conan_toolchain.cmake -- Conan toolchain: C++ Standard 20 with extensions OFF -- Conan: Component target declared 'Boost::headers' -- Conan: Component target declared 'Boost::boost' -- Conan: Target declared 'boost::boost' -- Conan: Component target declared 'SDL2::SDL2' -- Conan: Component target declared 'SDL2::SDL2main' -- Conan: Target declared 'Iconv::Iconv' -- Conan: Component target declared 'SDL2_image::SDL2_image' CMake Error at build/Release/generators/cmakedeps_macros.cmake:67 (message): Library 'SDL2_image-static' not found in package. If 'SDL2_image-static' is a system library, declare it with 'cpp_info.system_libs' property Call Stack (most recent call first): build/Release/generators/SDL2_image-Target-release.cmake:23 (conan_package_library_targets) build/Release/generators/SDL2_imageTargets.cmake:28 (include) build/Release/generators/SDL2_imageConfig.cmake:16 (include) CMakeLists.txt:28 (find_package) -- Configuring incomplete, errors occurred! ```