How to build gstreamer project using MinGW? - c

I've installed the following two msi on my Windows 7 (basic) 64-bit — I downloaded the msi from here.
gstreamer-sdk-devel-x86_64-2013.6.msi
gstreamer-sdk-x86_64-2013.6.msi
Now I'm trying to build this hello world program using MinGW (GCC 4.8.1) and the linker is giving me trouble, saying this:
C:\Users\Apelles\AppData\Local\Temp\ccwLMXuu.o: In function `gst_message_unref':
C:/gstreamer-sdk/0.10/x86_64/include/gstreamer-0.10/gst/gstmessage.h:347: undefined reference to `gst_mini_object_unref'
C:\Users\Apelles\AppData\Local\Temp\ccwLMXuu.o: In function `main':
F:\projects\gstreamer/helloworld.c:9: undefined reference to `gst_init'
F:\projects\gstreamer/helloworld.c:12: undefined reference to `gst_parse_launch'
F:\projects\gstreamer/helloworld.c:15: undefined reference to `gst_element_set_state'
F:\projects\gstreamer/helloworld.c:18: undefined reference to `gst_element_get_bus'
F:\projects\gstreamer/helloworld.c:19: undefined reference to `gst_bus_timed_pop_filtered'
F:\projects\gstreamer/helloworld.c:24: undefined reference to `gst_object_unref'
F:\projects\gstreamer/helloworld.c:25: undefined reference to `gst_element_set_state'
F:\projects\gstreamer/helloworld.c:26: undefined reference to `gst_object_unref'
collect2.exe: error: ld returned 1 exit status
Which lib(s) am I missing?
Here are options which I used to build the project (taken from my make output):
gcc helloworld.c -ggdb -Wall -Wextra -ansi -std=c99 -Wno-unused-parameter -mms-bitfields -IC:/gstreamer-sdk/0.10/x86_64/include/gtk-2.0 -IC:/gstreamer-sdk/0.10/x86_64/lib/gtk-2.0/include -IC:/gstreamer-sdk/0.10/x86_64/include/atk-1.0 -IC:/gstreamer-sdk/0.10/x86_64/include/cairo -IC:/gstreamer-sdk/0.10/x86_64/include/gdk-pixbuf-2.0 -IC:/gstreamer-sdk/0.10/x86_64/include/pango-1.0 -IC:/gstreamer-sdk/0.10/x86_64/include/glib-2.0 -IC:/gstreamer-sdk/0.10/x86_64/lib/glib-2.0/include -IC:/gstreamer-sdk/0.10/x86_64/include/pixman-1 -IC:/gstreamer-sdk/0.10/x86_64/include/fontconfig -IC:/gstreamer-sdk/0.10/x86_64/include/freetype2 -IC:/gstreamer-sdk/0.10/x86_64/include -IC:/gstreamer-sdk/0.10/x86_64/include/libpng15 -mms-bitfields -IC:/gstreamer-sdk/0.10/x86_64/include/gstreamer-0.10 -IC:/gstreamer-sdk/0.10/x86_64/include/glib-2.0 -IC:/gstreamer-sdk/0.10/x86_64/lib/glib-2.0/include -IC:/gstreamer-sdk/0.10/x86_64/include/libxml2 -LC:/gstreamer-sdk/0.10/x86_64/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lintl -LC:/gstreamer-sdk/0.10/x86_64/lib -lgstinterfaces-0.10 -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lxml2 -lglib-2.0 -lintl
What is lacking in this?
What should I do in order to resolve this?

I suspect your are using MinGW's default GCC compiler which targets the x86 architecture but you have downloaded the x86_64 version of the SDK. The linker can find the libraries but I won't be able to use them.
We strongly recommend to use cerbero's build system to setup the development environment. It will take care of downloading a working toolchain and compile all the build dependencies (autotools, gettext, libtoo, pkg-config, etc...)
You will find detailed instructions here in the section Build a single project with the SDK
In short:
checkout cerbero's repo
run the bootstrap command with: ./cerbero-uninstalled -c config/win64.cbc bootstrap
enter the development shell with: ./cerbero-uninstalled -c config/win64.cbc shell

Related

Undefined refrence in a linked library [duplicate]

This question already has answers here:
Why does the order in which libraries are linked sometimes cause errors in GCC?
(9 answers)
Closed 2 years ago.
Found this link to a c script that claims to take a screenshot of the running machine, so I copied it and installed all that libraries needed for compiling this file
Hereyou can find info on how to to install the cairo lib
I am using gcc to compile the script and I tried compiling using the following commands
gcc -I/usr/include/cairo -lcairo -lX11 pic.c
gcc -I/usr/include/cairo -lX11 pic.c
gcc -Wall -I/usr/include/cairo -lm -lX11 pic.c
This is what i get when compiling
/usr/bin/ld: /tmp/ccOh9u2g.o: in function `main':
pic.c:(.text+0x91): undefined reference to `XOpenDisplay'
/usr/bin/ld: pic.c:(.text+0x15e): undefined reference to `cairo_xlib_surface_create'
/usr/bin/ld: pic.c:(.text+0x175): undefined reference to `cairo_surface_write_to_png'
/usr/bin/ld: pic.c:(.text+0x181): undefined reference to `cairo_surface_destroy'
collect2: error: ld returned 1 exit status
this is what i am using
Target: x86_64-linux-gnu
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
You need to mention the libraries after the source files, so that the compiler knows where to look for the dependencies. In other words, the linker will search the libraries placed after the source file, for the functions called from the source file.
Something like
gcc -I/usr/include/cairo pic.c -lcairo -lX11
gcc -I/usr/include/cairo helloworld.c -lX11
gcc -Wall -I/usr/include/cairo helloworld.c -lm -lX11
should do the job.

How to build GTK+ APP for ARM based of Linux platform

Could you help to solve this problem?
I am trying to cross-compile a sample GTK+ application for freescale i.MX-6 arm based processor
i have exported my Toolchain path
**export PATH=/u02/tools/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin:$PATH**
and i am trying to cross-compile the application by using following sequence
**arm-none-linux-gnueabi-gcc gtk-frameless.c -o frameless `pkg-config --cflags=-I/U02/tools/DOP/imx6/rootfs/usr/include gtk+-2.0` `pkg-config --libs=-L/U02/tools/DOP/imx6/rootfs/usr/lib/ -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype`**
and i am stuck with the following error
**-lgtk-x11-2.0: unknown option
/tmp/ccn3JmIw.o: In function main':
gtk-frameless.c:(.text+0x24): undefined reference togtk_init'
gtk-frameless.c:(.text+0x2c): undefined reference to `gtk_window_new'
gtk-frameless.c:(.text+0x38): undefined reference to `gtk_widget_show'
gtk-frameless.c:(.text+0x3c): undefined reference to `gtk_main'
collect2: ld returned 1 exit status**
in my case i guess i was unable to specify the path of the libraries correctly..?
Is my guess correct or apart from that am i doing any thing wrong,please guide me, to make it compile or provide links of related documents,so that i can try myself.
Any thing would be helpful.
Thankyou
i guess i was unable to specify the path of the libraries correctly..?
Yup. Take a close look at the actual flags you pass. These calls do not actually work (try them and see the results):
pkg-config --cflags=-I/U02/tools/DOP/imx6/rootfs/usr/include gtk+-2.0
pkg-config --libs=-L/U02/tools/DOP/imx6/rootfs/usr/lib/ -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype
You've got two basic options: either you use pkg-config like this
pkg-config --cflags gtk+-2.0
pkg-config --libs gtk+-2.0
which gives you the libraries and headers that your pkg-config knows about...
Or you construct the includes and linker flags by hand to point to the cross-compile target header and library locations.
If you're lucky you may be able to use PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_LIBDIR env variables to enable the use of pkg-config even for cross-compiling (see pkg-config documentation). Some cross-development environments (say, Yocto/openembedded) will do this for you.

MonetDB test client application not linking

I tried to compile test application for MonetDB under Ubuntu 14.04 LTS Trusty Tahr. I followed the download instructions from official site, installation was successful, then I installed a bunch of other packages in order to copmpile it. Now when I try to compile and link test application I get the following errors:
libtool: compile: gcc -c -I/usr/include/monetdb test.c -fPIC -DPIC -o .libs/test.o
libtool: compile: gcc -c -I/usr/include/monetdb test.c -o test.o >/dev/null 2>&1
libtool: link: gcc -o test test.o -lmapi -lstream -lssl -lcrypto -lcurl -lz
test.o: In function `die':
test.c:(.text+0x1c): undefined reference to `mapi_explain_query'
test.c:(.text+0x27): undefined reference to `mapi_result_error'
test.c:(.text+0x3f): undefined reference to `mapi_explain_result'
test.c:(.text+0x4a): undefined reference to `mapi_next_result'
test.c:(.text+0x5a): undefined reference to `mapi_close_handle'
test.c:(.text+0x65): undefined reference to `mapi_destroy'
test.c:(.text+0x81): undefined reference to `mapi_explain'
test.c:(.text+0x8c): undefined reference to `mapi_destroy'
test.o: In function `query':
test.c:(.text+0xde): undefined reference to `mapi_query'
test.c:(.text+0xf2): undefined reference to `mapi_error'
test.o: In function `update':
test.c:(.text+0x133): undefined reference to `mapi_close_handle'
test.o: In function `main':
test.c:(.text+0x190): undefined reference to `mapi_connect'
test.c:(.text+0x1a0): undefined reference to `mapi_error'
test.c:(.text+0x222): undefined reference to `mapi_fetch_field'
test.c:(.text+0x23a): undefined reference to `mapi_fetch_field'
test.c:(.text+0x266): undefined reference to `mapi_fetch_row'
test.c:(.text+0x276): undefined reference to `mapi_close_handle'
test.c:(.text+0x282): undefined reference to `mapi_destroy'
collect2: error: ld returned 1 exit status
./t.sh: 11: ./t.sh: ./test: not found
What I'm doing wrong? What should I additionally install or change in compilation options for successful linking of test example?
I was able to compile the example on Ubuntu 14.04 with MonetDB installed from the Ubuntu binary packages after installing the (additional) package libmonetdb-client-dev with the following command:
gcc test.c -I /usr/include/monetdb -lmapi
Did you compile and install MonetDB from source? In this case, which prefix was used?
Here how it worked using ubuntu 18.04
gcc main.c -I /usr/include/monetdb -lmapi -lssl -lcrypto -lstream -lcurl -llzma -lbz2

Unable to make ethping program because of missing pcap definitions

I seem to be having an issue building the ethping executable. It cannot find any of the functions that are defined in pcap.h.
At first I thought it wasn't finding pcap.h, but I have checked the $PATH and /usr/include is there (the pcap.h there is a stub that then includes pcap/pcap.h, but that looks all good too).
I even tried -I /usr/include and -I /usr/include/pcap, but still no luck.
I have searched through tons of forum postings, but could not find a solution. So that's why I am here. Any ideas?
root:src# gcc -Wall -Werror -ggdb -g -O2 -lpcap -o ethping ethping.o ieee8021ag.o dot1ag_eth.o
ethping.o: In function `timeout_handler':
/home/ubuntu/Downloads/dot1ag-utils-master/src/ethping.c:65: undefined reference to `pcap_breakloop'
ethping.o: In function `main':
/home/ubuntu/Downloads/dot1ag-utils-master/src/ethping.c:183: undefined reference to `pcap_open_live'
/home/ubuntu/Downloads/dot1ag-utils-master/src/ethping.c:202: undefined reference to `pcap_compile'
/home/ubuntu/Downloads/dot1ag-utils-master/src/ethping.c:203: undefined reference to `pcap_setfilter'
/home/ubuntu/Downloads/dot1ag-utils-master/src/ethping.c:254: undefined reference to `pcap_next_ex'
/home/ubuntu/Downloads/dot1ag-utils-master/src/ethping.c:257: undefined reference to `pcap_perror'
collect2: error: ld returned 1 exit status
Similarly:
root:src# gcc -Wall -Werror -ggdb -g -O2 -lpcap -I /usr/include/pcap -o ethping ethping.o ieee8021ag.o dot1ag_eth.o
ethping.o: In function `timeout_handler':
/home/ubuntu/Downloads/dot1ag-utils-master/src/ethping.c:65: undefined reference to `pcap_breakloop'
ethping.o: In function `main':
/home/ubuntu/Downloads/dot1ag-utils-master/src/ethping.c:183: undefined reference to `pcap_open_live'
/home/ubuntu/Downloads/dot1ag-utils-master/src/ethping.c:202: undefined reference to `pcap_compile'
/home/ubuntu/Downloads/dot1ag-utils-master/src/ethping.c:203: undefined reference to `pcap_setfilter'
/home/ubuntu/Downloads/dot1ag-utils-master/src/ethping.c:254: undefined reference to `pcap_next_ex'
/home/ubuntu/Downloads/dot1ag-utils-master/src/ethping.c:257: undefined reference to `pcap_perror'
collect2: error: ld returned 1 exit status
root:src#
Changing the compile line fixed it. Placing -lpcap at the far right got it going as suggested.
gcc -Wall -Werror -ggdb -g -O2 -o ethping ethping.o ieee8021ag.o dot1ag_eth.o -lpcap
Either you are invoking the linker without the arguments to include the libpcap library, or the libraries are not installed. See http://www.tcpdump.org/ to obtain the library. Or if you are on a well-supported distribution, use the applicable install command:
sudo apt-get install libpcap-dev
or
sudo yum install libpcap-dev

Gnatmake undefined reference (libcairo)

I get the following if I try to compile the GtkAda minimal example of GNAT Programming Studio 6.1.0w:
...
gnatlink /home/myuser/own projects/ada/obj/main.ali -shared-libgcc -g -g -L/usr/lib/x86_64-linux-gnu/ -lgtkada -lgmodule-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lfontconfig -lfreetype -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lX11 -lm -o /home/gabre/own projects/ada/obj/main
/usr/lib/x86_64-linux-gnu//libcairo.so: undefined reference to `pixman_filter_create_separable_convolution'
/usr/lib/x86_64-linux-gnu//libcairo.so: undefined reference to `pixman_glyph_cache_remove'
/usr/lib/x86_64-linux-gnu//libcairo.so: undefined reference to `pixman_glyph_cache_freeze'
/usr/lib/x86_64-linux-gnu//libcairo.so: undefined reference to `pixman_glyph_cache_thaw'
/usr/lib/x86_64-linux-gnu//libcairo.so: undefined reference to `pixman_composite_glyphs'
/usr/lib/x86_64-linux-gnu//libcairo.so: undefined reference to `pixman_glyph_cache_lookup'
/usr/lib/x86_64-linux-gnu//libcairo.so: undefined reference to `pixman_glyph_get_mask_format'
/usr/lib/x86_64-linux-gnu//libcairo.so: undefined reference to `pixman_glyph_cache_insert'
/usr/lib/x86_64-linux-gnu//libcairo.so: undefined reference to `pixman_glyph_cache_create'
/usr/lib/x86_64-linux-gnu//libcairo.so: undefined reference to `pixman_composite_glyphs_no_mask'
collect2: ld returned 1 exit status
gnatlink: error when calling /usr/bin/gcc-4.6
The command executed by GPS:
gnatmake -d -P/home/myuser/own projects/ada/AdaTest.gpr -vP2 -j4 -g
The same command works if I try it from a terminal and it also worked in GPS 5.0 (which executed the same command as the newest, 6.1.0w)
What can cause this and how can I make GPS work?
You asked the same question on comp.lang.ada I believe. Just for the record, the answer from Ludovic Brenta was to: install libpixman-1-dev, and then edit the Linker'Linker_Options switch in your project file so that it contains "-lpixman-1".
It is possible that when running from GPS, the linker sees a different version of one of the libraries that come with gtk+, and this would have a different list of dependencies.

Resources