After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 794568 - Meson: Should generate a .pc file for each static plugin
Meson: Should generate a .pc file for each static plugin
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.12.x
Other Linux
: Normal enhancement
: 1.15.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 791538 (view as bug list)
Depends on:
Blocks: 794604 794770
 
 
Reported: 2018-03-21 15:32 UTC by Xavier Claessens
Modified: 2018-04-25 10:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Script to add pkgconfig.generate() (1.07 KB, text/x-python)
2018-03-22 00:54 UTC, Xavier Claessens
  Details
Meson Generate pc file for all plugins (25.52 KB, patch)
2018-03-22 00:55 UTC, Xavier Claessens
none Details | Review
Meson: Generate pc file for all plugins in bad (44.38 KB, patch)
2018-04-07 02:23 UTC, Xavier Claessens
none Details | Review
Meson: Generate pc file for all plugins in base (11.59 KB, patch)
2018-04-07 02:23 UTC, Xavier Claessens
none Details | Review
Meson: Generate pc file for all plugins in good (23.29 KB, patch)
2018-04-07 02:23 UTC, Xavier Claessens
none Details | Review
Meson: Generate pc file for all plugins in ugly (5.04 KB, patch)
2018-04-07 02:24 UTC, Xavier Claessens
none Details | Review
Meson: Generate pc file for all plugins in bad (50.14 KB, patch)
2018-04-24 18:16 UTC, Xavier Claessens
committed Details | Review
Meson: Generate pc file for all plugins in base (13.25 KB, patch)
2018-04-24 18:16 UTC, Xavier Claessens
committed Details | Review
Meson: Generate pc file for all plugins in good (26.48 KB, patch)
2018-04-24 18:17 UTC, Xavier Claessens
committed Details | Review
Meson: Generate pc file for all plugins in ugly (5.83 KB, patch)
2018-04-24 18:17 UTC, Xavier Claessens
committed Details | Review

Description Xavier Claessens 2018-03-21 15:32:21 UTC
Currently static builds of GStreamer rely on libtool's .la files to get the list of libraries a plugin depends on and pull them when doing a static build. Meson won't generate those .la files and thus static link is close to impossible, as far as I understand.

I think the proper solution in a post-autotools world is to rely on .pc file, and this we need one for each plugin. Lucky enough meson has a generator for pc files that will deal with dependencies automatically, so that's pretty much a one liner.

I guess we should install them in /usr/lib/gstreamer-1.0/pkgconfig with names like gstapp.pc to match the library name with 'lib' prefix and '.so' suffix removed.

Maybe we could get a "generate_pc_file: true" arg added to the library() method in meson to autogen them all.

Does that make sense?
Comment 1 Tim-Philipp Müller 2018-03-21 15:47:53 UTC
Isn't there a discussion about this on the Meson side as well?

Do you have a link by any chance?

I would want Meson to create these automatically somehow then.
Comment 2 Xavier Claessens 2018-03-21 16:12:23 UTC
(In reply to Tim-Philipp Müller from comment #1)
> Isn't there a discussion about this on the Meson side as well?
> 
> Do you have a link by any chance?

There is ongoing effort in Meson to improve its pc file generator, but it's already good enough for our case I think.

> I would want Meson to create these automatically somehow then.

I don't know meson should generate a pc file for all libraries, I think we should at least flag those we want.
Comment 3 Xavier Claessens 2018-03-21 18:01:28 UTC
I just opened a PR for meson to have a trivial pc generator:
https://github.com/mesonbuild/meson/pull/3284
Comment 4 Xavier Claessens 2018-03-22 00:54:35 UTC
Created attachment 369984 [details]
Script to add pkgconfig.generate()
Comment 5 Xavier Claessens 2018-03-22 00:55:22 UTC
Created attachment 369985 [details] [review]
Meson Generate pc file for all plugins
Comment 6 Xavier Claessens 2018-03-22 01:17:30 UTC
wow, that even works! After setting PKG_CONFIG_PATH and LD_LIBRARY_PATH, I can do:

gcc -static test.c $(pkg-config gstalpha --libs --static --cflags

And the only error I see is:
gstreamer-1.0-1.14.0/gst/gstdatetime.c:843: undefined reference to `pow'

Because gstreamer-1.0.pc is missing -lm.
Comment 7 Xavier Claessens 2018-03-22 01:53:28 UTC
Updated my meson patch to be able to omit install_dir, it now defaults to lib's dir with "/pkgconfig" appended.
Comment 8 Sebastian Dröge (slomo) 2018-03-22 07:46:28 UTC
(In reply to Xavier Claessens from comment #6)

> And the only error I see is:
> gstreamer-1.0-1.14.0/gst/gstdatetime.c:843: undefined reference to `pow'
> 
> Because gstreamer-1.0.pc is missing -lm.

Can you make a patch for that? Thanks :)
Comment 9 Xavier Claessens 2018-03-22 18:44:33 UTC
*** Bug 791538 has been marked as a duplicate of this bug. ***
Comment 10 Xavier Claessens 2018-04-07 01:25:40 UTC
(In reply to Sebastian Dröge (slomo) from comment #8)
> (In reply to Xavier Claessens from comment #6)
> 
> > And the only error I see is:
> > gstreamer-1.0-1.14.0/gst/gstdatetime.c:843: undefined reference to `pow'
> > 
> > Because gstreamer-1.0.pc is missing -lm.
> 
> Can you make a patch for that? Thanks :)

I have a patch in bug #794603 that fix that when building with meson.
Comment 11 Xavier Claessens 2018-04-07 02:23:29 UTC
Created attachment 370620 [details] [review]
Meson: Generate pc file for all plugins in bad
Comment 12 Xavier Claessens 2018-04-07 02:23:45 UTC
Created attachment 370621 [details] [review]
Meson: Generate pc file for all plugins in base
Comment 13 Xavier Claessens 2018-04-07 02:23:59 UTC
Created attachment 370622 [details] [review]
Meson: Generate pc file for all plugins in good
Comment 14 Xavier Claessens 2018-04-07 02:24:16 UTC
Created attachment 370623 [details] [review]
Meson: Generate pc file for all plugins in ugly
Comment 15 Xavier Claessens 2018-04-23 20:44:49 UTC
Meson 0.46 has been released with the API used by those patches. Review would be appreciated.
Comment 16 Thibault Saunier 2018-04-24 12:41:40 UTC
Well I do not think much reviewing is required here :-)

My only comment is that meson dependency should be bumped to 0.46 on all modules if we merge it now.
Comment 17 Xavier Claessens 2018-04-24 14:51:52 UTC
(In reply to Thibault Saunier from comment #16)
> Well I do not think much reviewing is required here :-)

But I need someone to push them, I don't have push permission in GStreamer.

> My only comment is that meson dependency should be bumped to 0.46 on all
> modules if we merge it now.

Those patches already does that ;-)
Comment 18 Tim-Philipp Müller 2018-04-24 17:33:36 UTC
Just to follow up on some discussion on IRC: These patches currently also install .pc files for plugins if we only build shared plugins, which is something we probably want to avoid because it doesn't make much sense. Xavier has a plan to skip generation of these files in that case.
Comment 19 Xavier Claessens 2018-04-24 18:16:38 UTC
Created attachment 371332 [details] [review]
Meson: Generate pc file for all plugins in bad
Comment 20 Xavier Claessens 2018-04-24 18:16:57 UTC
Created attachment 371333 [details] [review]
Meson: Generate pc file for all plugins in base
Comment 21 Xavier Claessens 2018-04-24 18:17:15 UTC
Created attachment 371334 [details] [review]
Meson: Generate pc file for all plugins in good
Comment 22 Xavier Claessens 2018-04-24 18:17:59 UTC
Created attachment 371335 [details] [review]
Meson: Generate pc file for all plugins in ugly
Comment 23 Tim-Philipp Müller 2018-04-25 10:33:06 UTC
All pushed now, thanks!