Hi
Trying to build a gstreamer application as a library, e.g., a call to a function within the library would create the loop, pipeline, bus, etc. I am generating the .so as follows: gcc -shared -Wl,-soname,$@ `pkg-config --cflags --libs gstreamer-1.0` -D_GNU_SOURCE -I . -g -O2 -Wall -fPIC libtst.c -o libtst.so' where libtst.c looks like: #include <glib.h> #include <glib/gprintf.h> #include <gst/gst.h> #include <arpa/inet.h> #include <stdint.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <time.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <gst/check/gstcheck.h> #include <sys/syscall.h> void create(int argc,char* argv[]){ GstElement *pipeline; GstBus *bus; GMainLoop *loop; guint bus_watch_id; GError *err = NULL; gst_init(&argc, &argv); pipeline = gst_parse_launch (argv, &err); if (!pipeline) { g_print ("Parse error: %s\n", err->message); exit (1); } loop = g_main_loop_new (NULL, FALSE); bus = gst_element_get_bus (pipeline); ... } The test program looks like: #include "libtst.h" void main(int argc,char* argv[) { create(argc,argv); } And is built as: gcc test.c -L. -ltst -I. -o test -Wl,--allow-shlib-undefined `pkg-config --cflags gstreamer-1.0` After setting LD_LIBRARY_PATH to point gstreamer.so, glib.so, ... on the target machine, I see the following: *** ./test: symbol lookup error: /root/libtst.so: undefined symbol: gst_init Aborted Doing ldd on the library file does not show any of gst, or glib related libraries, e.g: ldd libtst.so linux-vdso.so.1 (0x00007ffea7559000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f33b220e000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f33b1e62000) /lib64/ld-linux-x86-64.so.2 (0x000055d77ec76000) I am not creating this .so correctly, Any thoughts, as how to go about it? Cheers, _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Never mind `pkg-config --cflags --libs gstreamer-1.0` should be inserted
prior to -o. (Go figure.) Cheers, -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Wed, 31 Jan 2018 21:29:33 -0700 (MST)
HtGst <[hidden email]> wrote: > Never mind `pkg-config --cflags --libs gstreamer-1.0` should be inserted > prior to -o. (Go figure.) > Cheers, > As a general rule you should put the output of "pkg-config --cflags" _before_ the linking objects, and the output of "pkg-config --libs" _after_ them. For instance GNU Make uses two different variables for that: LDFLAGS for the former and LDLIBS for the latter, and uses a command like this: $(CC) $(LDFLAGS) n.o $(LOADLIBES) $(LDLIBS) I guess this has to do with how 'ld' handles its arguments. Ciao, Antonio -- Antonio Ospite https://ao2.it https://twitter.com/ao2it A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing? _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |