glib-networking cannot find gio/gio.h - linux

I am trying to build glib-networking-2.40.1. I am having trouble with the make step.
Configure step
~/gstreamer/plugins/recommended/good/glib-networking-2.40.1 $ sudo ./configure --disable-glibtest --host=arm-linux-gnueabi --prefix=$DISCIMAGE/usr/local/ --includedir=$DISCIMAGE/usr/include/glib-2.0 --libdir=$DISCIMAGE/usr/lib/arm-linux-gnueabi --libdir=$DISCIMAGE/usr/lib --exec-prefix=$DISCIMAGE/usr/local/ --includedir=$DISCIMAGE/home/ubuntu/gstreamer/plugins/recommended/gstreamer/glib-2.40.0/include --includedir=$DISCIMAGE/home/ubuntu/gstreamer/plugins/recommended/gstreamer/glib-2.40.0/glib --with-ca-certificates=/etc/ssl/ca-bundle.crt --includedir=$DISCIMAGE/home/ubuntu/gstreamer/plugins/recommended/good/gnutls-3.3.7/ --includedir=$DISCIMAGE/home/ubuntu/gstreamer/plugins/recommended/gstreamer/glib-2.40.0/ --with-gnutls=/home/ubuntu/gstreamer/plugins/recommended/good/gnutls-3.3.7/ --libdir=/usr/lib/arm-linux-gnueabihf/ --libdir=/usr/lib --libdir=/usr/lib/arm-linux-gnueabi --libdir=/usr/lib/arm-linux-gnueabihf/ --libdir=/home/ubuntu/gstreamer/plugins/recommended/gstreamer/glib-2.40.0/gio/.libs/
then I try
sudo make
and I get the error
CC gnutls-module.lo
gnutls-module.c:22:21: fatal error: gio/gio.h: No such file or directory
gio.h is located at
/home/ubuntu/gstreamer/plugins/recommended/gstreamer/glib-2.40.0/gio/
which is included in my configure step
also I have libgio-2.0.so located at
/usr/lib/libgio-2.0.so
and
/usr/lib/arm-linux-gnueabihf/gio/libgio-2.0.so.0
and
/usr/lib/libgio-2.0.so.0
all of which are included in configure
pkg-config gives
sudo pkg-config --libs --cflags gio-2.0
-pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lgio-2.0 -lgobject-2.0 -lglib-2.0
Any help would be greatly appreciated

The --includedir and --libdir arguments to configure are supposed to tell your package where to install its own headers and libraries, not where to find other headers and libraries. You should not normally need to use those arguments.
Making that mistake when you compiled GLib is presumably why your gio.h is located at /home/ubuntu/gstreamer/plugins/recommended/gstreamer/glib-2.40.0/gio/ instead of at /usr/include or /usr/local/include.
Instead, the output of pkg-config should tell your program where to find headers and libraries. If you've installed your package properly, then pkg-config's output should be correct. The idea is that instead of you researching where all the libraries live and passing those paths to configure, each library installs a pkg-config file that has that information, so if you know where the pkg-config files are, then you don't need to know anything else.
So probably you should uninstall, recompile, and reinstall all the packages you've been compiling, reconfiguring them without the --include and --libdir arguments.

Related

Compiler says uuid.h not found but apt-get says it is

When compiling my C++ project that includes uuid.h I get the compile error:
fatal error: uuid.h: No such file or directory
I'm not sure whats going wrong. It could be my compiler instructions are wrong or that I indeed dont have that file installed (but I don't think thats the problem).
sudo apt-get install uuid-dev
The above command outputs: uuid-dev is already the newest version
My makefile is simply this:
all:
g++ -o bin/myapplication src/main.cpp -std=c++11
Edit:
In .h file:
#include <uuid.h>
Any ideas what the issue could be?
The package's file list shows that it contains /usr/include/uuid/uuid.h. Since your default include path looks for files relative to /usr/include, you'd need to either write <uuid/uuid.h>, or add -I/usr/include/uuid to your compile options.
However, the package also provides a .pc file for use with pkg-config, which is meant to abstract the details of which compiler options you need to build a program against a library. If you run pkg-config --cflags uuid you get get the output -I/usr/include/uuid, and if you run pkg-config --libs uuid, you get the output -luuid. These are meant to be incorporated into your program's build.
Since it looks like you're using Make, you should add these lines to your Makefile:
CFLAGS += `pkg-config --cflags uuid`
LDFLAGS += `pkg-config --libs uuid`
That'll incoroporate the necessary -I and -l options into your compile commands automatically — and it'll also work on other systems where the UUID library might be installed in a different location.
I bielive in newer version of the uuid the header is <uuid/uuid.h>

configure test with static lib

I am trying to cross compile libpng for RaspberryPi on Ubuntu 14.04 (x_64) with zlib
but configure fails with
configure:11400: arm-linux-gnueabihf-gcc -o conftest -g -O2 -I/home/user/RPI_DEV/lib/include conftest.c -lz -lm >&5
/home/user/RPI_DEV/xtools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
configure:11400: $? = 1
configure: failed program was:
....
Because I am using toolchain for arm, arm-ld cant find zlib.
Is there any option for configure not to compile with shared lib but to try with static lib (eg. -static -lz).
Command is
./configure --enable-static=true --enable-shared=false --with-zlib-include="/home/user/RPI_DEV/lib/include" --with-zlib-lib="/home/user/RPI_DEV/lib/lib" LDFLGS="-L/home/user/RPI_DEV/lib/lib" CPPFLAGS="-I/home/user/RPI_DEV/lib/include" -enable-static --host=arm-linux-gnueabihf --prefix=/home/user/RPI_DEV/lib --exec-prefix=/home/user/RPI_DEV/lib
You need to cross build and install zlib into your toolchain before trying to use it in another project.
What you are doing might work but only if you spell LDFLAGS correctly:
LDFLGS="-L/home/user/RPI_DEV/lib/lib"
Note the missing 'A'. I don't know why your second attempt worked, given you had the same misspelling; possibly you had a correct LDFLAGS in your environment?
Anyway there should be a Ubuntu cross-development guide somewhere that explains how to do this. It's slightly off topic but for Gentoo you use 'crossdev' to install the toolchain then a crossdev specific version of the normal package installation mechanism ([host]-emerge) to install zlib into the toolchain.
Also, the arguments --with-zlib-include and --with-zlib-lib are not supported by any current version of libpng I can find. If you are cross-compiling libpng for an RPi (or, indeed, any ARM system) you should be using the latest version of 1.6 that you can find.
Unless someone solves this the RIGHT way, this is hack I've done.
Open configure.ac file
Find and comment out line
AC_CHECK_LIB(z, zlibVersion, , AC_ERROR([zlib not installed]))
Configure will pass wihout check for zlib and then add zlib by hand
LDFLGS="-L/home/user/RPI_DEV/lib/lib -L/home/user/RPI_DEV/lib/lib/libz.a"
Run autoconf
Run ./configure ...

Failure using configure of nccmp

I would like to install the nccmp program to compare netCDF files.
Checking the documentation, the installation follows the typical structure:
./configure
make
make check
make install
make clean
However, I'm stuck in the first step because the configure is not able to find my netCDF libraries. But I don't know why.
My libs are not in the default folder, I've installed them in /opt. But I've included the path of the netCDF libs in my LD_LIBRARY_PATH variable.
I tried also to create a link in the default lib folder to my netCDF libs
ln /opt/netcdf-4.2.1.1/lib/libnetcdf.so /usr/lib/libnetcdf.so
ln /opt/netcdf-4.2.1.1/lib/libnetcdff.so /usr/lib/libnetcdff.so
ln /opt/netcdf-4.2.1.1/lib/libnetcdf.a /usr/lib/libnetcdf.a
ln /opt/netcdf-4.2.1.1/lib/libnetcdff.a /usr/lib/libnetcdff.a
But it doesn't work either. I explicitly used the path in the call
./configure --libdir=/opt/netCDF/
I set LIBS and LDFLAGS to
LDFLAGS=-L/opt/netcdf-4.2.1.1/lib/
LIBS=/opt/netcdf-4.2.1.1/lib/
and execute configure then, but with the same bad results:
checking for nc_open in -lnetcdf... no
configure: error: in `/opt/nccmp':
configure: error: Required NetCDF library not found!
In the config.log I see:
configure:3763: gcc -o conftest -g -O2 conftest.c -lnetcdf -lm >&5
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libnetcdf.a(libnetcdf4_la-nc4file.o): In function nc4_rec_read_types':
/opt/NETCDF_BUILD/netcdf-4.2.1.1/libsrc4/nc4file.c:1850: undefined reference toH5Gget_create_plist'
and many more similar lines like that one...
I don't know what else to try, so any help would be really appreciated.
Thanks.
I already found the problem... I needed, as expected, to define LDFLAGS and CFLAGS in my shell and export them to allow the access of configure to those variables.

How to make libusb library visible to another program?

I am trying to compile hidapi library. In order to compile that, I need libusb-1.0. I've downloaded that, configured, made and installed to /usr/local/lib. But when I try to compile hidapi, it doesn't see libusb-1.0:
cc -Wall -g -c -I../hidapi pkg-config libusb-1.0 --cflags
hid-libusb.c -o hid-libusb.o -L/usr/local/lib Package libusb-1.0 was
not found in the pkg-config search path. Perhaps you should add the
directory containing `libusb-1.0.pc' to the PKG_CONFIG_PATH
environment variable No package 'libusb-1.0' found /bin/sh: cc: not
found make: * [hid-libusb.o] Error 127
How can I fix that?
(compilation happens on Synology NAS)
Since you installed to /usr/local/lib, pkg-config will not find your installation unless you set PKG_CONFIG_PATH appropriately
Try running:
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
in your shell and then re-attempting to build your code

"cannot find -lreadline" error when compiling Lua

This should be a pretty straightforward issue -- I'm trying to compile Lua (or rather lua-vec, which is a minor variant) on a CentOS Linux install, and I get the following error:
[jt#flyboy src]#make linux
make all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
make[1]: Entering directory `/jt/flyboy/fly/lua/lua-vec/src'
gcc -o lua lua.o liblua.a -lm -Wl,-E -ldl -lreadline -lhistory -lncurses
/usr/bin/ld: cannot find -lreadline
collect2: ld returned 1 exit status
make[1]: *** [lua] Error 1
That would suggest the readline lib is not installed. But...
[jt#flyboy src]#ls /usr/lib/libreadline*
/usr/lib/libreadline.so.5 /usr/lib/libreadline.so.5.1
Interestingly, if I rearrange the order of readline/history/ncurses, whichever is first triggers the same error, so I suspect that this is some sort of a folder-specification problem, not a missing library problem.
Any ideas?
yum install readline-devel.x86_64 readline-devel.i386 ncurses-devel.i386 ncurses-devel.x86_64
seems to have done the trick! The odd thing is I have compiled this before without these libs... but enough time pondering life's mysteries...
libreadline is not enough, it will give you libraries related to readline. You need libreadline-dev for compiling package which depends upon readline like in above case.
In Red Hat like distros, name of package is readline-devel
Following command will do the trick in such environment:
$ yum install -y readline-devel
If somebody has this issue in ubuntu/debian:
sudo apt-get install libreadline-dev

Resources