简体   繁体   English

通过柯南安装仅头文件包时出错

[英]Error installing header only package via conan

I have an internal header-only C++ library built with CMake. 我有一个使用CMake构建的仅内部标头的C ++库。 I followed conan's instructions on how to package header-only libraries and ended up with this conanfile.py: 我按照柯南关于如何打包仅标头库的说明进行操作 ,最后得到以下conanfile.py:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Conan file for KVAPI.

https://docs.conan.io/en/latest/howtos/header_only.html
"""

from conans import ConanFile, CMake


class KVAPIConan(ConanFile):
    name = "kvapi"
    version = "0.1.0.0"
    description = "Kiwi API library"
    exports_sources = "include/*"
    topics = ("kv", "kvapi", "C++")
    no_copy_source = True

    def package(self):
        self.copy("*.hpp")

    def package_id(self):
        self.info.header_only()

I create the package thus: 我这样创建包:

> conan create . kvapi/0.1.0.0@kiwi/testing
> conan upload kvapi* -r genetec

and install it thusly: 然后安装它:

> conan install kvapi/0.1.0.0@kiwi/testing

which results in the error: 导致错误:

Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=15
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

kvapi/0.1.0.0@kiwi/testing: Retrieving from server 'genetec'
kvapi/0.1.0.0@kiwi/testing: Trying with 'genetec'...
Downloading conanmanifest.txt
[==================================================] 848B/638B
Downloading conanfile.py
[==================================================] 513B/456B
kvapi/0.1.0.0@kiwi/testing: Downloaded recipe revision 0
Installing package: kvapi/0.1.0.0@kiwi/testing
Requirements
    kvapi/0.1.0.0@kiwi/testing from 'genetec' - Downloaded
Packages
    kvapi/0.1.0.0@kiwi/testing:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Missing

kvapi/0.1.0.0@kiwi/testing: WARN: Can't find a 'kvapi/0.1.0.0@kiwi/testing' package for the specified settings, options and dependencies:
- Settings:
- Options:
- Dependencies:
- Package ID: 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9

ERROR: Missing prebuilt package for 'kvapi/0.1.0.0@kiwi/testing'
Try to build it from sources with "--build kvapi"
Or read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-missing-prebuilt-package"

Is this expected for a header-only library? 对于仅标头的库,这是预期的吗?

When uploading Conan packages you need to be explicit when you want to upload binary packages too. 上载柯南软件包时,要上载二进制软件包时也需要明确。

The command conan upload kvapi* -r genetec only upload the recipe, not the package created. 命令conan upload kvapi* -r genetec仅上传配方,而不上传创建的软件包。 To upload both recipe package and binary package, which contains those headers, you need to add the argument --all 要上传包含这些标头的配方包和二进制包,您需要添加参数--all

conan upload kvapi* -r genetec --all

reference: https://docs.conan.io/en/latest/uploading_packages/uploading_to_remotes.html 参考: https : //docs.conan.io/en/latest/uploading_packages/uploading_to_remotes.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM