This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linking gstreamer code into CCS for Sitara am335x : undefined references for gstreamer functions

I am trying to build my first gstreamer app with TI-SDK-v7.0-am335x package.

I am using CCS v5.3.0 and wrote a Hello world gstreamer code. In CCS Properties for my project, I added the include files path and library files paths ( ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/lib). But when I compile the code, I get following errors about gstreamer basic functions missing their references during linking:

gst_init'

`gst_parse_launch'

`gst_element_set_state'

`gst_element_get_bus'

 `gst_bus_timed_pop_filtered'

`gst_object_unref'

`gst_element_set_state'

`gst_object_unref

Those functions have their prototypes defined in gst.h

What I am missing here?

Here is below the output of my console in CCS:

////////////////////////////////////////////////////////////////////////////////

make all

Building target: gstHello

Invoking: Cross GCC Linker

arm-linux-gnueabihf-gcc -L/home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/lib -o "gstHello" ./gsthello.o

./gsthello.o: In function `gst_message_unref':

/home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/include/gstreamer-0.10/gst/gstmessage.h:347: undefined reference to `gst_mini_object_unref'

./gsthello.o: In function `main':

/home/ti-sdk-am335x-evm-06.00.00.00/example-applications/Gstreamer/hstHello/Debug/../gsthello.c:25: undefined reference to `gst_init'

...

...

collect2: error: ld returned 1 exit status

make: *** [gstHello] Error 1

11:43:21 Build Finished (took 219ms)

///////////////////////////////////////////////////////////////////////////////

  • Moving this to the CCS forum.

  • PEleph said:
    But when I compile the code, I get following errors about gstreamer basic functions missing their references during linking:

    In general, undefined symbol errors during linking means that the linker has encountered a symbol for which it cannot find a definition. The key to resolving the error is to ensure that the file(s) containing the definition is part of the project, either in the form of a C source file (that get compiled and linked into the project) or in the form of a library. 

    Having said that, I don't have expertise with gstreamer to be able to tell exactly what you are missing. I will see if I can get someone else to comment further on that.

  • Thank you for the reply. It seems to me that these undefined symbols are defined in libraries such as libgstreamer-0.10.so and others located under
    /home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/lib/. So, as I said, I did include this path into CCS Project Properties (Properties->C/C++ General->Paths and Symbols), but that did not help... the symbols are still not being seen...
    May be an expert of Gstreamer Integration into TI-SDK can help me figure out which libraries need to be included in my CCS project and where/how to do that into CCS?
    I am using TI-SDK-am335x-v6.0 and CCS v 5.3.0.
  • This might be a silly question, but in addition to including the path to the library, did you also add the library itself to the linker options? The link command line that you posted earlier showed the -L option with the path to the library but I didn't see the name of the library itself. Could you check if the library itself has also been added? 

    If this still does not help resolve the error, I would suggest starting a new thread in the Linux forum as they may be able to offer more expert advice.

  • When I add the library itself, I get an error from the linker saying it "cannot find" the library even though the library (libgstreamer-0.10.so) is plainly there and I actually added this library from the CCS menu by browsing to the path and selecting the library file. (I get the same "cannot find" error for any library that I try to add)

    It seems to me this is an issue with CCS tool not reading/parsing the libraries paths correctly, instead of Linux issue that's why I am hesitate to put the question in the Linux forum.

    So, the question now is why the library is not find even though it is there?

    Console output:

    ///////////////////////////////////////

    make all

    Building target: gstHello

    Invoking: Cross GCC Linker

    arm-linux-gnueabihf-gcc -L/home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/lib -L/home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/lib/pkgconfig -L/home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/libexec/gstreamer-0.10 -L/home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/lib -o "hstHello"  ./gsthello.o   -l/home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/lib/libgstreamer-0.10.so

    /home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -l/home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/lib/libgstreamer-0.10.so

    collect2: error: ld returned 1 exit status

    make: *** [hstHello] Error 1

  • With gcc, library names are generally specified without the lib prefix and the .so or .a extension. This reference I found on the web may be helpful:

    http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

  • Thank you for the link. Yes, that link helps understand that I need to include the .so library file and that is what I did in CCS. But the problem is that CCS still cannot see the file!!!! I am wondering why? The file provided in CCS "include libraries" option is exactly there. If I do a "listing" (>ls) into the folder for the library, I do get the file in the list of files in that folder, but CCS still say "cannot found" for SOME REASONS!! THis is where I need help!!

    /////////////
    /home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -l/home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/lib/libgstreamer-0.10.so
    ///////////////////////////////

    > cd /home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/lib
    > ls libgstrea*
    libgstreamer-0.10.so libgstreamer-0.10.so.0 libgstreamer-0.10.so.0.30.0

  • PEleph said:
    cannot find -l/home/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/lib/libgstreamer-0.10.so

    Try removing the "-l" at the front of the library filename

  • -l is added by default by CCS when you put in a library into CCS linker options. Not sure how that can be removed?
  • Can you post a screenshot of your CCS linker settings - where the library search path and library names are specified?
  • Thank you for your support: Here is the screen shot of my settings for the libraries. I did not have a -l character in front of the library path if that is what we are suspecting here...

    Library libgstreamer-0.10.so :

    gstreamer libraries Path:

  • Given that the "Library Paths" has the directory for the library, under "Libraries" just enter gstreamer-0.10

    This is because the Linux linker adds the "lib" prefix and ".so" suffix to the library name supplied on the command line with the Libraries (-l) option.

  • Putting just the name of the library without the .so make the linker works like a charm :-)

    Thank you very much for your support. I appreciate it. May be this tip should be added somewhere in TI-CCS guide.

  • PEleph said:

    Putting just the name of the library without the .so make the linker works like a charm :-)

    Thank you very much for your support. I appreciate it. May be this tip should be added somewhere in TI-CCS guide.

    I had mentioned in one of my earlier posts that gcc expects library names without the "lib" prefix and "so" extension, and it is also there in the Linux reference I had sent you, but I guess it is easy to miss. :-)

    I don't think it is mentioned in any CCS guide, as it is more a GCC/Linux thing than a CCS thing. It is mentioned in a couple of TI wiki articles that talk about using GCC in CCS with some other devices (like Tiva C), but I didn't send you that reference as I thought it might confuse further (not being directly related to Sitara and gstreamer that you were working with).

    In any case, I am glad you have things working now.