Well, I'm trying to compile a simple program, embedding the WebView of WebKit in a GTK Window. So, when the compiler check this line:
webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
It gave me some errors:
/usr/local/lib/libwebkitgtk-3.0.so: undefined reference to `cairo_gl_surface_get_width'
/usr/local/lib/libwebkitgtk-3.0.so: undefined reference to `cairo_egl_device_create'
/usr/local/lib/libwebkitgtk-3.0.so: undefined reference to `soup_message_set_priority'
/usr/local/lib/libwebkitgtk-3.0.so: undefined reference to `hb_icu_get_unicode_funcs'
/usr/local/lib/libwebkitgtk-3.0.so: undefined reference to `cairo_glx_device_create'
/usr/local/lib/libwebkitgtk-3.0.so: undefined reference to `cairo_gl_surface_get_height'
/usr/local/lib/libwebkitgtk-3.0.so: undefined reference to `cairo_gl_device_set_thread_aware'
/usr/local/lib/libwebkitgtk-3.0.so: undefined reference to `cairo_gl_surface_create_for_texture'
/usr/local/lib/libwebkitgtk-3.0.so: undefined reference to `hb_icu_script_to_script'
collect2: error: ld returned 1 exit status
make[2]: ** [dist/Debug/GNU-Linux-x86/webkittest] Erro 1
make[2]: Saindo do diretório `/home/todi/Projetos/Cpp/WebKitTest'
make[1]: ** [.build-conf] Erro 2
make[1]: Saindo do diretório `/home/todi/Projetos/Cpp/WebKitTest'
make: ** [.build-impl] Erro 2
Yes, I have did the reference to the lib in the linker and I don't know where to find these functions. I'll appreciate your help!
Thanks!
This was fixed in later version of webkit-gtk. See https://bugs.webkit.org/show_bug.cgi?id=108174: either downgrade harfbuzz to compile this version of webkit-gtk, or upgrade webkit-gtk to the lastets version (works fine with 2.4.3)
compile harfbuzz with
sudo ./configure --with-icu
sudo make
sudo make istall
and then compile cairo with
sudo ./configure --enable-gl --includedir="/usr/include/" --libdir="/usr/share/lib"
sudo make
sudo make install
Related
Under Linux(Ubuntu) I'm writing a CMakeLists.txt with CLion to compile my project which is a little game written in C. How do I fix these errors?
Here's a link to the entire source code.
Any help will be greatly appreciated
I have tried to rewrite my .h files. It was primarily an issue about linking SDL and SDL_images.
I have tried to compile the main with gcc main.c -o main -lSDL -lSDL_image.
Here's the CMakeLists.txt
cmake_minimum_required(VERSION 3.7)
project(SOKOBAN)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -lmingw32")
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
include_directories(${PROJECT_SOURCE_DIR}/include)
link_directories(${PROJECT_SOURCE_DIR}/lib)
find_package(SDL REQUIRED)
find_package(SDL)
find_package(SDL_image)
set(SOURCE_FILES main.c jeu.c jeu.h editeur.c editeur.h
fichiers.c fichiers.h Constantes.h hsokoban.h)
add_executable(SOKOBANR ${SOURCE_FILES})
target_link_libraries(SOKOBANR SDL_image SDL)
The error is:
[ 20%] Linking C executable SOKOBANR
CMakeFiles/SOKOBANR.dir/jeu.c.o: In function `jouer':
/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:12: multiple definition of `jouer'
CMakeFiles/SOKOBANR.dir/main.c.o:/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:12: first defined here
/usr/bin/ld: skipping incompatible /home/mahamad/github/SOKOBAN/SOKOBAN/lib/libSDL.a when searching for -lSDL
CMakeFiles/SOKOBANR.dir/main.c.o: In function `jouer':
/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:72: undefined reference to `deplacerJoueur'
/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:76: undefined reference to `deplacerJoueur'
/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:80: undefined reference to `deplacerJoueur'
/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:84: undefined reference to `deplacerJoueur'
CMakeFiles/SOKOBANR.dir/jeu.c.o: In function `jouer':
/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:72: undefined reference to `deplacerJoueur'
CMakeFiles/SOKOBANR.dir/jeu.c.o:/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:76: more undefined references to `deplacerJoueur' follow
CMakeFiles/SOKOBANR.dir/fichiers.c.o: In function `sauvegarderNiveau':
/home/mahamad/github/SOKOBAN/SOKOBAN/fichiers.c:67: undefined reference to `fprint'
collect2: error: ld returned 1 exit status
CMakeFiles/SOKOBANR.dir/build.make:128: recipe for target 'SOKOBANR' failed
make[3]: *** [SOKOBANR] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/SOKOBANR.dir/all' failed
make[2]: *** [CMakeFiles/SOKOBANR.dir/all] Error 2
CMakeFiles/Makefile2:84: recipe for target 'CMakeFiles/SOKOBANR.dir/rule' failed
make[1]: *** [CMakeFiles/SOKOBANR.dir/rule] Error 2
Makefile:118: recipe for target 'SOKOBANR' failed
make: *** [SOKOBANR] Error 2```
If you get such errors you need to look into each of them:
CMakeFiles/SOKOBANR.dir/jeu.c.o: In function `jouer':
/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:12: multiple definition of `jouer'
CMakeFiles/SOKOBANR.dir/main.c.o:/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:12: first defined here
The linker thinks that you have (at least) two definitions of jouer. Since both referenced locations are the same I assume that you 1. include "jeu.c" instead of "jeu.h" in your "main.c", and 2. link both "main.o" and "jeu.o".
/usr/bin/ld: skipping incompatible /home/mahamad/github/SOKOBAN/SOKOBAN/lib/libSDL.a when searching for -lSDL
The library "libSDL.a" you provide is not compatible to the target system. Your target system seems to be Linux.
For which system is the library?
Did you compile it yourself or did you download it?
CMakeFiles/SOKOBANR.dir/main.c.o: In function `jouer':
/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:72: undefined reference to `deplacerJoueur'
/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:76: undefined reference to `deplacerJoueur'
/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:80: undefined reference to `deplacerJoueur'
/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:84: undefined reference to `deplacerJoueur'
CMakeFiles/SOKOBANR.dir/jeu.c.o: In function `jouer':
/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:72: undefined reference to `deplacerJoueur'
CMakeFiles/SOKOBANR.dir/jeu.c.o:/home/mahamad/github/SOKOBAN/SOKOBAN/jeu.c:76: more undefined references to `deplacerJoueur' follow
There are references (calls) of deplacerJoueur but you don't define it. Or the source file with the definition (implementation) is not added to the list of modules.
CMakeFiles/SOKOBANR.dir/fichiers.c.o: In function `sauvegarderNiveau':
/home/mahamad/github/SOKOBAN/SOKOBAN/fichiers.c:67: undefined reference to `fprint'
This is clearly a typo. You mean fprintf() with a trailing 'f' for sure.
collect2: error: ld returned 1 exit status
Because of all the errors the linker is not successful, and it tells you.
CMakeFiles/SOKOBANR.dir/build.make:128: recipe for target 'SOKOBANR' failed
Because of all the errors the build is not successful, and it tells you.
I've been trying to compile the Paho MQTT client libraries on raspbian buster. Cloned the github source:
git clone https://github.com/eclipse/paho.mqtt.c.git
As per the README file I've run make (OK except for 1 warning that 'rc1 not used') then sudo make install which happily copies sundry MQTTxx.h and MQTTxx.c files into the /usr/include directory.
However, attempts to compile a Paho demo program results in:
richard#grigio:[~]: gcc mqtest.c
/tmp/ccvjYcVw.o: In function `main':
mqtest.c:(.text+0x68): undefined reference to `MQTTClient_create'
mqtest.c:(.text+0x8c): undefined reference to `MQTTClient_connect'
mqtest.c:(.text+0xe4): undefined reference to `MQTTClient_publishMessage'
mqtest.c:(.text+0x114): undefined reference to `MQTTClient_waitForCompletion'
mqtest.c:(.text+0x138): undefined reference to `MQTTClient_disconnect'
mqtest.c:(.text+0x144): undefined reference to `MQTTClient_destroy'
collect2: error: ld returned 1 exit status
so I thought I needed to link the library:
richard#grigio:[~]: gcc mqtest.c -lMQTTClient
/usr/bin/ld: cannot find -lMQTTClient
collect2: error: ld returned 1 exit status
MQTTClient.h and MQTTClient.c are present in /usr/include so what am I doing wrong, please?
I'm trying to compile BluezTools using the following command:
./autogen.sh && ./configure && make
Here is a snippet of the output:
obextransfer.c:(.text+0x4d5): undefined reference to `g_type_check_instance_cast'
obextransfer.c:(.text+0x4f1): undefined reference to `dbus_g_proxy_disconnect_signal'
obextransfer.c:(.text+0x4fd): undefined reference to `g_object_unref'
obextransfer.c:(.text+0x50a): undefined reference to `g_free'
obextransfer.c:(.text+0x517): undefined reference to `g_object_unref'
obextransfer.c:(.text+0x528): undefined reference to `g_type_check_class_cast'
lib/obexd/obextransfer.o: In function `obextransfer_cancel':
obextransfer.c:(.text+0x56a): undefined reference to `g_type_check_instance_is_a'
obextransfer.c:(.text+0x58a): undefined reference to `g_assertion_message_expr'
lib/obexd/obextransfer.o: In function `obextransfer_get_dbus_object_path':
obextransfer.c:(.text+0x5e2): undefined reference to `g_type_check_instance_is_a'
obextransfer.c:(.text+0x602): undefined reference to `g_assertion_message_expr'
lib/obexd/obextransfer.o: In function `_obextransfer_get_property':
obextransfer.c:(.text+0x64f): undefined reference to `g_type_check_instance_cast'
obextransfer.c:(.text+0x660): undefined reference to `g_type_name'
obextransfer.c:(.text+0x66f): undefined reference to `g_type_name'
obextransfer.c:(.text+0x6a3): undefined reference to `g_log'
lib/obexd/obextransfer.o: In function `progress_handler':
obextransfer.c:(.text+0x4af): undefined reference to `g_signal_emit'
lib/obexd/obextransfer.o: In function `obextransfer_cancel':
obextransfer.c:(.text+0x5ad): undefined reference to `dbus_g_proxy_call'
lib/obexd/obextransfer.o: In function `obextransfer_get_dbus_object_path':
obextransfer.c:(.text+0x619): undefined reference to `dbus_g_proxy_get_path'
lib/obexd/obextransfer.o: In function `_obextransfer_get_property':
obextransfer.c:(.text+0x6e7): undefined reference to `g_value_set_string'
collect2: error: ld returned 1 exit status
make[2]: *** [bt-monitor] Error 1
make[2]: Leaving directory `/home/[]/Downloads/bluez-tools-bluez-tools/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/[]/Downloads/bluez-tools-bluez-tools
This is my first attempt as building a C project on Linux, where am I going wrong?
Running Linux Mint 15 Olivia 64bit.
Do you have bluez and obexd installed? https://code.google.com/p/bluez-tools/#Requirements
You could check the output of ./configure for any errors. Usually there is a configure.log or similar to grep for erros.
I dont know about Mint package management, but you probably need some kind of obex*-dev package at least or install obex source yourself.
EDIT Edited to answer the comment.
I do not think the obexd-client is enough, but try this method and see if it is. Otherwise you need to look for some -dev packages like libglib2.0-cil-dev libglib2.0-dev and libdbus-glib-1-dev. (Those are the names on Ubuntu).
Here is how I got it to compile (still emits warnings, though).
Install a bunch of -dev packages for glib and dbus (ddg/google the functions that fail to link, so you see which libraries they are from).
Execute pkg-config --libs --cflags dbus-1 dbus-glib-1 glib-2.0
Use the output of the command in the ./configure e.g.:
env LIBS="-I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -ldbus-glib-1 -ldbus-1 -lgobject-2.0 -lglib-2.0" ./configure
Execute make
See also this question: Compilation error dbus-ping-pong
Fixed a similar problem by adding pkg-config --libs gtk+-2.0. Maybe helps someone.
I'm trying to set up the code from
http://www.openglsuperbible.com/example-code/
with command:
$ cmake -G "Unix Makefiles" ; make clean ; make all
I've installed the following packages in order to prepare the system:
xrandr libxrandr x11-xserver-utils libxrandr-dev libglfw2 libglfw-dev xorg-dev libx11-dev libgl-dev libglu-dev libgl1-mesa-dev freeglut3 freeglut3-dev mesa-common-dev freeglut3-dev build-essential libx11-dev libx11-*
I may have missed some of the packages I've installed in this list, I apologize.
Then I've modified the CMakeList.txt in order to add to the linking phase the following things:
glfw GL rt glut X11 dl Xrandr Xext GLEW GLU
Then I try to compile, but it fails at the linking phase:
/opt/sb6code/src/xraw/xraw.c: In function ‘CreateWindow’:
/opt/sb6code/src/xraw/xraw.c:106:14: warning: assignment makes pointer from integer without a cast [enabled by default]
Linking C executable bin/xraw
CMakeFiles/xraw.dir/src/xraw/xraw.c.o:xraw.c:function CreateWindow: error: undefined reference to 'XOpenDisplay'
CMakeFiles/xraw.dir/src/xraw/xraw.c.o:xraw.c:function CreateWindow: error: undefined reference to 'XCloseDisplay'
CMakeFiles/xraw.dir/src/xraw/xraw.c.o:xraw.c:function CreateWindow: error: undefined reference to 'XCreateColormap'
CMakeFiles/xraw.dir/src/xraw/xraw.c.o:xraw.c:function CreateWindow: error: undefined reference to 'XCreateWindow'
CMakeFiles/xraw.dir/src/xraw/xraw.c.o:xraw.c:function CreateWindow: error: undefined reference to 'XMapWindow'
CMakeFiles/xraw.dir/src/xraw/xraw.c.o:xraw.c:function CreateWindow: error: undefined reference to 'glXCreateContextAttribsARB'
CMakeFiles/xraw.dir/src/xraw/xraw.c.o:xraw.c:function Cleanup: error: undefined reference to 'XDestroyWindow'
CMakeFiles/xraw.dir/src/xraw/xraw.c.o:xraw.c:function Cleanup: error: undefined reference to 'XCloseDisplay'
CMakeFiles/xraw.dir/src/xraw/xraw.c.o:xraw.c:function main: error: undefined reference to 'XNextEvent'
CMakeFiles/xraw.dir/src/xraw/xraw.c.o:xraw.c:function main: error: undefined reference to 'XGetWindowAttributes'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/xraw] Errore 1
make[1]: *** [CMakeFiles/xraw.dir/all] Errore 2
make: *** [all] Errore 2
Now, I've tried to search the web and even here on SO.com for solutions, but they keep telling me to link the libraries I've already added to the linking phase.. so I can't seem to make any more progress.
Do you happen to have some knowledge or hint that could help me?
Ok, stimulated by answers I've gone into CMakeFiles directory and looked for the configuration file that manages the compilation. I've found out that for some reasons it did miss some of the flags stated into the CMakeLists despite of my update.
So now the compilation line looks like:
/usr/bin/cc CMakeFiles/xraw.dir/src/xraw/xraw.c.o -o bin/xraw -L/opt/sb6code/lib -rdynamic -lGL -lglut -lGLU -lm -lX11 -ldl -lGLEW -lXrandr -lXext -lrt -lglfw -Wl,-rpath,/opt/sb6code/lib
And the errors have reduced to :
CMakeFiles/xraw.dir/src/xraw/xraw.c.o:xraw.c:function CreateWindow: error: undefined reference to 'glXCreateContextAttribsARB'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/xraw] Errore 1
make[1]: *** [CMakeFiles/xraw.dir/all] Errore 2
make: *** [all] Errore 2
Other hints? :)
Side Note:
I've also installed CUDA libraries and under path
/usr/lib/nvidia-304/
I happen to have
alt_ld.so.conf libnvidia-ml.so.1
bin/ libnvidia-ml.so.304.88
ld.so.conf libnvidia-opencl.so.1
libcuda.so libnvidia-opencl.so.304.88
libcuda.so.1 libnvidia-tls.so.304.88
libcuda.so.304.88 libnvidia-wfb.so.1
libGL.so libnvidia-wfb.so.304.88
libGL.so.1 libOpenCL.so
libGL.so.304.88 libOpenCL.so.1
libnvcuvid.so libOpenCL.so.1.0
libnvcuvid.so.1 libOpenCL.so.1.0.0
libnvcuvid.so.304.88 libXvMCNVIDIA_dynamic.so.1
libnvidia-cfg.so libXvMCNVIDIA.so
libnvidia-cfg.so.1 libXvMCNVIDIA.so.1
libnvidia-cfg.so.304.88 libXvMCNVIDIA.so.304.88
libnvidia-compiler.so tls/
libnvidia-compiler.so.1 vdpau/
libnvidia-compiler.so.304.88 xorg/
libnvidia-glcore.so.304.88 XvMCConfig
libnvidia-ml.so
Which I would like to use since I'm not sure that my intel graphic card supports OpenGl 4.* which I shall use with the book, while the nvidia one supports 4.2.
I really can't find any good how to on the matter, the Book conveniently avoids to give installation instructions.
Temporary Solution:
I've found out that this is the only source file that does not work. Removing its files and CMakeList.txt configuration seems to be wise until someone finds out another solution.
Also, i had to use optirun to run the executables, in case other people with bumblebee/nvidia are wondering why their programs do not work.
You probably link the libraries in wrong order; all these symbols are defined in libX11.a; you should want to see what is the actual linking command line fed to GCC, and post it here.
Update now it means that you are statically trying to link against an API function that is not available in your libs (it is an optional extension and should be queried dynamically).
I am trying to "make" a program and yet face these errors; I used make -lm and even did #include but still I face the same problem. I tried installing the application on both Ubuntu and Debian just to make sure I remove doubts on corrupted libraries.Still no success !
nat_src_endpoint_ip.o: In function `__new':
/root/softwares/sweetspot-0.0.20/src/nat_src_endpoint_ip.c:95: undefined reference to `ceilf'
nat_src_endpoint_tcp.o: In function `__create':
/root/softwares/sweetspot-0.0.20/src/nat_src_endpoint_tcp.c:58: undefined reference to `ceilf'
nat_src_endpoint_udp.o: In function `__create':
/root/softwares/sweetspot-0.0.20/src/nat_src_endpoint_udp.c:59: undefined reference to `ceilf'
nat_src_endpoint_icmp.o: In function `__create':
/root/softwares/sweetspot-0.0.20/src/nat_src_endpoint_icmp.c:48: undefined reference to `ceilf'
collect2: ld returned 1 exit status
make[1]: *** [sweetspot] Error 1
make[1]: Leaving directory `/root/softwares/sweetspot-0.0.20/src'
make: *** [all] Error 2
You should link with the math library. In Gcc this means that you should add -lm to the linking command line (if you only use one command line it means that this command line is both for compiling and linking).