FS#72720 - json-c ships CMake static targets but does not include any static libraries

Attached to Project: Arch Linux
Opened by YuutaW (YuutaW) - Friday, 12 November 2021, 06:25 GMT
Last edited by Jan Alexander Steffens (heftig) - Friday, 12 November 2021, 22:02 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Jelle van der Waa (jelly)
Jan Alexander Steffens (heftig)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

The json-c package (version 0.15-1) ships /usr/lib/cmake/json-c/json-c-targets.cmake file that contains both dynamic and static targets for json-c library, but this package does not include any .a static libraries, causing CMake projects importing json-c using find_package fail to build.

For example, my CMakeLists.txt is:

cmake_minimum_required(VERSION 3.0)
project(example VERSION 1.0 LANGUAGES C CXX)
set(CMAKE_C_STANDARD 11)
find_package(json-c)
add_executable(example main.c)
target_include_directories(example PUBLIC "${PROJECT_BINARY_DIR}")

It will cause an error when generating Makefile:

CMake Error at /usr/lib64/cmake/json-c/json-c-targets.cmake:75 (message):
The imported target "json-c::json-c-static" references the file

"/usr/lib/libjson-c.a"

but this file does not exist. Possible reasons include:

* The file was deleted, renamed, or moved to another location.

* An install or uninstall procedure did not complete successfully.

* The installation package was faulty and contained

"/usr/lib64/cmake/json-c/json-c-targets.cmake"

but not all the files it references.

Call Stack (most recent call first):
/usr/lib64/cmake/json-c/json-c-config.cmake:37 (include)
CMakeLists.txt:4 (find_package)

I think there are two ways to solve it:

1. Do not build the static library at all by specifying -DBUILD_STATIC_LIBS=OFF. Therefore, the static library targets for CMake will not generate.
2. Fix the PKGBUILD so that it ships the static library.

Thank you!

Additional info:
* package version(s): json-c 0.15-1
* config and/or log files etc.

CMake Error at /usr/lib64/cmake/json-c/json-c-targets.cmake:75 (message):
The imported target "json-c::json-c-static" references the file

"/usr/lib/libjson-c.a"

but this file does not exist. Possible reasons include:

* The file was deleted, renamed, or moved to another location.

* An install or uninstall procedure did not complete successfully.

* The installation package was faulty and contained

"/usr/lib64/cmake/json-c/json-c-targets.cmake"

but not all the files it references.

Call Stack (most recent call first):
/usr/lib64/cmake/json-c/json-c-config.cmake:37 (include)
CMakeLists.txt:4 (find_package)

* link to upstream bug report, if any: N / A

Steps to reproduce:


Sample CMakeLists.txt:

cmake_minimum_required(VERSION 3.0)
project(example VERSION 1.0 LANGUAGES C CXX)
set(CMAKE_C_STANDARD 11)
find_package(json-c)
add_executable(example main.c)
target_include_directories(example PUBLIC "${PROJECT_BINARY_DIR}")

Then run CMake.
This task depends upon

Closed by  Jan Alexander Steffens (heftig)
Friday, 12 November 2021, 22:02 GMT
Reason for closing:  Fixed
Additional comments about closing:  json-c 0.15-2

Loading...