FS#59282 - [msgpack-c] cmake files unconditionally import static libraries

Attached to Project: Community Packages
Opened by Peter Urban (broken_pipe) - Monday, 09 July 2018, 16:14 GMT
Last edited by Baptiste (zorun) - Friday, 14 September 2018, 07:38 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Baptiste (zorun)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:
I discovered that the package configuration file contains a target (msgpackc-static) for the statically linked library version but the referenced library (/usr/lib/libmsgpackc.a) is not installed by the arch-package.

When I try to use the msgpackc-config.cmake I get the following error:
```
CMake Error at /usr/lib64/cmake/msgpack/msgpack-targets.cmake:90 (message):
The imported target "msgpackc-static" references the file

"/usr/lib/libmsgpackc.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/msgpack/msgpack-targets.cmake"

but not all the files it references.

Call Stack (most recent call first):
/usr/lib64/cmake/msgpack/msgpack-config.cmake:52 (include)
/usr/share/cmake-3.11/Modules/CMakeFindDependencyMacro.cmake:48 (find_package)
```

Additional info:
* package version: 3.0.1-1

Steps to reproduce:

* call cmake function `find_package( msgpack-c )` in CMakeLists.txt
This task depends upon

Closed by  Baptiste (zorun)
Friday, 14 September 2018, 07:38 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in msgpack-c 3.1.1-1
Comment by Peter Urban (broken_pipe) - Monday, 09 July 2018, 16:35 GMT
Attached minimal CMakeLists.txt reproducing the problem
Comment by Eli Schwartz (eschwartz) - Monday, 09 July 2018, 17:11 GMT
  • Field changed: Summary ([msgpack-c] PLEASE ENTER SUMMARY → [msgpack-c] cmake files unconditionally import static libraries)
  • Field changed: Category (Packages → Upstream Bugs)
The file /usr/lib/cmake/msgpack/msgpack-targets-none.cmake is the sort of typically horrid cmake autogenerated garbage reimplementation of pkg-config.

It tries to import libmsgpack.a and libmsgpack.so both, with absolutely no checks to see whether it exists and no provisions for turning it off in the cmake file at buildtime, and as a result cmake derps all over itself.

Please report an upstream bug, since cmake should not be looking for static libraries in the first place.
Comment by Peter Urban (broken_pipe) - Monday, 09 July 2018, 17:24 GMT
I don't think this is a cmake bug, but just a configuration error.
I'd propose to install the static library to fix this (if it does not violate arch policies).
Otherwise msgpack-c cmake logic should be fixed such that it does not export the -static target if its not installed.

@eschwartz In my experience cmake package configurations work really well but are rarely used correctly. If your interested how to use them: https://www.youtube.com/watch?v=bsXLMQ6WgIk

I did not look into the msgpack-c CMakeLists.txt so far. If the problem comes from there, I can file a upstream bug report for msgpack-c if you like.
Comment by Peter Urban (broken_pipe) - Monday, 09 July 2018, 18:04 GMT
I checked https://github.com/msgpack/msgpack-c/blob/master/CMakeLists.txt
it always builds and installs the static version of the library.
If having static libraries is not against arch packaging policies the static library should be included!
@eschwartz plz move this back to the Packages Category
Comment by Eli Schwartz (eschwartz) - Monday, 09 July 2018, 18:23 GMT
It is against Arch packaging policies to provide static libraries.

The CMake file should not depend specifically on the static libraries; alternatively it should have a build-time option to disable them.

It is impossible to have "cmake package configurations work really well", because the mere concept of a cmake package configuration is fundamentally flawed :p pkg-config exists for a reason, and CMake uses their own Not-In-House reimplementation; NIH reimplementations by definition aren't allowed to compete, no matter how well you use them.

(Yes, I'm opinionated. But regardless of my dislike for CMake package configuration, the fact remains that it hardcodes static libraries while we have a policy against providing them, therefore this is an upstream bug, because it is the upstream cmake logic which breaks when shared libraries but not static libraries are installed.)
Comment by Peter Urban (broken_pipe) - Monday, 09 July 2018, 18:32 GMT
Ok, I'll ask the msgpack-c devs for an option to disable the static target.

CMake does not export the static libs by default. It is explicitly defined in the CMakeLists.txt which targets are exported to the configuration.

In general, the scope of cmake package configurations is far beyond what pkg-config provides. Watch the video ;)

Thanks for your time :)

Comment by Peter Urban (broken_pipe) - Monday, 09 July 2018, 18:59 GMT Comment by Peter Urban (broken_pipe) - Thursday, 09 August 2018, 13:35 GMT
Hi again,

https://github.com/msgpack/msgpack-c/issues/703
has been fixed with:
https://github.com/msgpack/msgpack-c/pull/713

Please repackage to close this bug.

Loading...