Tell gnu-autotools where my newly installed library is (with PKG_CONFIG?) - c++

Sorry, my gnu-autotools Fu is rusty here . .
Our application uses 'packs' - GBs of data that is downloaded by the user and demand. To test this, I would like to use libifuse to transfer data to/from the iOS device without jail-breaking. So, I'm building libifuse from source, starting with dependencies:
I installed libusbmuxd:
It installed to the following:
.././install-sh -c -d '/usr/local/bin'
/bin/sh ../libtool --mode=install /usr/bin/install -c iproxy '/usr/local/bin'
libtool: install: /usr/bin/install -c .libs/iproxy /usr/local/bin/iproxy
make[2]: Nothing to be done for `install-data-am'.
make[2]: Nothing to be done for `install-exec-am'.
./install-sh -c -d '/usr/local/lib/pkgconfig'
/usr/bin/install -c -m 644 libusbmuxd.pc '/usr/local/lib/pkgconfig'
Can't build libimobiledevice - need to find libusbmuxd:
Now when building libimobiledevice, I get the following error, when running ./configure:
checking for libusbmuxd... no
configure: error: Package requirements (libusbmuxd >= 1.0.8) were not met:
No package 'libusbmuxd' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables libusbmuxd_CFLAGS
My Question:
How do I tell the gnu-autotools where my newly installed library is? What is the best practice here?

Try to install the package pkg-config.
In fact, the autotools use pkg-config to see if the package you need is installed.
Edit:
Try pkg-config --print-variables libusbmuxd to see if you got something.

Related

make: *** [port-target] Error 2 When trying to install GDAL for GeoDjango using Ubuntu 18.04

I am trying to install GeoDjango to use in my project. I am using Ubuntu 18.04 through VirtualBox. I am also using the GeoDjango installlation Guide to install Gdal. I have GEOS and PROJ.4 installled.
I have successfully run the below commands :
$ wget http://download.osgeo.org/gdal/1.11.2/gdal-1.11.2.tar.gz #success
$ tar xzf gdal-1.11.2.tar.gz #success
$ cd gdal-1.11.2 #success
Later I am supposed to do the below (according to the documentation):
$ ./configure
$ make # Go get some coffee, this takes a while.
$ sudo make install
$ cd ..
However, when I run these lines:
$ ./configure #success
$ make # Go get some coffee, this takes a while. #ERROR SEE BELOW
I get the below error:
samir#samir-VirtualBox:~/gdal-1.11.2$ make # Go get some coffee, this takes a while.
(cd port; make)
make[1]: Entering directory '/home/samir/gdal-1.11.2/port'
/bin/bash /home/samir/gdal-1.11.2/libtool --mode=compile --tag=CXX g++ -std=c++98 -g -O2 -DHAVE_SSE_AT_COMPILE_TIME -Wall -DOGR_ENABLED -I/home/samir/gdal-1.11.2/port -I../frmts/zlib -DHAVE_LIBZ -c -o cpl_error.lo cpl_error.cpp
libtool: compile: g++ -std=c++98 -g -O2 -DHAVE_SSE_AT_COMPILE_TIME -Wall -DOGR_ENABLED -I/home/samir/gdal-1.11.2/port -I../frmts/zlib -DHAVE_LIBZ -c cpl_error.cpp -fPIC -DPIC -o .libs/cpl_error.o
cpl_error.cpp: In function 'void CPLErrorV(CPLErr, int, const char*, __va_list_tag*)':
cpl_error.cpp:190:20: error: incompatible types in assignment of '__va_list_tag*' to 'va_list {aka __va_list_tag [1]}'
wrk_args = args;
^~~~
cpl_error.cpp:226:24: error: incompatible types in assignment of '__va_list_tag*' to 'va_list {aka __va_list_tag [1]}'
wrk_args = args;
^~~~
../GDALmake.opt:568: recipe for target 'cpl_error.lo' failed
make[1]: *** [cpl_error.lo] Error 1
make[1]: Leaving directory '/home/samir/gdal-1.11.2/port'
GNUmakefile:53: recipe for target 'port-target' failed
make: *** [port-target] Error 2
Below is a Screenshot of the error. so you can see it in color
How can I resolve this error ?
Please make sure you have ubuntu installed on your computer. If you
are using windows, install VirtualBox and download Ubuntu (Its a Linux
OS). You might have to do a basic course on Ubuntu either on YouTube
or Udemy then do
sudo apt install geos
sudo apt install proj4
sudo apt install gdal
sudo-apt install postgressql
sudo-apt install till postgis
that's it.. you are done as simple as that..
then download pgadmin3 (pgadmin4 is not available on ubuntu at the
time of this comment)
make the database on pgadmin3 (its way simpler than psql)
In your Virtual Env do
pip install dj-database-url
pip install psycopg2
pip install pillow
I suffered 2 weeks figuring this out.. Hopefully you don't have to
Trying this on Windows is next to impossible. Don't follow the
GeoDjango documents for installing GeoDjango with make and
make-install as that is very difficult.

CMake/Make cannot find libusb

I'm new to C/C++ and am trying to build and run ttwatch from github locally on an Ubuntu machine (Trusty Tahr). Instructions include installing some libraries first: cmake, openssl, curl, libusb, and include a note to install the "-dev" versions (eg. libssl-dev, libcurl-dev, libusb-1.0-0-dev). I'm having some trouble with libusb. I see questions about this all over the internet, but haven't yet found a solution that works.
Running cmake . appears to work fine:
meowmeow#kittytown:~/code/ttwatch$ cmake .
-- Enabled daemon function
-- Found libusb-1.0:
-- - Includes: /usr/include/libusb-1.0
-- - Libraries: /usr/lib/x86_64-linux-gnu/libusb.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/meowmeow/code/ttwatch
But running make shows that libusb is not being located properly:
meowmeow#kittytown:~/code/ttwatch$ make
[ 42%] Built target libttbin
[ 42%] Built target libttwatch
[ 42%] Built target ttbincnv
[ 42%] Built target ttbinmod
[ 42%] Built target manifest
Linking CXX executable ttwatch
CMakeFiles/ttwatch.dir/src/ttwatch.c.o: In function `main':
/home/meowmeow/code/ttwatch/src/ttwatch.c:1618: undefined reference to `libusb_init'
/home/meowmeow/code/ttwatch/src/ttwatch.c:1796: undefined reference to `libusb_exit'
...
If I check /usr/includes/, I see libusb:
meowmeow#kittytown:~/code/ttwatch$ ls /usr/include/libusb-1.0/libusb.h
/usr/include/libusb-1.0/libusb.h
And dpkg shows:
meowmeow#kittytown:~/code/ttwatch$ dpkg -L libusb-1.0-0-dev
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/libusb-1.0.pc
/usr/lib/x86_64-linux-gnu/libusb-1.0.a
/usr/share
/usr/share/doc
/usr/share/doc/libusb-1.0-0-dev
/usr/share/doc/libusb-1.0-0-dev/copyright
/usr/include
/usr/include/libusb-1.0
/usr/include/libusb-1.0/libusb.h
/usr/lib/x86_64-linux-gnu/libusb-1.0.so
/usr/share/doc/libusb-1.0-0-dev/README
/usr/share/doc/libusb-1.0-0-dev/changelog.Debian.gz
meowmeow#kittytown:~/code/ttwatch$ dpkg -L libusb-1.0-0
/.
/lib
/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libusb-1.0-0
/usr/share/doc/libusb-1.0-0/README
/usr/share/doc/libusb-1.0-0/copyright
/usr/share/doc/libusb-1.0-0/changelog.Debian.gz
/lib/x86_64-linux-gnu/libusb-1.0.so.0
The file ttwatch/includes/libttwatch.h includes libusb as #include <libusb.h>, and I've tried modifying that to #include <libusb-1.0/libusb.h>, in hopes of better matching my /usr/includes/ files, but that didn't change the error output.
Any help would be greatly appreciated!
EDIT:
Using make VERBOSE=1does show -lusb, and not -lusb-1.0:
...
/usr/bin/c++ -g CMakeFiles/ttwatch.dir/src/ttwatch.c.o CMakeFiles/ttwatch.dir/src/log.c.o CMakeFiles/ttwatch.dir/src/options.c.o CMakeFiles/ttwatch.dir/src/json.c.o CMakeFiles/ttwatch.dir/src/download.c.o CMakeFiles/ttwatch.dir/src/firmware.c.o CMakeFiles/ttwatch.dir/src/misc.c.o CMakeFiles/ttwatch.dir/src/get_activities.c.o CMakeFiles/ttwatch.dir/src/update_gps.c.o CMakeFiles/ttwatch.dir/src/set_time.c.o -o ttwatch -rdynamic libttwatch.a libttbin.a -lusb -lssl -lcrypto -lcurl
And libusb.so appears to exist:
meowmeow#kittytown:~/code/ttwatch$ dpkg-query -S /usr/lib/x86_64-linux-gnu/libusb.so
libusb-dev: /usr/lib/x86_64-linux-gnu/libusb.so
I tried uninstalling libusb-dev (sudo apt-get remove libusb-dev) and installed libusb-1.0 (sudo apt-get install libusb-1.0) to see if that would solve the issue. I now have a /usr/lib/x86_64-linux-gnu/libusb-1.0.so (note the 1.0) instead, but am now getting this from make:
make[2]: *** No rule to make target /usr/lib/x86_64-linux-gnu/libusb.so', needed by ttwatch'. Stop.
I was not aware that Debian has the packages libusb-dev and
libusb-1.0-dev. From the package information I cannot tell why there are 2
packages for the same library, perhaps libusb-dev is an older version with a
different API and other packages might still have that as a dependency. So
removing the package might not be a good idea, unless you don't care/need
packages depending on libusb-dev, in which case you can do apt-get purge
libusb-dev && apt-get autoremove. Be ware that this might uninstall
packages that you need. So do it only if you know what you are doing.
I did not expect that Debian allows you to install both packages at the same
time, but this could be if the APIs of both libraries are different and don't
conflict with each other.
This seems to confuse cmake, which somehow cannot handle when both libraries
are simultaneously installed. I've gone through the issues page and I
haven't found an issue relating to that. So if you cannot manage to build it,
I'd suggest that you go to the issue page, if you don't have an github
account, create one and leave a bug report about building the package when
libusb-dev and libusb-1.0-dev are simultaneously installed.
Another option would be to make a small modification in the file cmake_modules/FindLibUSB.cmake before you do
$ mkdir build && cd build
$ cmake ..
Find the line find_library(LIBUSB_1_LIBRARY, on the current stable version it is line 62. The next line is NAMES
and the next line is usb-1.0 usb. Remove the usb from that, so that
find_library only searches for libusb-1.0. Save the file and then you can do
$ mkdir build && cd build
$ cmake ..
This should fix the problem.

How to add sqlite extension Library to cmake in order to use spellfix1

I downloaded and compiled the following sqlite extension library: SQLITE in order to use spellfix1.
Compile and install
$ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" \
LDFLAGS="-lcrypto"
$ sudo make
$ sudo make install
Output
Libraries have been installed in:
/usr/share/tcltk/tcl8.6/sqlite3
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
rm -f /usr/share/tcltk/tcl8.6/sqlite3/libtclsqlite3.la /usr/share/tcltk/tcl8.6/sqlite3/libtclsqlite3.a
/usr/bin/install -c -m 0644 pkgIndex.tcl /usr/share/tcltk/tcl8.6/sqlite3
/usr/bin/install -c -d /usr/local/bin
./libtool --mode=install /usr/bin/install -c sqlcipher /usr/local/bin
libtool: install: /usr/bin/install -c .libs/sqlcipher /usr/local/bin/sqlcipher
/usr/bin/install -c -d /usr/local/include/sqlcipher
/usr/bin/install -c -m 0644 sqlite3.h /usr/local/include/sqlcipher
/usr/bin/install -c -m 0644 /home/hani/Documents/articles/Architecture/Modules/sqlcipher/src/sqlite3ext.h /usr/local/include/sqlcipher
/usr/bin/install -c -d /usr/local/lib/pkgconfig
/usr/bin/install -c -m 0644 sqlcipher.pc /usr/local/lib/pkgconfig"
Question
I want to add this library to my project to in order to use spellfix1.
For this I am using CMake.
Are the steps that I following correct?
First I exported the Environment variables:
$export SQLITE_EXT=/usr/local/include
$export SQLITE_LIB=/usr/share/tcltk/tcl8.6
Second I added the following lines to my CMakelist file.
link_directories($ENV{SQLITE_LIB}/sqlite3)
include_directories($ENV{SQLITE_EXT}/sqlcipher)
target_link_libraries(MyProgram tclsqlite3)
Compilation error
I included #include<sqlite3ext.h>
sqlite_modern_cpp.h is an extra layer for sqlite3.
error:
/MyProgram/3rdparty/sqlite_modern_cpp.h:160:8: error: ‘sqlite3_api’ was not declared in this scope
Update 1
I have no CMake error.
I added SQLITE_EXTENSION_INIT1 based on what was provided in the answer. No compilate error. Right now I have a runtime error which I am going to solve.
#include <sqlite3ext.h>
SQLITE_EXTENSION_INIT1
In official site, there is an example extension: half. Recently, I used it with a success. Please check it out first to find out how the extension works. And if in trouble, check out this.

configure: error: no boost.filesystem library found

So I'm trying to install ncmpcpp though this github, and the first step is to run the sh autogen.sh script. I've run into a few missing libraries, etc., but I've been able to install them and move on- up until now. I've done some searching and installed a handful of things I thought would help fix it, but to no avail.
sudo apt-get install libboost1.55-all-dev
sudo apt-get install libboost-system-dev
sudo apt-get install libboost-system1.54-dev
sudo apt-get install libboost1.54-dev
sudo apt-get install libboost-filesystem-dev
sudo apt-get install libboost-filesystem-dev libboost-thread-dev
Truth is I don't know enough about Boost or what I'm missing to fix it on my own.
This is where the problem starts:
checking for boost/filesystem.hpp... yes
checking for main in -lboost_filesystem-mt... no
configure: error: no boost.filesystem library found
edit: Here are the surrounding lines to '-lboost_filesystem-mt' in the config.log file.
configure:15510: checking for main in -lboost_filesystem-mt
configure:15529: g++ -o conftest -g -O2 -std=c++0x conftest.cpp -lboost_filesystem-mt >&5
/usr/bin/ld: cannot find -lboost_filesystem-mt
collect2: error: ld returned 1 exit status
configure:15529: $? = 1
configure: failed program was:
| /* confdefs.h */
... and then it goes on to describe the confdefs.h file.
Remove these linkes from configure.ac (section "setting boost environment"):
AS_IF([test -z "${BOOST_LIB_SUFFIX+x}"], [BOOST_LIB_SUFFIX=-mt])
AC_ARG_VAR([BOOST_LIB_SUFFIX], [Boost library name suffix [default=-mt]])
Long ago, the Boost libraries used to have a -mt suffix to indicate that they were multithreading-aware. Debian/Ubuntu dropped this years ago. Maybe other distributions retained it. The Boost library names were never very standardized in any case, which is why configure scripts often try do deal with them, often in broken ways.
You can either remove these two lines or call it like this:
$ BOOST_LIB_SUFFIX="" ./autogen.sh
The proper fix is to convert the script to use the Boost macros from the Autoconf Archive.

libtool error building thrift 0.9.1 on Ubuntu 13.04

Building thrift 0.9.1 (support C, C++, java, C#, perl, python) on Ubuntu 13.04 I am getting this error.
./configure run without any options, make run without any options...
Making all in test
make[2]: Entering directory `/home/dvb/sw/thrift-0.9.1/test'
Making all in nodejs
make[3]: Entering directory `/home/dvb/sw/thrift-0.9.1/test/nodejs'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/dvb/sw/thrift-0.9.1/test/nodejs'
Making all in cpp
make[3]: Entering directory `/home/dvb/sw/thrift-0.9.1/test/cpp'
Makefile:832: warning: overriding commands for target `gen-cpp/ThriftTest.cpp'
Makefile:829: warning: ignoring old commands for target `gen-cpp/ThriftTest.cpp'
/bin/bash ../../libtool --tag=CXX --mode=link g++ -Wall -g -O2 -L/usr/lib -o libtestgencpp.la ThriftTest_constants.lo ThriftTest_types.lo ../../lib/cpp/libthrift.la -lssl -lcrypto -lrt -lpthread
libtool: link: ar cru .libs/libtestgencpp.a .libs/ThriftTest_constants.o .libs/ThriftTest_types.o
ar: .libs/ThriftTest_constants.o: No such file or directory
make[3]: *** [libtestgencpp.la] Error 1
make[3]: Leaving directory `/home/dvb/sw/thrift-0.9.1/test/cpp'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/dvb/sw/thrift-0.9.1/test'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/dvb/sw/thrift-0.9.1'
make: *** [all] Error 2
dvb#dvb-u13:~/sw/thrift-0.9.1$
While this seems to be a defect in the 0.9.1 release tarball, it is not a problem in the top of tree pulled via git as of this afternoon.
The solution if one encounters this problem is to use a newer version of thrift by getting the source tree directly via git instead of downloading the tarball. The only difference in build is you will need to run bootstrap.sh before configure. This is well documented.
Note two additional helpful bits of data:
1. Configure to build --without-tests (Mike Johnson below - thanks)
2. This issue is fixed in 0.9.2 release (Luke below- thanks!)
I ran into this problem tonight and "fixed" it. The problem is that ar(1) can't find the .o files in the directory test/cpp/.libs. I'm sure that there's some missing magic in the Makefile.am in test/cpp, but I've neither the patience or automake-fu to fix that.
Instead, I just symlinked the .o files from test/cpp to test/cpp/.libs/. That fixes the build of the C++ tests.
cd thrift-0.9.1/test/cpp/.libs
for i in ../*.o; do echo $i; ln -s $i .; done
Thrift was since released with this compile problem. You can choose to skip compiling tests, instead:
./configure --without-tests
You can also try this:
./configure
(cd test/cpp; ln -s . .libs)
make install
This will simply link .libs back to test/cpp. "ar" will find the files there.
David V is right that 0.9.1 is broken but 0.9.2 works. The build instructions seem to be a broken link as well. So here are the commands that worked for me, from a fresh Ubuntu install:
# Install java if you don't have it
sudo apt-get install default-jre
# install build dependencies
sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev
cd /tmp
curl http://archive.apache.org/dist/thrift/0.9.2/thrift-0.9.2.tar.gz | tar zx
cd thrift-0.9.2/
./configure
make
sudo make install
#test that it can run
thrift --help
(credit goes to these helpful instructions; I just replaced 0.9.1 with 0.9.2)
I happened to face this problem. You can try cp all test/cpp/*.o to .libs folder.
Or you can skip compiling tests.
cp test/cpp/*.o test/cpp/.libs/