Adding GStreamer to Eclipse - c

I've been trying to add gstreamer in Eclipse for cross-platform compilation of an Variscite I.mx6 development kit. GStreamer-SDK is installed according to Installing on Linux - GStreamer SDK documentation - GStreamer SDK documentation for the Ubuntu Host I'm running eclipse on. Now the problem is; according to the Ubuntu installation guide, I need to include into the gcc command the following string:
pkg-config --cflags --libs gstreamer-0.10
Most solutions i found on the web add this string to the eclipse project settings under C/C++ Build->Settings and configure there the gcc command line. Since I'm using the yocto project with the Yocto Project-plugin in Eclipse, I don't have access to those tabs anymore as I use a toolchain to cross compile my application. I've found other solutions from modifying the make file (http://ubuntuforums.org/showthread.php?t=1164725) or adding the command line to the Autotools configure settings. I've tried both, but they didn't work. I've also added the gstreamer SDK under Includes with the following path: /opt/gstreamer-sdk/.
If anyone could help me out with this problem on how to configure Eclipse or my makefile, I'd be most grateful.

follow this instruction to compile gstreamer sdk using eclipse IDE
Note:
compile using hello world gstreamer application program
goto properties in your project->c/c++build->tool settings->settings
under gcc compiler select the include section and add the following details
/opt/gstreamer-sdk/include/gstreamer-0.10
/usr/include/gstreamer-0.10
/opt/gstreamer-sdk/include
/opt/gstreamer-sdk/include/glib-2.0
/opt/gstreamer-sdk/lib/glib-2.0/include
/opt/gstreamer-sdk/include/glib-2.0/glib
/opt/gstreamer-sdk/include/glib-2.0/gobject
/opt/gstreamer-sdk/include/libxml2/
/opt/gstreamer-sdk/include/ogg
/opt/gstreamer-sdk/include/theora
/opt/gstreamer-sdk/include/vorbis
/opt/gstreamer-sdk/include/wavpack
/opt/gstreamer-sdk/include/gtk-2.0/gtk
now goto Build Steps section
and add this command into pre-build steps
/opt/gstreamer-sdk/bin/gst-sdk-shell
goto c/c++ Build->Environment and add the following data into it
Note:these information are noting but script data from "/opt/gstreamer-sdk/bin/gst-sdk-shell"
GSTREAMER_SDK_ROOT /opt/gstreamer-sdk
GST_REGISTRY_1_0 ${HOME}/.cache/gstreamer-1.0/gstreamer-sdk-registry
XDG_CONFIG_DIRS /etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:${GSTREAMER_SDK_ROOT}/etc/xdg${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}:/etc/xdg
LDFLAGS ${GSTREAMER_SDK_ROOT}/lib ${LDFLAGS}
XDG_DATA_DIRS /usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:${GSTREAMER_SDK_ROOT}/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}:/usr/local/share:/usr/share
PYTHONPATH ${GSTREAMER_SDK_ROOT}/lib/python2.7/site-packages${PYTHONPATH:+:$PYTHONPATH}
GIO_EXTRA_MODULES ${GSTREAMER_SDK_ROOT}/lib/gio/modules
CXXFLAGS ${GSTREAMER_SDK_ROOT}/include ${CXXFLAGS}
GST_PLUGIN_SCANNER ${GSTREAMER_SDK_ROOT}/libexec/gstreamer-0.10/gst-plugin-scanner
GST_PLUGIN_SCANNER_1_0 ${GSTREAMER_SDK_ROOT}/libexec/gstreamer-1.0/gst-plugin-scanner
CFLAGS ${GSTREAMER_SDK_ROOT}/include ${CFLAGS}
PKG_CONFIG_PATH /opt/gstreamer-sdk/lib/pkgconfig:${GSTREAMER_SDK_ROOT}/lib/pkgconfig:${GSTREAMER_SDK_ROOT}/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}
PATH /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/sbin:/sbin:/usr/games:/usr/local/games:${GSTREAMER_SDK_ROOT}/bin${PATH:+:$PATH}:/usr/local/bin:/usr/bin:/bin
GST_REGISTRY ${HOME}/.gstreamer-0.10/gstreamer-sdk-registry
LD_LIBRARY_PATH /usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/client:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386:${GSTREAMER_SDK_ROOT}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
save the project and build it .. it should compile without error
now add the argument files into the run configuration
right click the project and select RunAs->RunConfiguration->create new(if not created)config file->argument(x)
add the input files and output files here
ex:
test.ogg output-test.ogg
now run the project if everything is fine.
Note:
this above procedure is for x86 architecture only if you are using other than x86 arch ,then include appropriate architecture libraries and files to compile and exclude which are not needed!!!!!

Related

Eclipse: I can run a program but I couldn't debug it

I have downloaded the well-known linuxptp source code (C language) from:
git clone git://git.code.sf.net/p/linuxptp/code linuxptp
It is a makeFile project which I could successfully run from command line, however the problem appears when I try to import it to Eclipse:
File > New > Makefile project with existing code
I can successfully build it and run it but I couldn't debug or force it to stop at a break point. I keep getting the message (No source available for "main() at 0x401eb5").
I tried to reinstall Eclipse IDE for C/C++ Developers from the official website but it didn't work.
I think it is useful to mention that:
- the source code I'm using contains different files with main() function
- Eclipse debugger runs successfully on projects created on Eclipse from scratches
Any ideas?
thanks.
You should create some debugging launch configurations for your different executables in the project.
Also be sure that the Makefiles include -g option when compiling to produce the required debugging information.
Edit:
Add this lines to your Makefiles:
CFLAGS += -g
CXXFLAGS += -g

Having Difficulty Integrating JSON Library with My AVR Microcontroller Code

I am a relatively inexperienced C developer with no previous experience in integrating libraries made by other developers into existing projects.
Basically, I need a means of parsing JSON data in an AVR microcontroller for a university project. To this end I attempted to download and integrate jansson (https://github.com/akheron/jansson) into my existing build of the microcontroller code. I am working with Atmel Studio in Windows 10, but I have also installed Code::Blocks with MinGW GCC (on the same Windows 10 installation) for the purpose of building the library, and to attempt to integrate the library into a native Windows application. So far, neither has been successful, and I get the same errors. All of the online resources I've found so far have been to basic to be useful, or well beyond my comprehension.
This is what I have done thus far:
I began by attempting to build the software and then integrate it into an existing project per the instructions in https://jansson.readthedocs.io/en/2.11/gettingstarted.html. I installed CMake, built the project files for Code::Blocks with cmake.exe -G “CodeBlocks - MinGW Makefiles”, then opened the project and built everything. A few of the targets (I believe related to testing) failed to build, but jansson itself built and output libjansson.a to the \lib\ directory, so I didn’t think too much of it.
That is as far as I’ve been able to get. In both Atmel Studio and Code::Blocks, I do the same thing: add jansson.h to the relevant include paths, add #include “jansson.h” to all of the relevant files, and add libjansson.a as a library in each IDE’s respective linker options. I’ve tried various things like adding and removing flags to the linker, but the output is always “cannot find -ljansson”, “undefined reference to ‘json_object_seed’” (which is a function in the API I’m calling for no reason other than to see if the project has built properly) and/or “ld returned 1 exit status”.
I cannot help but feel as if the issue is with the line “cc -o prog prog.c -ljansson” in the documentation linked above. I really just don’t understand how to set up the linker properly to get the project to build.
If anyone could give some insight into what I’m doing wrong/the correct way to link this library I would appreciate it a lot.
The library itself should be built with appropriate toolchain. I assume that you built your library twice, one version using MinGW toolchain and other with avr-gcc toolchain.
If you compile target application and linker cannot find library, then try to add path of directory that contains *.a file of library to linker settings (linker search path). Let's say you have: /path/to/lib/libjansson.a
In Code::Blocks: Project → Build options → Search directories → Linker add /path/to/lib/. Then it should link with include path set, for example: cc -o prog prog.c -ljansson -L/path/to/lib/
In Atmel Studio when you add a library in Solution Explorer → Libraries → Add Library it should automatically add library search path to linker options. If you check Project → Properties → AVR/GNU Linker there should be (between other options): -Wl,-ljansson -Wl,-L"/path/to/lib/"
If you copied library files (libjansson.a and jansson.h) to your application's project directory, it will be convenient to use relative paths to library files.

libwebsockets.h - no such file or directory, Ubuntu, arm-linux-gcc cross compiler

I am building a web server using the libwebsockets library on a TS-7800 board using the arm-linux-gcc cross compiler. Using Ubuntu. Installed CMake, OpenSSL, and libwebsockets and built the library per the instructions on Github.
I made a "hello world" C file which #includes libwebsockets.h
When I compile the executable with gcc, it compiles fine and the .exe runs.
When I compile with arm-linux-gcc, I get the following:
root#gordon-MS-7A39:/# arm-linux-gcc -o hellosockets /home/gordon/workspace/HelloCrossWorld/hello_cross.c
/home/gordon/workspace/HelloCrossWorld/hello_cross.c:3:27: libwebsockets.h: No such file or directory
It appears that arm-linux-gcc compiler cannot "see" the header file for libwebsockets. I'm guessing that the installation of the websockets library was successful because gcc can see it.
How do I enable the arm cross compiler to see the libwebsockets.h file?
Thank you for your input!
You'll need to add armhf architecture to your package management system. Perform the following actions as super user:
dpkg --add-architecture armhf
apt update
apt install libwebsockets-dev:armhf
Make sure you're also using the armhf toolchain:
apt install binutils-arm-linux-gnueabihf g++-arm-linux-gnueabihf
Alternatively, take a look at Buildroot
I was unaware of the -I and -L preprocessor options for gcc and arm-linux-gcc.
I was able to add libraries to the project and will look into creating makefiles for the project.

Compiling an MPI program with mingw and MPICH2 in eclipse juno

Ive been trying to setup mpich2 to compile some programs using MPI on windows 7. The problem that I encounter is that it wont create the binary files when I build a project.
I use the stadard mpi program to test (hello world) and I get this message after building it:
13:33:29 ** Rebuild of configuration Debug for project mpitest **
Info: Internal Builder is used for build mpiCC "-IC:\MPICH2\include"
-O0 -g3 -Wall -c -fmessage-length=0 -o "src\mpitest.o" "..\src\mpitest.c"
The Open MPI wrapper compiler was unable to find the specified
compiler cl.exe in your PATH.
Note that this compiler was either specified at configure time or in one of several
possible environment variables.
13:33:29 Build Finished (took 78ms)
I tried to search for cl.exe but it doesn't exist. I have to say that I also installed openMPI but I didn't use it cause the cluster that I am gonna target run the program is using MPICH2. I have already installed 32bit minGW, 32bit MPICH2 and 32bit openMPI.
Is it normal to not create binaries since i run the .c file in the cluster? If its normal how am i going to check if the program is ok even for 1 process?
Thanks in advance! Cheers!
I found the answer by luck... In the project preferences, select C/C++ build-> Tool Chain editor-> choose cygwin and its done. For some reason i had mingw in that option and wouldnt create binaries, i suppose it needs some other tools that can be found only in the cygwin and not mingw... Still trying to set it and run on the cluster... so many options :/

How do I cross-compile libsndfile for Arm/Raspberry Pi

I'm trying to get a working cross-compiler running under Linux (Debian squeeze amd64) but I can't seem to link my files with the installed libsndfile, I'm assuming I need to cross-compile the source to target the Raspberry-Pi and link to that version. But I can't seem to find straightforward instructions on doing the ./configure and make stage to compile to the target.
Note: I followed these steps: How do I build a GCC 4.7 toolchain for cross-compiling? to get the cross compiler built and using Eclipse.
Ok, what you want to do is something which you probably cannot do within Eclipse.
Instead you need a terminal (eg xterm or gnome-terminal). The you need to run the configure script with something along the lines of:
./configure --prefix=$HOME/Arm --build=i386-linux --host=arm-unknown-linux-gnueabi
Watch the configure output to make sure that the configure script picks up the correct compiler and then do:
make && make install
When you then want to build something else that links against the Arm binaries, make sure they get the headers from $HOME/Arm/include and link against the library in $HOME/Arm/lib.
You should be able to find lots of documentation about cross compiling stuff that uses autoconf generated configure scripts on the net.

Resources