conan-io / conan

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

[question] How should you handle binary compatibility as a consumer? #7418

Open ohanar opened 4 years ago

ohanar commented 4 years ago

The product that I work on has roughly 100 conan packages that go into its making. Most of these packages are built with general purpose compilers (namely msvc and gcc), however a handful are built with the Intel Compiler.

This is what we want -- we don't want to build things like zlib or boost with the Intel Compiler, we want to use the general purpose compilers. This leads to a problem as a consumer though: How do I (as a consumer) specify what binaries are compatible?

This is important because it is unreasonable for every individual package use the compatible_packages feature to specify binary compatibility between the Intel Compiler and gcc/msvc, when the Intel Compiler is not a mainstream compiler.

Is there something like a package_id hook that I could use?

ohanar commented 4 years ago

I should say this isn't a big issue for local development: A developer can just run conan install with msvc/gcc. This is more of an issue when exporting a library built with the Intel Compiler using conan create.

memsharded commented 4 years ago

Hi @ohanar

Consumers can always say which packages are using which compiler, something like:

Profile:

[settings]
compiler = gcc  # default for all packages
mypkg:compiler = intel  # specific packages can use intel

Would this be useful for your case?

ohanar commented 4 years ago

@memsharded I wasn't aware of that. Yes that does work, although it is horribly unergonomic. For instance, with just two packages, the profile gets to be something like this:

[settings]
arch=x86_64
arch_build=x86_64
os=Linux
os_build=Linux

compiler=gcc
compiler.version=8
compiler.libcxx=libstdc++
embree3:compiler=intel
embree3:compiler.version=19
embree3:compiler.base=gcc
embree3:compiler.base.version=8
embree3:compiler.base.libcxx=libstdc++
mypkg:compiler=intel
mypkg:compiler.version=19
mypkg:compiler.base=gcc
mypkg:compiler.base.version=8
mypkg:compiler.base.libcxx=libstdc++

[env]
CC=gcc
CXX=g++
embree3:CC=icc
embree3:CXX=icpc
mypkg:CC=icc
mypkg:CXX=icpc

There isn't a way to setup profiles with yaml, is there? If there is, this could be made a lot simpler with anchors.