I want to write an embedded GStreamer application for an ARM processor. I have a Freescale enviroment,which contains installed gstream-0.10 & cross-compiler toolchain.
I took a first Hello World application from GStream manual and tried to compile it by
arm-poky-linux-gnueabi-gcc video_1.c -o basic-tutorial-1 pkg-config --cflags --libs gstreamer-0.10
My gstreamer-0.10.pc consists:
prefix=/home/.../build_mx6q/tmp/sysroots/varsommx6q/usr
exec_prefix=/usr
libdir=/home/.../build_mx6q/tmp/sysroots/varsommx6q/usr/lib
includedir=/home/.../build_mx6q/tmp/sysroots/varsommx6q/usr/include/gstreamer-0.10
toolsdir=${exec_prefix}/bin
pluginsdir=/usr/lib/gstreamer-0.10
datarootdir=${prefix}/share
datadir=${datarootdir}
girdir=${datadir}/gir-1.0
typelibdir=${libdir}/girepository-1.0
Name: GStreamer
Description: Streaming media framework
Requires: glib-2.0, gobject-2.0, gmodule-no-export-2.0, gthread-2.0, libxml-2.0
Version: 0.10.36
Libs: -L${libdir} -lgstreamer-0.10
Cflags: -I${includedir}*
Compilation result:
warning: libffi.so.6, needed by /.../usr/lib/libgstreamer-0.10.so, not found (try using -rpath or -rpath-link)
warning: libz.so.1, needed by /.../usr/lib/libgstreamer-0.10.so, not found (try using -rpath or -rpath-link)
/home/.../usr/lib/libgobject-2.0.so: undefined reference to `ffi_type_pointer'
/home/.../usr/lib/libxml2.so: undefined reference to `inflateEnd'
/home/.../usr/lib/libxml2.so: undefined reference to `gzdirect#ZLIB_1.2.2.3'
/home/.../usr/lib/libxml2.so: undefined reference to `gzclose'
/home/.../usr/lib/libxml2.so: undefined reference to `deflate'
/home/.../usr/lib/libgobject-2.0.so: undefined reference to `ffi_type_float'
/home/.../usr/lib/libxml2.so: undefined reference to `inflateInit2_'
/home/.../usr/lib/libxml2.so: undefined reference to `inflate'
/home/.../usr/lib/libgobject-2.0.so: undefined reference to `ffi_type_void'
/home/.../usr/lib/libxml2.so: undefined reference to `gzwrite'
/home/.../usr/lib/libgobject-2.0.so: undefined reference to `ffi_type_sint64'
/home/.../usr/lib/libxml2.so: undefined reference to `crc32'
/home/.../usr/lib/libxml2.so: undefined reference to `deflateEnd'
...
collect2: error: ld returned 1 exit status
Something went wrong, but I don't understand what and where.
I still need a help.
Thank you.
Try this
arm-poky-linux-gnueabi-gcc video_1.c -o basic-tutorial-1 ` pkg-config --cflags --libs gstreamer-0.10`
Related
I'm a beginner in the Database community. I have been trying to interface with MonetDB using C/C++ MAPI. I have installed MonetDB on my Ubuntu 14.04 LTS machine and when I try to compile a sample program from here, I get the following error:
$ gcc test.c -I /usr/include/monetdb -lmapi
test.c:(.text+0x29): undefined reference to mapi_explain_query'
test.c:(.text+0x35): undefined reference tomapi_result_error'
test.c:(.text+0x50): undefined reference to mapi_explain_result'
test.c:(.text+0x5c): undefined reference tomapi_next_result'
test.c:(.text+0x6d): undefined reference to mapi_close_handle'
test.c:(.text+0x79): undefined reference tomapi_destroy'
test.c:(.text+0x98): undefined reference to mapi_explain'
test.c:(.text+0xa4): undefined reference tomapi_destroy'
/tmp/cctyQopc.o: In function query':
test.c:(.text+0xf9): undefined reference tomapi_query'
test.c:(.text+0x110): undefined reference to mapi_error'
/tmp/cctyQopc.o: In functionupdate':
test.c:(.text+0x160): undefined reference to mapi_close_handle'
/tmp/cctyQopc.o: In functionmain':
test.c:(.text+0x1b6): undefined reference to mapi_connect'
test.c:(.text+0x1c6): undefined reference tomapi_error'
test.c:(.text+0x238): undefined reference to mapi_fetch_field'
test.c:(.text+0x24d): undefined reference tomapi_fetch_field'
test.c:(.text+0x277): undefined reference to mapi_fetch_row'
test.c:(.text+0x287): undefined reference tomapi_close_handle'
test.c:(.text+0x293): undefined reference to `mapi_destroy'
collect2: error: ld returned 1 exit status
This question has previously been asked here and the answer did not solve the problem (although the answer was accepted, I'm not sure why). Any help/directions would be great!
On Ubuntu 18.04 using:
pkg-config --libs monetdb-mapi and pkg-config --cflags monetdb-mapi
Won't work because Ubuntu doesn't have a bzip2.pc:
Here how it worked:
gcc main.c -I /usr/include/monetdb -lmapi -lssl -lcrypto -lstream -lcurl -llzma -lbz2
I am using GTK+-3.0 in ubuntu 12.04. I am trying to compile program but every time fail
apple#ubuntu:~/Downloads$ gcc -Wall -g gtktest.c $(pkg-config --libs --cflags gtk+-3.0) -o gtktest
gtktest.c: In function ‘main’:
gtktest.c:21:3: warning: implicit declaration of function ‘gtk_signal_connect’ [-Wimplicit-function-declaration]
gtktest.c:21:3: warning: implicit declaration of function ‘GTK_OBJECT’ [-Wimplicit-function-declaration]
gtktest.c:21:3: warning: implicit declaration of function ‘GTK_SIGNAL_FUNC’ [-Wimplicit-function-declaration]
gtktest.c:22:3: warning: implicit declaration of function ‘gtk_container_border_width’ [-Wimplicit-function-declaration]
gtktest.c:28:3: warning: implicit declaration of function ‘gtk_signal_connect_object’ [-Wimplicit-function-declaration]
/tmp/ccH48jvQ.o: In function `main':
/home/apple/Downloads/gtktest.c:21: undefined reference to `GTK_SIGNAL_FUNC'
/home/apple/Downloads/gtktest.c:21: undefined reference to `GTK_OBJECT'
/home/apple/Downloads/gtktest.c:21: undefined reference to `gtk_signal_connect'
/home/apple/Downloads/gtktest.c:22: undefined reference to `gtk_container_border_width'
/home/apple/Downloads/gtktest.c:26: undefined reference to `GTK_SIGNAL_FUNC'
/home/apple/Downloads/gtktest.c:26: undefined reference to `GTK_OBJECT'
/home/apple/Downloads/gtktest.c:26: undefined reference to `gtk_signal_connect'
/home/apple/Downloads/gtktest.c:28: undefined reference to `GTK_OBJECT'
/home/apple/Downloads/gtktest.c:28: undefined reference to `GTK_SIGNAL_FUNC'
/home/apple/Downloads/gtktest.c:28: undefined reference to `GTK_OBJECT'
/home/apple/Downloads/gtktest.c:28: undefined reference to `gtk_signal_connect_object'
/usr/local/lib/libcairo.so: undefined reference to `pixman_glyph_cache_lookup'
/usr/local/lib/libcairo.so: undefined reference to `pixman_glyph_cache_insert'
/usr/local/lib/libcairo.so: undefined reference to `pixman_composite_glyphs'
/usr/local/lib/libcairo.so: undefined reference to `pixman_glyph_cache_remove'
/usr/local/lib/libcairo.so: undefined reference to `pixman_glyph_get_mask_format'
/usr/local/lib/libcairo.so: undefined reference to `pixman_composite_glyphs_no_mask'
/usr/local/lib/libcairo.so: undefined reference to `pixman_glyph_cache_thaw'
/usr/local/lib/libcairo.so: undefined reference to `pixman_glyph_cache_freeze'
/usr/local/lib/libcairo.so: undefined reference to `pixman_glyph_cache_create'
collect2: ld returned 1 exit status
With another command.
apple#ubuntu:~/Downloads$ gcc -Wall -g gtktest.c $(pkg-config --libs --cflags glib-2.0) -o gtktest
In file included from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:30:0,
from /usr/include/gtk-3.0/gdk/gdk.h:32,
from /usr/local/include/gtk-3.0/gtk/gtk.h:32,
from gtktest.c:1:
/usr/include/gtk-3.0/gdk/gdktypes.h:37:19: fatal error: cairo.h: No such file or directory
compilation terminated.
Any one how to solve this problem i am trying to solve this problem for last 4 days. Please someone can give me proper solution?
gtktest.c:21:3: warning: implicit declaration of function ‘gtk_signal_connect’
The code you are compiling was made for a very old version of GTK+. You will have to modify the code if you want it to compile, let alone work, with GTK+3. Compiling with GTK+2 will almost certainly be easier to start with.
/usr/local/lib/libcairo.so: undefined reference to `pixman_glyph_cache_lookup'
I'm guessing your version of cairo expects a newer pixman than what you are linking with: e.g. pixman_glyph_cache_lookup() was added in pixman 0.27.2.
The last example tries to compile GTK code without GTK include flags: that's just not going to work.
Use
-lcairo or $(pkg-config --libs --cflags cairo)
and -lpixman or -lpixman-1
I have installed zbar library and gtk library on Raspberry,but when I compile the example zbargtk.c that provided by the zbar,it can't be compiled.
The command I used is gcc -o testgtk testgtk.c pkg-config --libs --cflags gtk+-2.0 zbar.
I have spent three days to deal this problem,but I can't solve it.
Here are the errors i get:
pi#raspberrypi ~/Desktop $ gcc -o testgtk testgtk.c `pkg-config --libs --cflags gtk+-2.0 zbar`
testgtk.c: In function ‘main’:
testgtk.c:149:5: warning: ‘g_thread_init’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:261) [-Wdeprecated-declarations]
/tmp/ccF6LqbT.o: In function `video_enabled':
testgtk.c:(.text+0x12c): undefined reference to `zbar_gtk_get_type'
testgtk.c:(.text+0x148): undefined reference to `zbar_gtk_get_video_enabled'
testgtk.c:(.text+0x154): undefined reference to `zbar_gtk_get_video_opened'
/tmp/ccF6LqbT.o: In function `video_opened':
testgtk.c:(.text+0x1dc): undefined reference to `zbar_gtk_get_type'
testgtk.c:(.text+0x1f8): undefined reference to `zbar_gtk_get_video_opened'
testgtk.c:(.text+0x204): undefined reference to `zbar_gtk_get_video_enabled'
/tmp/ccF6LqbT.o: In function `video_changed':
testgtk.c:(.text+0x2b8): undefined reference to `zbar_gtk_get_type'
testgtk.c:(.text+0x300): undefined reference to `zbar_gtk_set_video_device'
/tmp/ccF6LqbT.o: In function `status_button_toggled':
testgtk.c:(.text+0x320): undefined reference to `zbar_gtk_get_type'
testgtk.c:(.text+0x33c): undefined reference to `zbar_gtk_get_video_opened'
testgtk.c:(.text+0x348): undefined reference to `zbar_gtk_get_video_enabled'
testgtk.c:(.text+0x378): undefined reference to `zbar_gtk_get_type'
testgtk.c:(.text+0x398): undefined reference to `zbar_gtk_set_video_enabled'
/tmp/ccF6LqbT.o: In function `open_button_clicked':
testgtk.c:(.text+0x55c): undefined reference to `zbar_gtk_get_type'
testgtk.c:(.text+0x57c): undefined reference to `zbar_gtk_scan_image'
/tmp/ccF6LqbT.o: In function `main':
testgtk.c:(.text+0x620): undefined reference to `g_thread_init'
testgtk.c:(.text+0x708): undefined reference to `zbar_gtk_new'
testgtk.c:(.text+0x920): undefined reference to `scan_video'
collect2: ld returned 1 exit status
I am trying to compile a simple example program that depends on a shared library (so) that depends on liblua51.so. My source file is example.c and here is the command I am using to compile it (it is written in C)
cc -Wall -fPIC -ldl -o a.out -I./ste-linux/ste-interface-files/c/ -L./ste-linux/ste-shared-libraries/ example.c -lm -llua51 -lste -lm -ldl
I am getting the following errors:
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `sinh'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `ceil'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `atan2'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `tanh'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `cosh'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `fmod'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `acos'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `sin'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `atan'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `asin'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `exp'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `tan'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `cos'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `log'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `pow'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `log10'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `sqrt'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `floor'
I have read a bunch of other threads on stackoverflow saying adding the -lm flag will fix this, but no matter where I put the -L and -lm -ldl in the command, these undefined references will not go away.
I am trying to compile this lib on ubuntu 12.04 LTS
Help please
The issue was the shared library I was using was built with a different version of GCC. After I downgrade from Ubuntu 11.04 (from 12.04 LTS) it was resolved.
I am porting an application that I developed in Linux to Windows and am having some issues when building the application. After making the necessary code changes, everything compiles fine (and when built as a debug build in Visual Studio, runs without any issues). I need to build this in MinGW, and I'm having linker errors when I try to link it against liboauth, which is also required for my project.
The command and its output are as follows:
gcc application.o service.o util.o json.o api.o -L/usr/local/lib -lcrypto -lssl -lcurl -ljansson -loauth -Wl -o application
C:/MinGW/msys/1.0/local/lib/liboauth.a(liboauth_la-hash.o): In function `oauth_sign_hmac_sha1_raw':
c:\lib\liboauth-0.9.4\src/hash.c:314: undefined reference to `EVP_sha1'
c:\lib\liboauth-0.9.4\src/hash.c:314: undefined reference to `HMAC'
C:/MinGW/msys/1.0/local/lib/liboauth.a(liboauth_la-hash.o): In function `oauth_sign_rsa_sha1':
c:\lib\liboauth-0.9.4\src/hash.c:334: undefined reference to `BIO_new_mem_buf'
c:\lib\liboauth-0.9.4\src/hash.c:335: undefined reference to `PEM_read_bio_PrivateKey'
c:\lib\liboauth-0.9.4\src/hash.c:336: undefined reference to `BIO_free'
c:\lib\liboauth-0.9.4\src/hash.c:343: undefined reference to `EVP_PKEY_size'
c:\lib\liboauth-0.9.4\src/hash.c:346: undefined reference to `EVP_sha1'
c:\lib\liboauth-0.9.4\src/hash.c:346: undefined reference to `EVP_DigestInit'
c:\lib\liboauth-0.9.4\src/hash.c:347: undefined reference to `EVP_DigestUpdate'
c:\lib\liboauth-0.9.4\src/hash.c:348: undefined reference to `EVP_SignFinal'
c:\lib\liboauth-0.9.4\src/hash.c:352: undefined reference to `CRYPTO_free'
c:\lib\liboauth-0.9.4\src/hash.c:353: undefined reference to `EVP_PKEY_free'
C:/MinGW/msys/1.0/local/lib/liboauth.a(liboauth_la-hash.o): In function `oauth_verify_rsa_sha1':
c:\lib\liboauth-0.9.4\src/hash.c:367: undefined reference to `BIO_new_mem_buf'
c:\lib\liboauth-0.9.4\src/hash.c:368: undefined reference to `PEM_read_bio_X509'
c:\lib\liboauth-0.9.4\src/hash.c:370: undefined reference to `X509_get_pubkey'
c:\lib\liboauth-0.9.4\src/hash.c:371: undefined reference to `X509_free'
c:\lib\liboauth-0.9.4\src/hash.c:375: undefined reference to `BIO_free'
c:\lib\liboauth-0.9.4\src/hash.c:384: undefined reference to `EVP_sha1'
c:\lib\liboauth-0.9.4\src/hash.c:384: undefined reference to `EVP_DigestInit'
c:\lib\liboauth-0.9.4\src/hash.c:385: undefined reference to `EVP_DigestUpdate'
c:\lib\liboauth-0.9.4\src/hash.c:386: undefined reference to `EVP_VerifyFinal'
c:\lib\liboauth-0.9.4\src/hash.c:387: undefined reference to `EVP_MD_CTX_cleanup'
c:\lib\liboauth-0.9.4\src/hash.c:388: undefined reference to `EVP_PKEY_free'
c:\lib\liboauth-0.9.4\src/hash.c:373: undefined reference to `PEM_read_bio_PUBKEY'
C:/MinGW/msys/1.0/local/lib/liboauth.a(liboauth_la-hash.o): In function `oauth_body_hash_file':
c:\lib\liboauth-0.9.4\src/hash.c:405: undefined reference to `EVP_MD_CTX_init'
c:\lib\liboauth-0.9.4\src/hash.c:406: undefined reference to `EVP_sha1'
c:\lib\liboauth-0.9.4\src/hash.c:406: undefined reference to `EVP_DigestInit'
c:\lib\liboauth-0.9.4\src/hash.c:408: undefined reference to `EVP_DigestUpdate'
c:\lib\liboauth-0.9.4\src/hash.c:412: undefined reference to `EVP_sha1'
c:\lib\liboauth-0.9.4\src/hash.c:412: undefined reference to `EVP_MD_size'
c:\lib\liboauth-0.9.4\src/hash.c:413: undefined reference to `EVP_DigestFinal'
c:\lib\liboauth-0.9.4\src/hash.c:414: undefined reference to `EVP_MD_CTX_cleanup'
C:/MinGW/msys/1.0/local/lib/liboauth.a(liboauth_la-hash.o): In function `oauth_body_hash_data':
c:\lib\liboauth-0.9.4\src/hash.c:422: undefined reference to `EVP_sha1'
c:\lib\liboauth-0.9.4\src/hash.c:422: undefined reference to `EVP_MD_size'
c:\lib\liboauth-0.9.4\src/hash.c:423: undefined reference to `EVP_MD_CTX_init'
c:\lib\liboauth-0.9.4\src/hash.c:424: undefined reference to `EVP_sha1'
c:\lib\liboauth-0.9.4\src/hash.c:424: undefined reference to `EVP_DigestInit'
c:\lib\liboauth-0.9.4\src/hash.c:425: undefined reference to `EVP_DigestUpdate'
c:\lib\liboauth-0.9.4\src/hash.c:426: undefined reference to `EVP_DigestFinal'
c:\lib\liboauth-0.9.4\src/hash.c:427: undefined reference to `EVP_MD_CTX_cleanup'
collect2: ld returned 1 exit status
make: *** [montools] Error 1
I have all of the required libraries in the lib path, and for some reason liboauth just cannot find the references to libssl and libcrypto. This all builds fine in Linux. Any ideas?
Update
Based on responses, I have updated my linker command so as to link the libraries in a different order. My new command is as follows:
gcc -o application application.o service.o util.o json.o api.o -Lc:/mingw/msys/1.0/local/lib -loauth -ljansson -lcurl -lssl -lcrypto
This fixes this previous problem and presents a new set of linker errors:
gcc -o application application.o service.o util.o json.o api.o -Lc:/mingw/msys/1.0/local/lib -loauth -ljansson -lcurl -lssl -lcrypto
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libcrypto.a(rand_win.o):rand_win.c:(.text+0xee0): undefined reference to `CreateDCA#16'
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libcrypto.a(rand_win.o):rand_win.c:(.text+0xeef): undefined reference to `CreateCompatibleDC#4'
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libcrypto.a(rand_win.o):rand_win.c:(.text+0xf08): undefined reference to `GetDeviceCaps#8'
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libcrypto.a(rand_win.o):rand_win.c:(.text+0xf23): undefined reference to `GetDeviceCaps#8'
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libcrypto.a(rand_win.o):rand_win.c:(.text+0xf44): undefined reference to `CreateCompatibleBitmap#12'
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libcrypto.a(rand_win.o):rand_win.c:(.text+0xf5b): undefined reference to `SelectObject#8'
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libcrypto.a(rand_win.o):rand_win.c:(.text+0xf7e): undefined reference to `GetObjectA#12'
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libcrypto.a(rand_win.o):rand_win.c:(.text+0x1024): undefined reference to `BitBlt#36'
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libcrypto.a(rand_win.o):rand_win.c:(.text+0x103b): undefined reference to `GetBitmapBits#12'
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libcrypto.a(rand_win.o):rand_win.c:(.text+0x10b0): undefined reference to `SelectObject#8'
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libcrypto.a(rand_win.o):rand_win.c:(.text+0x10bb): undefined reference to `DeleteObject#4'
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libcrypto.a(rand_win.o):rand_win.c:(.text+0x10c8): undefined reference to `DeleteDC#4'
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libcrypto.a(rand_win.o):rand_win.c:(.text+0x10d5): undefined reference to `DeleteDC#4'
collect2: ld returned 1 exit status
make: *** [montools] Error 1
A quick google search returned that I should also link in the gdi32 library (for purposes unrelated to my tasks. The final command for the linker is then as follows:
gcc -o application application.o service.o util.o json.o api.o -Lc:/mingw/msys/1.0/local/lib -loauth -ljansson -lcurl -lssl -lcrypto -lgdi32
Try this:
gcc -o application application.o service.o util.o json.o api.o -Lc:/mingw/msys/1.0/local/lib -loauth -ljansson -lcurl -lssl -lcrypto