Search code examples
linuxconan

conan install fails on name and version field


relevant files: . ├── bin ├── src ├── conanfile.py └── gcc-9.3.0-linux-x86-debug.profile

When trying to run the following command from the bin folder, I get the error that the name and the version field is not found in the profile. $ conan install .. --profile ../gcc-9.3.0-linux-x86-debug.profile ERROR: Error reading '../gcc-9.3.0-linux-x86-debug.profile' profile: Specify the 'name' and the 'version'

But if I understand it correctly, the version and name should be defined in the conanfile.py file. Where would I define missing name and version number for the install command?

Relevant conan profile

[build_requires]
cmake
ninja
gcc/9.3.0
g++/9.3.0
xorriso

qemu


[settings]
os=Linux
os_build=Linux
arch=x86
arch_build=x86
compiler=gcc
compiler.version=9.3.0
cppstd=17
build_type=Debug

[options]

[env]
CC=/usr/bin/gcc-9.3.0
CXX=/usr/bin/g++-9.3.0
CFLAGS=-g
CXXFLAGS=-g

Solution

  • You need to specify the version too in the [build_requires] (same in conanfile.txt and conanfile.py files). Specifying only the name is not valid syntax. So something like:

    [build_requires]
    cmake/3.16.4
    

    If you need it, version ranges are possible, something like cmake/[>3.15] for example should work.