Gnatmake undefined reference (libcairo) - linker

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.

Related

how to compile netcdf

Hello I am using given code from the examples to test if I have installed netcdf correctly. I installed the prebuilt netCDF4.8.1-NC4-DAP-64 and put it in the environment variable path (I checked to make sure it worked, it did. Next I did #include "netcdf.h" in the main c file and then made the make file as such:
CC = gcc
EXECUTABLES = try
INCLUDES = -IC:/Program\ Files/netCDF\ 4.8.1/include/
CFLAGS = $(INCLUDES)
LIBS = -LC:/Program\ Files/netCDF\ 4.8.1/lib -lnetcdf -lmfhdf -ljpeg -lhdf5_hl -lhdf5 -lz -lm
all: $(EXECUTABLES)
try: try.c
$(CC) $(CFLAGS) -o try try.c $(LIBS)
clean:
rm core $(EXECUTABLES) *.o
I tried to look at forums and added diffrent flags such as all of
-lnetcdf -lpnetcdf -lmfhdf -ldf -ljpeg -lhdf5_hl -lhdf5 -lz -lsz -lm
but it would throw
gcc -IC:/Program\ Files/netCDF\ 4.8.1/include/ -o try try.c -LC:/Program\ Files/netCDF\ 4.8.1/lib -lnetcdf -lpnetcdf -lmfhdf -ldf -ljpeg -lhdf5_hl -lhdf5 -lz -lsz -lm
C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.1.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lpnetcdf
C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.1.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -ldf
C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.1.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lsz
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:10: try] Error 1
so I removed theose flags and kept the rest but got the error:
gcc -IC:/Program\ Files/netCDF\ 4.8.1/include/ -o try try.c -LC:/Program\ Files/netCDF\ 4.8.1/lib -lnetcdf -lmfhdf -ljpeg -lhdf5_hl -lhdf5 -lz -lm
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0xa3): undefined reference to `nc_create'
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0xc3): undefined reference to `nc_strerror'
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0x109): undefined reference to `nc_def_dim'
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0x129): undefined reference to `nc_strerror'
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0x16f): undefined reference to `nc_def_dim'
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0x18f): undefined reference to `nc_strerror'
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0x204): undefined reference to `nc_def_var'
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0x224): undefined reference to `nc_strerror'
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0x24f): undefined reference to `nc_enddef'
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0x26f): undefined reference to `nc_strerror'
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0x2ad): undefined reference to `nc_put_var_int'
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0x2cd): undefined reference to `nc_strerror'
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0x2f8): undefined reference to `nc_close'
C:\Users\NPAT~1\AppData\Local\Temp\ccAbmx3N.o:try.c:(.text+0x318): undefined reference to `nc_strerror'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:10: try] Error 1
Any help is appreciated, Thank You
Update!! I think that because the files I was trying to link were .lib, gcc was not linking it. I changed form vscode to vs community and added the .lib and it started to work properly.
Instead of compiling with gcc I compiled with MSVC.

MonetDB client compilation

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

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

undefined reference to `dlopen' since ubuntu upgrade

i experience the undefined reference to `dlopen' problems since I have upgraded to ubuntu 13.10 and gcc 4.8.1.
The makefiles are working for years already. the particular call is
gcc -rdynamic -o ov_dbutil ov_dbutil.o libov.so -ldl
The errors are:
libov.so: undefined reference to `dlopen'
libov.so: undefined reference to `dlclose'
libov.so: undefined reference to `dlerror'
libov.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make: *** [ov_dbutil] Error 1
is it a gcc problem?
ov_dbutil is compiled with the following lines
gcc -g -Wall -O0 -shared -std=c99 -fno-strict-aliasing -DPLT_SYSTEM_LINUX=1 -DPLT_USE_BUFFERED_STREAMS=1 -DPLT_SERVER_TRUNC_ONLY=1 -DNDEBUG -DOV_SYSTEM_LINUX=1 -I../../../plt/include/ -I../../../ks/include/ -I../../include/ -I../../model/ -I../../source/codegen/ -I../../source/builder/ -I../../source/example/ -I../../source/kshist/ -I../../source/dynov/ -I../../source/tasklib/ -I../../source/dbparse/ -I../../source/dbdump/ -I../../../../libml/ -I../../include/runtimeserver/ -I. -c ../../source/dbutil/ov_dbutil.c -o ov_dbutil.o
no errors or warnings
Add -Wl,--no-as-needed as linker arguments.
My issue was solved by adding -ldl in the lining line of the .so you want to link agains, it was called libov.so in the upper example.

How to build gstreamer project using MinGW?

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

Resources