Hi all, I need someone who knows about Eclipse settings a bit. I try to compile gstreamer application for ARM board (Phytec-nunki board in my case, IMX6Quad).
My Eclipse version is: Eclipse IDE for C/C++ Developers Version: Photon Release (4.8.0).
I will try to describe step-by-step what I have done, and clarify the issue as much as I can.
First of all I have a simple linux project with the default invokes of gst functions. Smth like:
#include </opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi/usr/include/gstreamer-1.0/gst/gst.h
...
gst_init(&argc, &argv);
pipeline = gst_pipeline_new("test-pipeline");
...
Then into Properties->C/C++ Build->Settings I set up the next:
GCC C Compiler:
Command: ${CC}
GCC C Compiler->Miscellaneous:
Other flags: `pkg-config --cflags --libs gstreamer-1.0`
GCC C Linker:
Command: ${CC}
Command line pattern: ${LDFLAGS} (added it between {COMMAND} and {FLAGS})
GCC Assembler:
Command: ${AS}
After compiling it in this way I have got an error
….
Building target: gstTry3
Invoking: GCC C Linker
arm-phytec-linux-gnueabi-gcc -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o "gstTry3" ./main.o
./main.o: In function `gst_message_unref':
/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi/usr/include/gstreamer-1.0/gst/gstmessage.h:379: undefined reference to `gst_mini_object_unref'
makefile:29: recipe for target 'gstTry3' failed
…
Then I decided to include paths to gstreamer libs and so on.
Properties->C/C++ Build->Settings
GCC C Compiler->Includes
/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi/usr/include/gstreamer-1.0
/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi/usr/lib
/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi/usr/lib/glib-2.0/include
/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi/usr/include/glib-2.0
I tried to compile again.
The same error:
….
Building target: gstTry3
Invoking: GCC C Linker
arm-phytec-linux-gnueabi-gcc -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o "gstTry3" ./main.o
./main.o: In function `gst_message_unref':
/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi/usr/include/gstreamer-1.0/gst/gstmessage.h:379: undefined reference to `gst_mini_object_unref'
makefile:29: recipe for target 'gstTry3' failed
…
After that I found an additional info about linking the .so lib. I did it in the next way:
Properties->C/C++ Build->Settings
GCC C Linker->Libraries
Libraries (-l(lowercase “L”))
/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi/usr/lib/libgstreamer-1.0.so
Library search path (-L)
/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi/usr/lib
During compiling I have got the next error:
Building target: gstTry3
Invoking: GCC C Linker
arm-phytec-linux-gnueabi-gcc -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -L/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi/usr/lib -o "gstTry3" ./main.o -l/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi/usr/lib/libgstreamer-1.0.so
/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/x86_64-phytecsdk-linux/usr/libexec/arm-phytec-linux-gnueabi/gcc/arm-phytec-linux-gnueabi/7.3.0/real-ld: cannot find -l/opt/phytec-yogurt/BSP-Yocto-i.MX6-PD18.1.0/sysroots/cortexa9hf-neon-phytec-linux-gnueabi/usr/lib/libgstreamer-1.0.so
collect2: error: ld returned 1 exit status
makefile:29: recipe for target 'gstTry3' failed
make: *** [gstTry3] Error 1
I wondered a bit, because there is a libgstreamer-1.0.so is in necessary directory. I have checked it twice.
So, does anyone know what was going wrong and where did I fail?
Feel free to ask me for any additional info.
Thanks in advance!
Hi Sergey
one can look at general guidelines for gstreamer with eclipse
c - Adding GStreamer to Eclipse - Stack Overflow
https://elinux.org/images/c/c6/Exploring_Linux_Kernel_Source_Code_with_Eclipse.pdf
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------