static builds with gstreamer-rs?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

static builds with gstreamer-rs?

David Holroyd
Hi,

I would like to try and have a static build of my gstreamer-using rust
application, but haven't been able to work out all the steps yet.

I think I will need to:

  1) Build the rust application, with --target=x86_64-unknown-linux-musl
(working well for static builds prior to attempting to add gstreamer-rs)
  2) Use gst-build, with -Ddefault_library=static in order to get a
statically-linkable artefact (and to be able to use plugins from latests
gst releases)
  3) Somehow get the gstreamer*-sys crates to link to static artefacts
built by gst-build


I'm stuck working out the details for step #3 at the moment, but I
mention the earlier steps in case I've made a bad assumption there.  I
tried defining an environmental variable
'SYSTEM_DEPS_GSTREAMER_1_0_SEARCH_NATIVE' pointing to the builddir
created by step #2 above, but ldd shows my executable is still
dynamically linking to my system-installed gstreamer libs.


I would be very grateful for any pointers!

dave

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: static builds with gstreamer-rs?

Sebastian Dröge-3
On Tue, 2020-07-07 at 08:20 +0100, David Holroyd wrote:
> I'm stuck working out the details for step #3 at the moment, but I
> mention the earlier steps in case I've made a bad assumption there.
> I
> tried defining an environmental variable
> 'SYSTEM_DEPS_GSTREAMER_1_0_SEARCH_NATIVE' pointing to the builddir
> created by step #2 above, but ldd shows my executable is still
> dynamically linking to my system-installed gstreamer libs.

That's going to be a bit tricky as linker seem to prefer using shared
libraries if somewhere available in the search path, which is going to
be the case for your system libraries. Best to get them out of the way
really :)

You can try setting PKG_CONFIG_ALL_STATIC=1 or gstreamer-1.0_STATIC=1
(and the same for the others).


In addition to this you also need to link in plugins statically, and
then initialize each of the plugins you want to use in your code.

--
Sebastian Dröge, Centricular Ltd · https://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel