compile error in VeridisBiometricSDK_5.0_Linux sample: MatchingExample - c++

I try to use VeridisBiometricSDK_5.0_Linux which is free Biometric library which has samples I tired to compile MatchingExample by doing exactly what the Readme file said :
make MatchingExample.cpp
but I have this error result:
root#localhost MatchingExample]# make MatchingExample
g++ -Wall -g MatchingExample.cpp -o ../../../bin/MatchingExample -I../../../include/ -L../../../lib/ -lVrBio -lpthread -ludev -lusb -lusb-1.0 -ldl
MatchingExample.cpp: In function ‘int main()’:
MatchingExample.cpp:47: warning: deprecated conversion from string constant to ‘char*’
MatchingExample.cpp:55: warning: deprecated conversion from string constant to ‘char*’
/usr/bin/ld: warning: libtiff.so.4, needed by ../../../lib//libVrBio.so, not found (try using -rpath or -rpath-link)
../../../lib//libVrBio.so: undefined reference to `TIFFWriteScanline'
../../../lib//libVrBio.so: undefined reference to `TIFFDefaultStripSize'
../../../lib//libVrBio.so: undefined reference to `__fdelt_chk#GLIBC_2.15'
../../../lib//libVrBio.so: undefined reference to `_TIFFmalloc'
../../../lib//libVrBio.so: undefined reference to `memcpy#GLIBC_2.14'
../../../lib//libVrBio.so: undefined reference to `TIFFClose'
../../../lib//libVrBio.so: undefined reference to `TIFFSetErrorHandler'
../../../lib//libVrBio.so: undefined reference to `TIFFGetField'
../../../lib//libVrBio.so: undefined reference to `_TIFFfree'
../../../lib//libVrBio.so: undefined reference to `TIFFClientOpen'
../../../lib//libVrBio.so: undefined reference to `TIFFSetField'
../../../lib//libVrBio.so: undefined reference to `TIFFReadDirectory'
../../../lib//libVrBio.so: undefined reference to `TIFFSetWarningHandler'
../../../lib//libVrBio.so: undefined reference to `TIFFReadRGBAImageOriented'
collect2: ld returned 1 exit status
make: *** [MatchingExample] Error 1
==================================================
this is the Makefile codes:
# ------------------ Compilation options ------------------------
# Loads libraries.
LIBS = -lVrBio -lpthread -ludev -lusb -lusb-1.0 -ldl
# Flags for the C compiler:
# -Wall for strict gcc warnings (requires prototypes for all functions).
# -g to produce debug data for gdb
# -O for optimization
CFLAGS = -Wall -g
CC = g++
# --------------------- Directory Paths ----------------------------
INC_DIRS = -I../../../include/
LIB_DIRS = -L../../../lib/
BIN_DIR = ../../../bin/
# --------------------- Code modules ----------------------------
# Object files
#OBJ =
# Definitions
#DEFS =
# ------------------------ Rules --------------------------------
$#.cpp: $#.cpp
${CC} $(CFLAGS) $#.cpp -o $(BIN_DIR)$# $(INC_DIRS) $(LIB_DIRS) $(LIBS)
==========================
aslo this is the ReadMe file content
In the AsyncCaptureExample folder there is a Makefile. This Makefile can be used for all the
other cpp examples.
To compile use: make
For example: make AsyncCaptureExample
The output will be generated in the bin folder.
also this is the VeridisBiometricSDK_5.0 ReadMe file:
1 - install necessary packages:
*libudev
*libusb
*libusb-1.0
*fxload
2 - In the misc folder there are files necessary for the program access the USB with the extension .rules. Copy them
to /etc/udev/rules.d folder or equivalent
3 - mkdir /usr/share/usb and copy the .hex files of the misc folder there
4 - Set LD_LIBRARY_PATH as the path to the .so files
5 - copy the file UFLicense.dat, which is in the misc folder, to the folder of your application
if you use suprema readers.
would you please help me?
UPDATE
I am so close to solve my problem:
First, I found solution for installing libtiff.so.4 for Ubuntu on this the following link:
https://askubuntu.com/questions/457011/why-is-libtiff-so-4-not-recognized
Second, I convert the same Ubuntu library package into centos rpm using alien tool as the following:
alien -r -g libtiff4_3.9.7-2ubuntu1_amd64.deb
Third, I Installed libtiff4-3.9.7-3.x86_64.rpm (which is result from alien converting) on my Centos 6.7 it installed successfully but when try make my samples I supersized that libtiff.so.4 requires 2 library which are
[root#localhost]# readelf -d /usr/lib/x86_64-linux-gnu/libtiff.so.4
0x0000000000000001 (NEEDED) Shared library: [libjbig.so.0]
0x0000000000000001 (NEEDED) Shared library: [libjpeg.so.8]
I installed libjpeg.so.8 from source code library from jpegsrc.v8.tar.gz and it worked well
But I couldn’t find any suitable package to fix missing libbig.so.0 library
So would you help me to fix this missing library…
By way the when I fixed my problem, I will explain the all solution so it will be useful for any one

Finally I solved my problem
if you read my problem you would know that my problem is missing libtiff.so.4
I fixed it,
my solutions steps as follows
first
if you dipslay current libtiff.so by using this command
[yaserco#localhost Desktop]$ locate libtiff.so
/usr/lib64/libtiff.so.3
so I made symble link to libtiff.so.3
ln -s /usr/lib64/libtiff.so.3 /usr/lib64/libtiff.so.4
after I tested my sample it diplayed this 2 error messages
tried this solution: first create symbolic link ln -s /usr/lib64/libtiff.so.3.9.4 /usr/lib64/libtiff.so.4 then I did the command [root#localhost MatchingExample]# make MatchingExample it had an error result as:
MatchingExample.cpp: In function ‘int main()’:
MatchingExample.cpp:47: warning: deprecated conversion from
string constant to ‘char*’ MatchingExample.cpp:55: warning: deprecated
conversion from string constant to ‘char*’ ../../../lib//libVrBio.so:
undefined reference to __fdelt_chk#GLIBC_2.15' ../../../lib//libVrBio.so:
undefined reference to memcpy#GLIBC_2.14'
second
I solved this error by installing
A-
glibc for (GLIBC_2.14) as the follows:
cd /tmp
wget http://ftp.gnu.org/gnu/glibc/glibc-2.16.0.tar.gz
tar -xvzf glibc-2.16.0.tar.gz
cd glibc-2.16.0
mkdir glibc-build
cd glibc-build
../configure --prefix='/usr'
B-
We have to fix a little typo, so run:
nano +171 ../scripts/test-installation.pl
and replace if (/$ld_so_name/) { with if (/\Q$ld_so_name\E/) {
:
make
sudo make install
see more form this link
https://github.com/FezVrasta/ark-server-tools/wiki/Install-of-required-versions-of-glibc-and-gcc-on-RHEL-CentOS
then when I compile my sample it worked well

Related

Program with protocol-buffers don't compile with MinGW-w64: "undefined reference to google::protobuf:: ..."

I have installed the libprotobuf-dev=2.6.0-4 and protobuf-compiler=2.6.0-4 packages from Debian Jessie repository. Now I'm trying to compile a program that use the 'addressbook.proto' file from the Google Developers example with the MinGW-w64 compiler. I'm using Ubuntu 14.04.
With this command the program works:
$ g++ main.cpp addressbook.pb.cc -lprotobuf
But I want to compile for Windows too.
I added the symlink: /usr/include/google -> /usr/i686-w64-mingw32/include/google.
$ i686-w64-mingw32-g++ main.cpp addressbook.pb.cc -lprotobuf
/usr/bin/i686-w64-mingw32-ld: cannot find -lprotobuf
collect2: error: ld returned 1 exit status
With the library location still not working:
$ i686-w64-mingw32-g++ -L /usr/lib/i386-linux-gnu/ main.cpp addressbook.pb.cc -lprotobuf
/tmp/ccB1VJyR.o:main.cpp:(.text$_ZN6google8protobuf8internal27GetEmptyStringAlreadyInitedEv[__ZN6google8protobuf8internal27GetEmptyStringAlreadyInitedEv]+0x7): undefined reference to `google::protobuf::internal::empty_string_'
/tmp/ccB1VJyR.o:main.cpp:(.text$_ZN6google8protobuf8internal27GetEmptyStringAlreadyInitedEv[__ZN6google8protobuf8internal27GetEmptyStringAlreadyInitedEv]+0x2f): undefined reference to `google::protobuf::internal::empty_string_'
/tmp/ccPz4uiI.o:addressbook.pb.cc:(.text+0x78): undefined reference to `google::protobuf::DescriptorPool::generated_pool()'
/tmp/ccPz4uiI.o:addressbook.pb.cc:(.text+0x87): undefined reference to `google::protobuf::DescriptorPool::FindFileByName(std::string const&) const'
...
libprotobuf-dev contains library headers and pre-built binaries for your system. If you are cross-compiling you need to compile library from sources to target system as well. Something like "./configure CC=i686-w64-mingw32-g++" in library sources directory should do the job.

Linker Error using g++ with Qt 4.5.1

I'm trying to test out a new dev environment and I am having some problems referencing some of the required Qt libraries.
First I ran this:
$ g++ HelloWorld.C -o HelloWorld -I /usr/local/Trolltech/Qt-4.5.1/include/QtCore/ -I /usr/local/Trolltech/Qt-4.5.1/include/
and got this error:
/tmp/ccmsm4kZ.o: In function `QString::QString(char const*)':
HelloWorld.C:(.text._ZN7QStringC2EPKc[_ZN7QStringC5EPKc]+0x1d): undefined reference to `QString::fromAscii_helper(char const*, int)'
/tmp/ccmsm4kZ.o: In function `QString::~QString()':
HelloWorld.C:(.text._ZN7QStringD2Ev[_ZN7QStringD5Ev]+0x2d): undefined reference to `QString::free(QString::Data*)'
collect2: ld returned 1 exit status
So then I added reference to the QtCore library via:
$ g++ HelloWorld.C -o HelloWorld -I /usr/local/Trolltech/Qt-4.5.1/include/QtCore/ -I /usr/local/Trolltech/Qt-4.5.1/include/ -L /usr/local/Trolltech/Qt-4.5.1/lib -lQtCore
which removed the compile errors, however when I try to run the program I get this error:
./HelloWorld: error while loading shared libraries: libQtCore.so.4: cannot open shared object file: No such file or directory
I wasn't able to find a solution for this problem via google. Anyone have advice?
That error indicates that while the linker can find the library at compilation, it can't find it during runtime.
You should update your LD_LIBRARY_PATH to include that location like this:
In ~.bashrc probably somewhere near the bottom:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Trolltech/Qt-4.5.1/lib
Alternatively, if you want to make this persistent throughout your system (and have root access), you can make an entry in /etc/ld.so.conf.d (on RedHat, I'm not sure about the other distributions)
touch /etc/ld.so.conf.d/qt.conf
Add the path to this file, and then update your runtime via /sbin/ldconfig

Linker error in g++ while trying to link to SDL_ttf shared object files

I am trying to use the SDL_ttf development library in an Ubuntu environment. I started by downloading the dev libraries via: sudo apt-get install libsdl-ttf2.0-dev.
Next, I imported the header file in my code as so:
#include <SDL_ttf.h>
When I compile with the command:
g++ -g -I /usr/include/SDL Main.cpp -lSDL -lSDL_image -lSDL_ttf land.cpp PerlinNoise.cpp Util.cpp org.cpp Init.cpp `sdl-config --libs
I get the following output:
/tmp/ccpLKljA.o: In function `init()':
/home/zoo/Desktop/World-A/Util.cpp:39: undefined reference to `TTF_Init'
/home/zoo/Desktop/World-A/Util.cpp:42: undefined reference to `TTF_Quit'
/home/zoo/Desktop/World-A/Util.cpp:48: undefined reference to `TTF_OpenFont'
/home/zoo/Desktop/World-A/Util.cpp:52: undefined reference to `TTF_Quit'
collect2: ld returned 1 exit status
I understand this is a linker error however I do not know what to do to fix it. I know that the -lSDL_ttf command is not doing anything because removing it does not change anything. I tried to reference the .so file however that didn't change the results. I did this reference via the command: -LlibSDL_ttf-2.0.so.0.6.3. I am able to view the .so file and it does contain the commands listed above.
You have to put land.cpp, and the rest of the CPP files, before the libraries on the command line.

Compile C++ and OpenSSL on Ubuntu 11.10

I got a serious problem compiling my C++ and OpenSSL project on my Ubuntu 11.10.
The compiling command is:
g++ -Wall -lssl -lm -lcrypto -I ./src ./src/server.cpp -o ./bin/server
I receive these errors:
server.cpp:(.text+0x8ff): undefined reference to `RSA_new'
server.cpp:(.text+0x92d): undefined reference to `PEM_read_RSAPrivateKey'
server.cpp:(.text+0xa85): undefined reference to `RSA_size'
server.cpp:(.text+0xaa1): undefined reference to `RSA_size'
server.cpp:(.text+0xae7): undefined reference to `RSA_private_decrypt'
server.cpp:(.text+0xd84): undefined reference to `BF_set_key'
server.cpp:(.text+0xf1d): undefined reference to `BF_ecb_encrypt'
server.cpp:(.text+0x13c6): undefined reference to `BF_ecb_encrypt'
collect2: ld returned 1 exit status
make: *** [server] Error 1
I successfully installed openssl and libssl-dev but the problem persists.
I tried to compile the project on Linux Mint 12 with the kernel 3.0 and I had the same problem.
On my old Linux OS with the kernel 2.6 the project compiled and worked fine (using the same Makefile and the same sources).
Please help me!
Generally you need to have the -l link flags after the code that references them. Try
g++ -Wall -I ./src ./src/server.cpp -o ./bin/server -lssl -lm -lcrypto
As the comment to this answer states, the linker only looks for undefined symbols to include in the order the parameters are listed.
That is, if your cpp file uses the libraries, the libraries have to be listed after the cpp file.
Those error are from crypto library, check whether ssl and crypto libraries are available in /usr/lib or where ever u installed if not install them and have u set the library search path for libssl and libcrypto in your compiling command?

Problem in building my own module in omnetpp

I'm trying to write an application using the UDP module included
in the inetmanet framework in omnetpp. The problem is that the files that I have to include don't get included in the linking phase.
The errors are:
opp_makemake
bedo#ethereal:~/omnetpp/samples/Basic-Broadcast-Simulation$ opp_makemake --deep -f -I../inet-sommer/src/transport/contract -I../inet-sommer/src/networklayer/contract -I../inet-sommer/src/base
Creating Makefile in /home/bedo/omnetpp/samples/Basic-Broadcast-Simulation...
Makefile created, running "make depend" to add dependencies...
opp_makedep -Y --objdirtree -I../inet-sommer/src/transport/contract -I../inet-sommer/src/networklayer/contract -I../inet-sommer/src/base -I. -Igcc-debug -Igcc-debug/src -Igcc-debug/src/flooding -Isimulations -Isimulations/bitmaps -Isimulations/results -Isrc -Isrc/flooding -f Makefile -P\$O/ -- ./*.cc gcc-debug/*.cc gcc-debug/src/*.cc gcc-debug/src/flooding/*.cc simulations/*.cc simulations/bitmaps/*.cc simulations/results/*.cc src/*.cc src/flooding/*.cc
make
bedo#ethereal:~/omnetpp/samples/Basic-Broadcast-Simulation$ make
g++ -c -g -Wall -fno-stack-protector -DHAVE_PCAP -DXMLPARSER=libxml -DWITH_PARSIM -DWITH_NETBUILDER -I../inet-sommer/src/transport/contract -I../inet-sommer/src/networklayer/contract -I../inet-sommer/src/base -I. -Igcc-debug -Igcc-debug/src -Igcc-debug/src/flooding -Isimulations -Isimulations/bitmaps -Isimulations/results -Isrc -Isrc/flooding -I/home/bedo/omnetpp/include -o out/gcc-debug//src/flooding/Flooding.o src/flooding/Flooding.cc
src/flooding/Flooding.cc: In member function ‘virtual void Flooding::handleLowerMsg(cMessage*)’:
src/flooding/Flooding.cc:82: warning: unused variable ‘m’
g++ -Wl,--export-dynamic -Wl,-rpath,/home/bedo/omnetpp/lib -Wl,-rpath,. -o out/gcc-debug//Basic-Broadcast-Simulation out/gcc-debug//src/flooding/Flooding.o -Wl,--whole-archive -Wl,--no-whole-archive -L"/home/bedo/omnetpp/lib/gcc" -L"/home/bedo/omnetpp/lib" -u _tkenv_lib -lopptkenvd -loppenvird -lopplayoutd -u _cmdenv_lib -loppcmdenvd -loppenvird -loppsimd -ldl -lstdc++
out/gcc-debug//src/flooding/Flooding.o: In function `Flooding::setupLowerLayer()':
/home/bedo/omnetpp/samples/Basic-Broadcast-Simulation/src/flooding/Flooding.cc:50: undefined reference to `UDPControlInfo::UDPControlInfo()'
/home/bedo/omnetpp/samples/Basic-Broadcast-Simulation/src/flooding/Flooding.cc:52: undefined reference to `UDPSocket::generateSocketId()'
out/gcc-debug//src/flooding/Flooding.o: In function `Flooding::sendMessage()':
/home/bedo/omnetpp/samples/Basic-Broadcast-Simulation/src/flooding/Flooding.cc:101: undefined reference to `UDPControlInfo::UDPControlInfo()'
/home/bedo/omnetpp/samples/Basic-Broadcast-Simulation/src/flooding/Flooding.cc:103: undefined reference to `IPAddress::ALL_HOSTS_MCAST'
collect2: ld returned 1 exit status
make: *** [out/gcc-debug//Basic-Broadcast-Simulation] Error 1
bedo#ethereal:~/omnetpp/samples/Basic-Broadcast-Simulation$
I really don't know why they get included, and my module compile fine, but in the linking phase I get "undefined reference".
Any idea?
You can run nm on on all libraries you link with to see which library undefined symbols like this:
nm liboppcmdenvd.(so/a) | c++filt | grep UDPControlInfo
(c++filt demangles C++ symbols).
Library that requires the symbol will get output something like (U for Undefined):
00000000007f90a0 U UDPControlInfo
Library that defines/has the symbol will get output something like:
00000000007f90a0 T UDPControlInfo
This can be T or t
Of course, libraries you link with are indicated by arguments with starting by -l:
-lopptkenvd -loppenvird -lopplayoutd -u _cmdenv_lib -loppcmdenvd -loppenvird
liboppcmdenvd liboppenvird liboppsimd libUDPControlInfo
Solved. I modified the makefile in the root directory to a simpler one, leaving all the compile and linking duties to the src's makefile.
Thanks everyone