Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg-config file is broken when CMAKE_INSTALL_{BIN,INCLUDE,LIB,DATAROOT,MAN}DIR is absolute #2901

Open
alexshpilkin opened this issue May 18, 2022 · 0 comments

Comments

@alexshpilkin
Copy link

alexshpilkin commented May 18, 2022

What version of shadowsocks-libev are you using?

3.3.5 (but inspection confirms issue exists on master as well)

What operating system are you using?

Linux localhost 5.15.36 #1-NixOS SMP Wed Apr 27 12:39:02 UTC 2022 x86_64 GNU/Linux

What did you do?

Build shadowsocks-libev with CMake, setting the CMAKE_INSTALL_*DIR variables to absolute paths

What did you expect to see?

Working pkg-config files

What did you see instead?

includedir=${prefix}//nix/store/7c6m91v9q43jl61vc6fsj7wrzkwb2xkb-shadowsocks-libev-3.3.5/include, etc.

Extended description

The template in cmake/shadowsocks-libev.pc.cmake has

prefix=@prefix@
exec_prefix=${prefix}/@CMAKE_INSTALL_BINDIR@
libdir=${exec_prefix}/@CMAKE_INSTALL_FULL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
sharedir=${prefix}/@CMAKE_INSTALL_DATAROOTDIR@
mandir=${prefix}/@CMAKE_INSTALL_MANDIR@

and so can’t handle absolute paths in CMAKE_INSTALL_{BIN,INCLUDE,DATAROOT,MAN}DIR; the value of libdir is even more broken, as the FULL variable always contains an absolute path ... or it would, had CMakeLists.txt actually included GNUInstallDirs—right now it expands to the empty string (yay CMake). The former lead to broken .pc files on NixOS; the latter leads to broken .pc files everywhere. Same applies to prefix, which is unset and should probably be changed to CMAKE_INSTALL_PREFIX if anything.

(Libcork also has a similar issue, tracked at dcreager/libcork#173, though in the current version it looks a bit different compared to the obsolete vendored one.)

See “Concatenating paths when building pkg-config files” for a thorough discussion of the problem and a suggested fix, or KDE’s extra-cmake-modules for a simpler approach.

@alexshpilkin alexshpilkin changed the title pkg-config file is broken when CMAKE_INSTALL_{INCLUDE,LIB}DIR is absolute pkg-config file is broken when CMAKE_INSTALL_{BIN,INCLUDE,LIB,DATAROOT,MAN}DIR is absolute May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant