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 755864 - C++ Linker problem for gst_app_src_push_sample
C++ Linker problem for gst_app_src_push_sample
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
1.6.0
Other Linux
: High critical
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-09-30 09:22 UTC by Klaas Jan Russcher
Modified: 2015-09-30 11:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
cpp-file of the appsink-src.c file (5.87 KB, text/x-c++src)
2015-09-30 11:09 UTC, Klaas Jan Russcher
Details

Description Klaas Jan Russcher 2015-09-30 09:22:42 UTC
Please describe the problem:
GCC C++ Compliler can create the .0-files for .cpp-files with the function gst_app_src_push_sample, which is in gst/app/gstappsrc.h. But the GCC C++ Linker returns an 'undefined reference' for gst_app_src_push_sample. The linker has no problem finding other functions that are in gst/app/gstappsrc.h, like the function gst_app_src_push_buffer.
The sample file ./gst-plugins-base/tests/examples/app/appsink-src2.c, which also contains gst_app_src_push_sample is build completely when building gstreamer-1.6.0.

Steps to reproduce:
1. copy the file ./gst-plugins-base/tests/examples/app/appsink-src2.c to appsink-src2.cpp
2. make the file with the needed include path's and libraries

Results:
GCC C++ Linker returns: undefined reference to 'gst_app_src_push_sample'


Does this happen every time?
Yes.

Other information:
Linux 3.16.0-50-generic Ubuntu 14.04.1 x86_64
Comment 1 Matthew Waters (ystreet00) 2015-09-30 10:22:27 UTC
How are you invoking the compiler?

I cannot reporoduce with the following program/compile switches.

#include <gst/app/gstappsrc.h>

int main (int argc, char *argv[])
{
  gst_app_src_push_sample (NULL, NULL);
  gst_app_src_push_buffer (NULL, NULL);

  return 0;
}

g++ $(pkg-config --cflags gstreamer-app-1.0) file.cpp $(pkg-config --libs gstreamer-app-1.0)

gcc $(pkg-config --cflags gstreamer-app-1.0) file.cpp $(pkg-config --libs gstreamer-app-1.0)

(Note that to solve the linker errors you would need to link against -lgstapp-1.0 which the pkg-config --libs gstreamer-app-1.0 gives you)
Comment 2 Klaas Jan Russcher 2015-09-30 11:09:50 UTC
Created attachment 312418 [details]
cpp-file of the appsink-src.c file

The problem can be replicated by executing the following command on the file (the problem will occur during the second command):

g++ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/local/include/gstreamer-1.0 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"appsink-src2.d" -MT"appsink-src2.d" -o "appsink-src2.o" "./appsink-src2.cpp"

g++  -o "test"  ./appsink-src2.o   -lglib-2.0 -lgstbase-1.0 -lgobject-2.0 -lgstreamer-1.0 -lgstapp-1.0
Comment 3 Klaas Jan Russcher 2015-09-30 11:24:03 UTC
Well, I am very sorry that I bothered you with this 'problem'. I use Eclipse and all gstreamer programs compiled fine until I used gst_app_src_push_sample. Solution to the problem is to add -L/user/local/lib/ as library search path to g++ (I found this out by looking at what pkg-config returns). Apparently not including /usr/local/lib/ as library search path works until you use new added functions.