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

0.50.1: Requires.private is propagated when no static libraries are used #5334

Closed
kloczek opened this issue Apr 30, 2019 · 5 comments
Closed

Comments

@kloczek
Copy link

kloczek commented Apr 30, 2019

I'm not 100% sure where is the problem however it is related to propagating Requires.private in .pc files but looks like it maybe more than one bug/issue.
Case:
latest libwnck in meson.build has:

pc_conf = configuration_data()
pc_conf.set('prefix', get_option('prefix'))
pc_conf.set('exec_prefix', '${prefix}')
pc_conf.set('libdir', '${exec_prefix}/' + get_option('libdir'))
pc_conf.set('includedir', '${prefix}/' + get_option('includedir'))
pc_conf.set('STARTUP_NOTIFICATION_PACKAGE', STARTUP_NOTIFICATION_PACKAGE)
pc_conf.set('X11_PACKAGE', X11_PACKAGE)
pc_conf.set('XRES_PACKAGE', XRES_PACKAGE)
pc_conf.set('VERSION', meson.project_version())

foreach pc: [PACKAGE_NAME, PACKAGE_NAME + '-uninstalled']
  DoInstall = true
  if pc.contains('-uninstalled')
    DoInstall = false
  endif
  configure_file(input: pc + '.pc.in',
    output: pc + '.pc',
    configuration: pc_conf,
    install: DoInstall,
    install_dir: join_paths(libdir, 'pkgconfig'))
endforeach

It causes that it is generated .pc file:

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib64
includedir=${prefix}/include

Name: libwnck
Description: Window Navigator Construction Kit library
Version: 3.31.4
Requires: glib-2.0 gobject-2.0 gtk+-3.0
Requires.private: x11 pango cairo libstartup-notification-1.0 xres
Libs: -L${libdir} -lwnck-3
Cflags: -I${includedir}/libwnck-3.0

Issues:

  1. xres dependency is added despite fact that I'm building libwnck on system without xres and it it is nothing wrong with that as in meson.build is:
 {'name': XRES_PACKAGE, 'required': false},

For that I have already opened https://gitlab.gnome.org/GNOME/libwnck/issues/138

  1. .pc files are with propagated libwnck Requires.private despite fact that during building libwnck I'm not generating static libraries which could be used later.

  2. I see on my system that a lot of other projects which are using meson based .pc files generators have Requires.private and none of them have been build to build static libraries

  3. Issue seems is as well with pkgconfig as on using PKG_CHECK_MODULES() aclocal macro it checks Requires and Requires.private dependencies.

@eli-schwartz
Copy link
Member

eli-schwartz commented May 7, 2019

xres dependency is added despite fact that I'm building libwnck on system without xres and it it is nothing wrong with that as in meson.build is:

Downstream issue as their meson.build hardcodes XRES_PACKAGE = 'xres' rather than null'ing this if the dependency is not found, and then configures their .pc file using that text string.

.pc files are with propagated libwnck Requires.private despite fact that during building libwnck I'm not generating static libraries which could be used later.

The .pc files are not propagated with anything. libwnck contains a .pc.in that contains "Requires.private", and meson is not responsible for adding these at all.

I see on my system that a lot of other projects which are using meson based .pc files generators have Requires.private and none of them have been build to build static libraries

This is correct and proper. When using these .pc files, if you use pkg-config --libs libwnck-3.0, you only get "Libs" and "Requires". In order for pkg-config to also depend on and emit the "Requires.private", you must use pkg-config --static --libs libwnck-3.0.

Most .pc files that are generated by autotools, or finely crafted in a text editor, also have Requires.private as needed.

Issue seems is as well with pkgconfig as on using PKG_CHECK_MODULES() aclocal macro it checks Requires and Requires.private dependencies.

This is incorrect and it does not check "Requires.private" on my system. However, PKG_CHECK_MODULES_STATIC() will check it. Also, if you export PKG_CONFIG="pkg-config --static" before executing ./configure it will check "Requires.private".

@kloczek
Copy link
Author

kloczek commented May 7, 2019

You are right about template .pc.in file in libwnck. Yes, it has Requires.private line.
My mistake :/

@kloczek
Copy link
Author

kloczek commented May 7, 2019

I've added in libwnck package workaround in rpm package %install section by execute %__sed -i 's/ xres//' %{buildroot}%{_libdir}/pkgconfig/*.pc however still somethimg something is wrong even a bit deepper.
libwnck-3.0.pc has line:
Requires: glib-2.0 gobject-2.0 gtk+-3.0
And that is OK because libwnck libraruy header files are using those three packages header files.
However looking on --libs and --libs --statc output I think that --libs output is to long:

[tkloczko@domek ready]$ pkg-config --libs libwnck-3.0
-lwnck-3 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lpixman-1 -lfontconfig -lfreetype -lpng16 -lz -lxcb-shm -lxcb -lxcb-render -lXrender -lX11 -lXext -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 
[tkloczko@domek ready]$ pkg-config --static --libs libwnck-3.0
-lwnck-3 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lz -lz -lXau -lxcb -lXau -lxcb -lXau -lX11 -lX11 -lz -lz -lXau -lxcb -lXau -lxcb -lXau -lX11 -lX11 -lz -lz -lXau -lxcb -lXau -lxcb -lXau -lX11 -lX11 -latk-1.0 -lz -lz -lXau -lxcb -lXau -lxcb -lXau -lX11 -lX11 -lcairo-gobject -lz -lz -lXau -lxcb -lXau -lxcb -lXau -lX11 -lX11 -lX11 -lgdk_pixbuf-2.0 -lgio-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lpixman-1 -lfontconfig -lz -lfreetype -lbz2 -lpng16 -lz -lxcb-shm -lXau -lxcb -lXau -lxcb-render -lxcb -lXau -lXrender -lX11 -lX11 -lXext -lX11 -lstartup-notification-1 

Theoretically --libs as it is only for shared libraries linking should return just -lwnck-3.
Looks like Requires affects --libs output which is causing linking DSO with to many libraries.
Above is with:

$ pkg-config --version
1.6.1

I'm almost sure that 1.5.x have been generating shorter/proper list.

@eli-schwartz
Copy link
Member

Theoretically --libs as it is only for shared libraries linking should return just -lwnck-3.

No.

Looks like Requires affects --libs output which is causing linking DSO with to many libraries.

Requires is strictly defined. Its entire purpose is in order to cause DSO with many libraries. Any pc file which contains Requires, is stating that it needs to link to all these dependencies even when it is a shared library. This happens when a project, like gtk3, exports all of its dependencies as part of its public ABI.

...

This is all coming from pkg-config, so it has nothing to do with meson. Maybe report further questions to the pkg-config project at https://www.freedesktop.org/wiki/Software/pkg-config/

@kloczek
Copy link
Author

kloczek commented May 7, 2019

Yes I think that we can close this ticket.
Thanks for your time :)

@kloczek kloczek closed this as completed May 7, 2019
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

2 participants