3

I need to build a static Linux executable with gstreamer and use the queue factory which is part of the coreelements plugin. What I did was:

  • Configured gstreamer (version 1.12.4) with: ./configure --enable-static --disable-shared --enable-static-plugins
  • Built it and gst-plugin-base
  • Added in my code: GST_PLUGIN_STATIC_DECLARE(coreelements); GST_PLUGIN_STATIC_REGISTER(coreelements);
  • Linked my app with libgstcoreelements.a (together with gstreamer-1.0, gstbase-1.0 and gstapp-1.0)

Linking fails with: undefined reference to gst_plugin_coreelements_register()

I can verify that gst_plugin_coreelements_register is in the static library file:

$ nm libgstcoreelements.a |grep gst_plugin_coreelements_register 00000000000002c0 T gst_plugin_coreelements_register

Do you see what I am doing wrong?

1 Answer 1

4

What I was missing is an extern "C" { } block around the first gstreamer macro as it declares an extern C-style function, and my application is compiled with g++:

extern "C" {
GST_PLUGIN_STATIC_DECLARE(coreelements);
}
2
  • I compile pure c code and link with gcc/ld and still have the same problem. nm main.o | grep coreelements shows U gst_plugin_coreelements_register and nm libgstcoreelements.a | grep coreelements shows 0000000000000100 T gst_plugin_coreelements_register. How don't they meld with each other?
    – AleXoundOS
    Nov 11, 2021 at 21:21
  • The problem was that I didn't actually link to libgstcoreelements.a which resides in lib/gstreamer-1.0 (not lib).
    – AleXoundOS
    Nov 16, 2021 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.