Vcpkg: failed to configure msgpack with cmake

Created on 9 Jul 2019  路  6Comments  路  Source: microsoft/vcpkg


After successful installation of msgpack:

$ ./vcpkg install msgpack

The following packages will be built and installed:
    msgpack[core]:x64-linux
Starting package 1/1: msgpack:x64-linux
Building package msgpack[core]:x64-linux...
-- Using cached /home/hg/b/vcpkg/downloads/msgpack-msgpack-c-cpp-3.1.1.tar.gz
-- Using source at /home/hg/b/vcpkg/buildtrees/msgpack/src/cpp-3.1.1-eab3c56b41
-- Applying patch /home/hg/b/vcpkg/ports/msgpack/add-static-lib-option.patch
-- Applying patch failed. This is expected if this patch was previously applied.
-- Configuring x64-linux-dbg
-- Configuring x64-linux-rel
-- Building x64-linux-dbg
-- Building x64-linux-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package msgpack[core]:x64-linux... done
Installing package msgpack[core]:x64-linux...
Installing package msgpack[core]:x64-linux... done
Elapsed time for package msgpack:x64-linux: 2.423 s

Total elapsed time: 2.423 s

The package msgpack:x64-linux provides CMake targets:

    find_package(msgpack CONFIG REQUIRED)
    target_link_libraries(main PRIVATE msgpackc msgpackc-cxx msgpackc-static)



Configure the project with a minimal CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)

project(test-mp)

find_package(msgpack CONFIG REQUIRED)

add_executable(test-mp main.cpp)

target_link_libraries(test-mp PRIVATE msgpackc msgpackc-cxx msgpackc-static)

using the toolchain

$ cmake -DCMAKE_TOOLCHAIN_FILE=~/b/vcpkg/scripts/buildsystems/vcpkg.cmake ..

CMake Error at /home/hg/b/vcpkg/scripts/buildsystems/vcpkg.cmake:198 (_add_library):
  _add_library cannot create ALIAS target "msgpackc" because target
  "msgpackc-static" is imported but not globally visible.
Call Stack (most recent call first):
  /home/hg/b/vcpkg/installed/x64-linux/share/msgpack/msgpack-config.cmake:45 (add_library)
  /home/hg/b/vcpkg/scripts/buildsystems/vcpkg.cmake:266 (_find_package)
  CMakeLists.txt:5 (find_package)


-- Configuring incomplete, errors occurred!
See also "/tmp/test-mp/build/CMakeFiles/CMakeOutput.log".

I could use all other required packages from vcpkg but msgpack.

CMake Version: 3.13.2

Most helpful comment

I've temporarly got around this by adding GLOBAL to the the line
add_library(msgpackc-static STATIC IMPORTED GLOBAL)

in the file vcpkg/installed/x64-linux/share/msgpack/msgpack-targets.cmake

All 6 comments

$ cmake -DCMAKE_TOOLCHAIN_FILE=~/b/vcpkg/scripts/buildsystems/vcpkg.cmake ..

triplet?

It also happened to me.

I tried to update to tag cpp-3.2.0 and skip the patches but the error was the same.

I'm also having this problem with a fresh checkout of tags/cpp-3.2.0

Same Here
vcpkg
commit 2e7f3f6f48a3d4d3c21f0faacbc2c9efbbe700d0 (HEAD -> master, origin/master, origin/HEAD)

I've temporarly got around this by adding GLOBAL to the the line
add_library(msgpackc-static STATIC IMPORTED GLOBAL)

in the file vcpkg/installed/x64-linux/share/msgpack/msgpack-targets.cmake

Mark to the related issue on msgpack-c: https://github.com/msgpack/msgpack-c/issues/801

Was this page helpful?
0 / 5 - 0 ratings

Related issues

angelmixu picture angelmixu  路  3Comments

grandprixgp picture grandprixgp  路  3Comments

cjvaijo picture cjvaijo  路  3Comments

PhilLab picture PhilLab  路  3Comments

invy picture invy  路  3Comments