Conan-center-index: [package] libcbor/0.7.0: "Shared" recipe option seems to be broken

Created on 17 Aug 2020  路  6Comments  路  Source: conan-io/conan-center-index

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: libcbor/0.7.0
  • Operating System+version: Linux Ubuntu 18.04, Windows
  • Compiler+version: GCC 7, Visual Studio 15
  • Conan version: conan 1.25.2

Conan profile

[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=gcc
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=7
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=Visual Studio
compiler.runtime=MDd
compiler.toolset=v141
compiler.version=15
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

Steps to reproduce

Linux: (no static library)

  1. add libcbor/0.7.0 into _conanfiles.txt_ in the _[requires]_ section
  1. set shared option to _false_ explicitly
    [options]
    libcbor:custom_alloc=True
    libcbor:shared=False

  2. install conan package:
    conan install . -if _outDIr_ -s build_type=Debug -s arch=x86_64 --build missing -s compiler.cppstd=gnu14 -s compiler.version=7 -s compiler.libcxx=libstdc++11

  3. navigate to the place where conan installed the packages, in my case:
    /home//.conan/data/libcbor/0.7.0/_/_/package/82f67b16f1984214c72e37b72c16a41490db9eb5/lib
    and see that there are no static library generated, only dynamic one. In my case the folder contains next files:

lrwxrwxrwx 1 14 Aug 17 23:02 libcbor.so -> libcbor.so.0.7
lrwxrwxrwx 1 16 Aug 17 23:02 libcbor.so.0.7 -> libcbor.so.0.7.0
-rw-r--r-- 1 185856 Aug 17 23:02 libcbor.so.0.7.0

Windows: (when library should be shared (dll) the .lib files is actually a static library and not import library)

  1. add libcbor/0.7.0 into _conanfiles.txt_ in the _[requires]_ section
  1. set shared option to _true_ explicitly
    [options]
    libcbor:custom_alloc=True
    libcbor:shared=True

  2. install conan package:
    conan install . -if _outDIr_ -s build_type=Debug -s arch=x86_64 --build missing -g visual_studio_multi -g cmake_multi -s compiler.version=15 -s compiler.toolset=v141

  3. navigate to the place where conan installed the packages, in my case:
    C:\Users\.conan\data\libcbor\0.7.0__\package\185dd1fa3175e58741303ac107447abc3fc46847\lib
    see that the .lib file is created but that lib file is actually a static library and not import library. Such makes it inconvenient to use share library.

bug

Most helpful comment

@intelligide Thank you, all seems to be working as expected !

All 6 comments

The CMakeLists.txt https://github.com/PJK/libcbor/blob/v0.7.0/src/CMakeLists.txt exports .dll as shared library and .lib as a static library (and not as an symbol archive).

What about Lilnux, have you tried ?
I can't find static library there, probably I'm looking in wrong place ?

Also, having the script export dll and static library, but not export library, do you think that this is correct ? In case I'd like to use a dll how should I link the library so that at run-time it uses the dll ?

Here is the pb: https://github.com/PJK/libcbor/blob/97b865d8280725f936067ad86673219c1019d101/src/CMakeLists.txt#L31
lt always build both static and shared libs (and moreover with the same name, which leads to name collision for static and import lib on windows), and installs shared. recipe should patch libcbor's CMakeLists to build only one target without hardcoded STATIC or SHARED.

Thank you @SpaceIm for the answer.

It seams like the recipe doesn't patch the cbor's CMakeLists.
Is this possible to do changes on the recipe side or the cbor's CMakeLists.txt has to be changed ?

@afedechko Can you try with the new recipe?
remove old recipe first with:

conan remove libcbor/0.7.0

@intelligide Thank you, all seems to be working as expected !

Was this page helpful?
0 / 5 - 0 ratings