conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
942 stars 1.7k forks source link

[package] cmake/*: Separate recipes for from-source builds don't work in shared repos #16607

Open datalogics-kam opened 1 year ago

datalogics-kam commented 1 year ago

Description

16503 changed the CMake recipe to download binaries from KitWare for macOS, Linux, and Windows, which is a welcome change. It also preserved the from-source recipes, which was also nice.

I've been working to get the new recipes up on our Solaris machine, and ran into a few problems. I can make a CMake just fine, but...

I think it would work a lot better if there were one recipe that figured out what to do based on the OS, or via an option or conf variable, and either downloaded binaries, or built from source.

Any other ideas?

/cc @jcar87 @datalogics-robb

Package and Environment Details

Conan profile

[settings] arch=sparcv9 arch_build=sparcv9 build_type=Release compiler=gcc compiler.libcxx=libstdc++ compiler.version=9.2 os=SunOS os_build=SunOS doxygen:arch=sparcv9 doxygen:build_type=Release cmake:arch=sparcv9 cmake:build_type=Release ninja:arch=sparcv9 ninja:build_type=Release swig:arch=sparcv9 swig:build_type=Release b2:arch=sparcv9 b2:build_type=Release innoextract:arch=sparcv9 innoextract:build_type=Release m4:build_type=Release m4:arch=sparcv9 autoconf:build_type=Release autoconf:arch=sparcv9 automake:build_type=Release automake:arch=sparcv9 [options] b2:toolset=cxx b2:use_cxx_env=True boost:debug_level=1 cmake:with_openssl=False pcre:with_bzip2=False [build_requires] *: cmake/[>=3.23.0] [env] CC=/opt/gcc-9.2.0/bin/gcc CFLAGS=-pthread -m64 CXX=/opt/gcc-9.2.0/bin/g++ CXXFLAGS=-pthread -m64 LDFLAGS=-Wl,-R,/opt/gcc-9.2.0/lib/sparcv9 PATH=[/opt/cmake-3.19/bin,/opt/gcc-9.2.0/bin,/usr/gnu/bin] b2:CXXFLAGS=-pthread -m64 -Wl,-R,/opt/gcc-9.2.0/lib/sparcv9 b2:LD_RUN_PATH=/opt/gcc-9.2.0/lib m4:CFLAGS=-pthread -m64 -std=gnu99 [buildenv] CC=/opt/gcc-9.2.0/bin/gcc CXX=/opt/gcc-9.2.0/bin/g++ CXXFLAGS=-pthread -m64 LDFLAGS=-Wl,-R,/opt/gcc-9.2.0/lib/sparcv9 PATH=+(path)/opt/gcc-9.2.0/bin:/usr/gnu/bin PATH+=(path)/opt/cmake-3.19/bin CFLAGS=-pthread -m64 m4:CFLAGS="-pthread -m64 -std=gnu99" b2:CXXFLAGS="-pthread -m64 -Wl,-R,/opt/gcc-9.2.0/lib/sparcv9" b2:LD_RUN_PATH=/opt/gcc-9.2.0/lib

Steps to reproduce

conan create recipes/swig/dl swig/4.0.2+dl.2@ --update --json /tmp/pytest-of-devauto/pytest-7/test_build_tool_swig_4_0_2_dl_0/create.json --profile:host build-profile-solaris-sparc --profile:host profiles/cmake-tool --options:host pcre:with_bzip2=False --build missing

Logs

Click to expand log ``` Creating package swig/4.0.2+dl.2: conan create recipes/swig/dl swig/4.0.2+dl.2@ --update --json /tmp/pytest-of-devauto/pytest-7/test_build_tool_swig_4_0_2_dl_0/create.json --profile:host build-profile-solaris-sparc --profile:host profiles/cmake-tool --options:host pcre:with_bzip2=False --build missing ************************************************************ This package defines both 'os' and 'os_build' Please use 'os' for libraries and 'os_build' only for build-requires used for cross-building ************************************************************ Exporting package recipe swig/4.0.2+dl.2 exports: File 'conandata.yml' found. Exporting it... swig/4.0.2+dl.2 exports: Copied 1 '.yml' file: conandata.yml swig/4.0.2+dl.2 exports_sources: Copied 4 '.patch' files: 0002-4.0.2-do-not-define-SWIG_LIB_WIN_UNIX.patch, 0004-1.3.40-swig-linux-library-path.patch, 0003-1.3.40-do-not-define-SWIG_LIB_WIN_UNIX.patch, 0001-swig-linux-library-path.patch swig/4.0.2+dl.2 exports_sources: Copied 1 '.cmake' file: conan-official-swig-targets.cmake swig/4.0.2+dl.2: The stored package has not changed swig/4.0.2+dl.2: Using the exported files summary hash as the recipe revision: 1bdf819c2d33a17c1f4f222ac87a3b27 swig/4.0.2+dl.2: Exported revision: 1bdf819c2d33a17c1f4f222ac87a3b27 Configuration: [settings] arch=sparcv9 arch_build=sparcv9 build_type=Release compiler=gcc compiler.libcxx=libstdc++ compiler.version=9.2 os=SunOS os_build=SunOS doxygen:arch=sparcv9 doxygen:build_type=Release cmake:arch=sparcv9 cmake:build_type=Release ninja:arch=sparcv9 ninja:build_type=Release swig:arch=sparcv9 swig:build_type=Release b2:arch=sparcv9 b2:build_type=Release innoextract:arch=sparcv9 innoextract:build_type=Release m4:build_type=Release m4:arch=sparcv9 autoconf:build_type=Release autoconf:arch=sparcv9 automake:build_type=Release automake:arch=sparcv9 [options] b2:toolset=cxx b2:use_cxx_env=True boost:debug_level=1 cmake:with_openssl=False pcre:with_bzip2=False [build_requires] *: cmake/[>=3.23.0] [env] CC=/opt/gcc-9.2.0/bin/gcc CFLAGS=-pthread -m64 CXX=/opt/gcc-9.2.0/bin/g++ CXXFLAGS=-pthread -m64 LDFLAGS=-Wl,-R,/opt/gcc-9.2.0/lib/sparcv9 PATH=[/opt/cmake-3.19/bin,/opt/gcc-9.2.0/bin,/usr/gnu/bin] b2:CXXFLAGS=-pthread -m64 -Wl,-R,/opt/gcc-9.2.0/lib/sparcv9 b2:LD_RUN_PATH=/opt/gcc-9.2.0/lib m4:CFLAGS=-pthread -m64 -std=gnu99 [buildenv] CC=/opt/gcc-9.2.0/bin/gcc CXX=/opt/gcc-9.2.0/bin/g++ CXXFLAGS=-pthread -m64 LDFLAGS=-Wl,-R,/opt/gcc-9.2.0/lib/sparcv9 PATH=+(path)/opt/gcc-9.2.0/bin:/usr/gnu/bin PATH+=(path)/opt/cmake-3.19/bin CFLAGS=-pthread -m64 m4:CFLAGS="-pthread -m64 -std=gnu99" b2:CXXFLAGS="-pthread -m64 -Wl,-R,/opt/gcc-9.2.0/lib/sparcv9" b2:LD_RUN_PATH=/opt/gcc-9.2.0/lib JSON file created at '/tmp/pytest-of-devauto/pytest-7/test_build_tool_swig_4_0_2_dl_0/create.json' ERROR: cmake/3.25.3: option 'with_openssl' doesn't exist Possible options are [] ```
datalogics-robb commented 1 year ago

I like the idea of a single recipe with a configuration variable that would default to building from a binary package on Windows/Mac/Linux and default to a source build otherwise. That would make it easy to deal with unusual architectures without having to list them anywhere (i.e. Windows ARM, Linux PPC, BSD, Solaris).