Makefile: build of c++ file on linux, unable to locate cuda libraries in opencv 2.4.6 - linux

Hopefully someone can help with this.
After rebuilding OpenCV 2.4.6 with Cuda Toolkit 5.5 on linux, an attempt was made to build a single c++ file that references OpenCV and CUDA using via make and a CLI g++ command. The input and output from each approach are shown below.
The Makefile attempts to reference the *.a files from OpenCV, but is not successful. The CLI g++ command attempts to reference *.so files, which it seems to do, however, some methods appear to be undefined.
Is it necessary for the Makefile to access only the OpenCV *.a files?
Makefile:
CFLAGS = -g Wall
LIBPATH = /data/content/cuda/opencv-2.4.6/lib
LIBS = -lopencv_calib3d_pch_dephelp -lopencv_contrib_pch_dephelp -lopencv_core_pch_dephelp -lopencv_features2d_pch_dephelp -lopencv_flann_pch_dephelp -lopencv_gpu_pch_dephelp -lopencv_haartraining_engine -lopencv_highgui_pch_dephelp -lopencv_imgproc_pch_dephelp -lopencv_legacy_pch_dephelp -lopencv_ml_pch_dephelp -lopencv_nonfree_pch_dephelp -lopencv_objdetect_pch_dephelp -lopencv_perf_calib3d_pch_dephelp -lopencv_perf_core_pch_dephelp -lopencv_perf_features2d_pch_dephelp -lopencv_perf_gpu_pch_dephelp -lopencv_perf_highgui_pch_dephelp -lopencv_perf_imgproc_pch_dephelp -lopencv_perf_nonfree_pch_dephelp -lopencv_perf_objdetect_pch_dephelp -lopencv_perf_photo_pch_dephelp -lopencv_perf_stitching_pch_dephelp -lopencv_perf_superres_pch_dephelp -lopencv_perf_video_pch_dephelp -lopencv_photo_pch_dephelp -lopencv_stitching_pch_dephelp -lopencv_superres_pch_dephelp -lopencv_test_calib3d_pch_dephelp -lopencv_test_contrib_pch_dephelp -lopencv_test_core_pch_dephelp -lopencv_test_features2d_pch_dephelp -lopencv_test_flann_pch_dephelp -lopencv_test_gpu_pch_dephelp -lopencv_test_highgui_pch_dephelp -lopencv_test_imgproc_pch_dephelp -lopencv_test_legacy_pch_dephelp -lopencv_test_ml_pch_dephelp -lopencv_test_nonfree_pch_dephelp -lopencv_test_objdetect_pch_dephelp -lopencv_test_photo_pch_dephelp -lopencv_test_stitching_pch_dephelp -lopencv_test_superres_pch_dephelp -lopencv_test_video_pch_dephelp -lopencv_ts_pch_dephelp -lopencv_video_pch_dephelp -lopencv_videostab_pch_dephelp -lopencv_gpu -lopencv_highgui
INCLUDEPATH1 = /usr/include/opencv2/core
INCLUDEPATH2 = /usr/include/opencv2/highgui
INCLUDEPATH3 = /usr/include/opencv2/gpu
all: tiff2png1.so
tiff2png1.so: main.o
g++ -o tiff2png1.so main.o **-L $(LIBPATH) $(LIB)**
main.o: main.cpp
g++ -c main.cpp -g -Wall -I $(INCLUDEPATH1) -I $(INCLUDEPATH2) -I $(INCLUDEPATH3) $(LIBPATH)
.PHONY: clean
clean:
rm -vf tiff2png1.so *.o
Makefile Output:
g++ -o tiff2png1.so main.o -L /data/content/cuda/opencv-2.4.6/lib
main.o: In function main':
/home/.../main.cpp:13: undefined reference tocv::gpu::getCudaEnabledDeviceCount()'
/home/.../main.cpp:15: undefined reference to cv::gpu::getDevice()'
/home/.../main.cpp:21: undefined reference tocv::imread(std::basic_string, std::allocator > const&, int)'
/home/.../main.cpp:27: undefined reference to cv::gpu::GpuMat::GpuMat(cv::Mat const&)'
/home/.../main.cpp:29: undefined reference tocv::gpu::Stream::Null()'
/home/.../main.cpp:29: undefined reference to cv::gpu::resize(cv::gpu::GpuMat const&, cv::gpu::GpuMat&, cv::Size_<int>, double, double, int, cv::gpu::Stream&)'
/home/.../main.cpp:42: undefined reference tocv::Mat::Mat(cv::gpu::GpuMat const&)'
/home/.../main.cpp:49: undefined reference to cv::_InputArray::_InputArray(cv::Mat const&)'
...
main.o: In function~GpuMat': /usr/include/opencv2/core/gpumat.hpp:374: undefined reference to `cv::gpu::GpuMat::release()'
collect2: ld returned 1 exit status
make: * [tiff2png1.so] Error 1
Command Line Build
$ g++ -o tx.exe main.o -L/data/content/cuda/opencv-2.4.6/lib -lopencv_gpu
Command Line Build Output
/data/content/cuda/opencv-2.4.6/lib/libopencv_gpu.so: undefined reference to `cv::gpu::convertTo(cv::gpu::GpuMat const&, cv::gpu::GpuMat&, double, double, CUstream_st*)'
/data/content/cuda/opencv-2.4.6/lib/libopencv_gpu.so: undefined reference to `cv::gpu::setTo(cv::gpu::GpuMat&, cv::Scalar_, cv::gpu::GpuMat const&, CUstream_st*)'
/data/content/cuda/opencv-2.4.6/lib/libopencv_gpu.so: undefined reference to `cv::gpu::setTo(cv::gpu::GpuMat&, cv::Scalar_, CUstream_st*)'
collect2: ld returned 1 exit status

It looks like you may have omitted an 'S' at the end of your variable in the linker target
**LIBS** = -lopencv_calib3d_pch_dephelp ...
tiff2png1.so: main.o
g++ -o tiff2png1.so main.o -L $(LIBPATH) $(**LIB**)
and so the -l options aren't being passed to the linker
g++ -o tiff2png1.so main.o -L /data/content/cuda/opencv-2.4.6/lib **should be here** main.o

Related

ifort compile executable linux undefined reference to

I have the following makefile
#makefile for building Linux 64b executable
FC = ifort
MPPD = -DAUTODOUBLE -4R8 -4I8
FLAGS = -safe_cray_ptr -assume byterecl,buffered_io,protect_parens -warn nousage -zero -ftz -fp-model precise -mP2OPT_hpo_dist_factor=21 -diag-disable 10212,10010 -fimf-arch-consistency=true -traceback -pad -DLINUX -DIFORT -DNET_SECURITY -DADDR64 -DINTEL -DXEON64 -DFCC80 -DTIMER=cycle_time -DSSE2 -DOVERRIDE -DMPP -DMPICH -DHPMPI -DAUTODOUBLE -DNEWIO -DEXTENDED -DLSTCODE -DENABLE_HASH3 -DFFTW -DZMF2 -DUSES_CXX -DPFEM -DSPRNG -DUSE_SPRNG -DUSES_CPP -DPTHREADS -nodps -i8 -r8 -DSPRNG_MPI -DUSE_MPI -DINTEL -DAdd_ -xSSE2 -align array16byte -fPIC -O2
TARGET = mppdyna
MPICH_LIB = /opt/intel/impi/4.1.3.048/mic/lib/libmpi.so
MPICH_INC = /opt/intel/impi/4.1.3.048/mic/include/
FFLAGS = $(FLAGS) -I. -I$(MPICH_INC) -I/opt/ibm/platform_mpi/include/
LINKLIBS = libgcrypt.so.20 libgpg-error.so.0 libpthread.so.0 libtriboformplugin.so
OBJS = dyn21.o dyn21b.o couple2other_user.o triboform_lsdyna_plugin.o
$(TARGET): $(OBJS)
$(FC) -w -o mppdyna.out $(OBJS) $(LINKLIBS)
init_dyn21.o: init_dyn21.f nhisparm.inc
$(FC) -c $(FFLAGS) init_dyn21.f
dyn21.o: dyn21.f nhisparm.inc
$(FC) -c $(FFLAGS) dyn21.f
dyn21b.o: dyn21b.f nhisparm.inc
$(FC) -c $(FFLAGS) dyn21b.f
couple2other_user.o: couple2other_user.f
$(FC) -c $(FFLAGS) couple2other_user.f
dynrfn_user.o: dynrfn_user.f
$(FC) -c $(FFLAGS) dynrfn_user.f
triboform_lsdyna_plugin.o: triboform_lsdyna_plugin.f
$(FC) -c $(FFLAGS) triboform_lsdyna_plugin.f
clean:
-#rm mppdyna 2>/dev/null || :
rm -rf *.o
And it gives me the following error message
...
...
dyn21b.f:(.text+0x90cd2): undefined reference to `adios_'
dyn21b.o: In function `umat48c_':
dyn21b.f:(.text+0x90dc2): undefined reference to `adios_'
dyn21b.o:dyn21b.f:(.text+0x90eb2): more undefined references to `adios_' follow
dyn21b.o: In function `thumat12_':
dyn21b.f:(.text+0x961ed): undefined reference to `crvval_'
dyn21b.f:(.text+0x96260): undefined reference to `crvval_'
dyn21b.o: In function `thumat13_':
dyn21b.f:(.text+0x963bc): undefined reference to `adios_'
...
...
libtriboformplugin.so: undefined reference to `do_license_check'
libtriboformplugin.so: undefined reference to `write_processing_file'
libtriboformplugin.so: undefined reference to `strerror_s'
libtriboformplugin.so: undefined reference to `fopen_s'
libtriboformplugin.so: undefined reference to `freopen_s'
make: *** [mppdyna] Error 1
I'm relatively new with ifort, can anyone point to me where my fault is?
which ifort points to /opt/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort and I'm also using platform_mpi.
I've created libtriboformplugin.so with another makefile (succesfully) that's from a C project.

link error with "undefined lua_xxxxx" when building lsnes

In my ubuntu 14.xx, I try to compile lsnes emulator to use the mario-ai script from aleju/mario-ai, and I've tried to google many solutions to solve the problem below:
Here is the output from the console:
make[3]: __all__.files' is up to date.
make[3]: Leaving directory/home/pengsuyu/software/lsnes/sourcecode/src/platform/macosx'
make[2]: Leaving directory /home/pengsuyu/software/lsnes/sourcecode/src/platform'
g++ -o lsnescat all_common.files all_platform.files-pthread -lboost_iostreams -lboost_filesystem -lboost_system -lz -lgcrypt -lgpg-error -L/usr/lib/x86_64-linux-gnu -lcurl -rdynamic -ldlcat core/all.ldflags lua/all.ldflags fonts/all.ldflags library/all.ldflags interface/all.ldflags video/all.ldflags emulation/all.ldflags cmdhelp/all.ldflags platform/all.ldflags
core/multitrack.o: In functionlua::state::get_string(int, std::string const&)':
/home/pengsuyu/software/lsnes/sourcecode/src/core/../../include/library/lua-base.hpp:317: undefined reference to lua_tolstring'
core/multitrack.o: In functionlua::state::get_bool(int, std::string const&)':
/home/pengsuyu/software/lsnes/sourcecode/src/core/../../include/library/lua-base.hpp:334: undefined reference to lua_toboolean'
core/multitrack.o: In functionlua::state::type(int)':
.
.
/home/pengsuyu/software/lsnes/sourcecode/src/library/lua.cpp:536: undefined reference to lua_close'
library/lua.o: In functionlua::state::pushcfunction(int ()(lua_State))':
/home/pengsuyu/software/lsnes/sourcecode/src/library/../../include/library/lua-base.hpp:504: undefined reference to lua_pushcclosure'
library/lua.o: In functionlua::state::getfield(int, char const*)':
/home/pengsuyu/software/lsnes/sourcecode/src/library/../../include/library/lua-base.hpp:506: undefined reference to lua_getfield'
library/lua.o: In functionlua::state::insert(int)':
/home/pengsuyu/software/lsnes/sourcecode/src/library/../../include/library/lua-base.hpp:509: undefined reference to lua_insert'
collect2: error: ld returned 1 exit status
make[1]: *** [lsnes] Error 1
make[1]: Leaving directory/home/pengsuyu/software/lsnes/sourcecode/src'
make: *** [src/all_files] Error 2
==================================
At the beginning, I think, the linker cannot find my lua library. So I tried to compile my main.cpp with test.lua.
main.cpp:
#include <stdio.h>
#include <iostream>
//extern "C"
//{
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
//} // liblua5.1-c++.a
lua_State * L;
int main ()
{
L = lua_open();
luaL_openlibs(L);
luaL_dofile(L, "d:\\test.lua");
return 0;
}
test.lua:
print("Hello World");
I write a MakeFile to generate the executable file "main":
main:main.o
gcc -o $# $< -llua5.1 -lstdc++
main.o:
gcc -c main.cpp
clean:
-rm *.o
It works when I add the compile option "-llua5.1" and "-lstdc++" otherwise it throws the same error as I compiled lsnes
I am not familiar with gcc and Makefile. Please help me to solve this problem.
I've solved my question
The way to solve this problem is just to change one line in the file named "options.build".
1. find the line "LUA=lua" in options.build
2. change this line to "LUA=lua5.1"
because the needed library is 5.1, so if you want to build it successfully, you must use the "lua5.1" library however the default configuration is "lua" not "lua5.1"

Error while building OpenSSL for android using ndk

I am trying to build openSSL for android using ndk. I am using dockerFile concept. I have set few environment variables as per suggested in http://wiki.openssl.org/index.php/Android. Now I am getting following error:
make[2]: Entering directory `/Android/openssl/apps'
( :; LIBDEPS="${LIBDEPS:--L.. -lssl -L.. -lcrypto -ldl}"; LDCMD="${LDCMD:-arm-l
inux-androideabi-gcc}"; LDFLAGS="${LDFLAGS:--DOPENSSL_THREADS -D_REENTRANT -DDSO
_DLFCN -DHAVE_DLFCN_H --static -Wa,--noexecstack -march=armv7-a -mandroid -I/And
roid/android-ndk-r10c/platforms/android-19/arch-arm/usr/include -B/Android/andro
id-ndk-r10c/platforms/android-19/arch-arm/usr/lib -O3 -fomit-frame-pointer -Wall
-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_AS
M -DAES_ASM -DBSAES_ASM -DGHASH_ASM}"; LIBPATH=`for x in $LIBDEPS; do echo $x; d
one | sed -e 's/^ *-L//;t' -e d | uniq`; LIBPATH=`echo $LIBPATH | sed -e 's/ /:/
g'`; LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ${LDCMD} ${LDFLAGS} -o ${APPNAME:
=openssl} openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd
.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o
ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o
s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.
o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o eng
ine.o ocsp.o prime.o ts.o srp.o ${LIBDEPS} )
/Android/toolchain-arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: unde
fined reference to 'dlopen'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: unde
fined reference to 'dlsym'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: unde
fined reference to 'dlclose'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_func: error: undefin
ed reference to 'dlsym'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_func: error: undefin
ed reference to 'dlerror'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_var: error: undefine
d reference to 'dlsym'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_var: error: undefine
d reference to 'dlerror'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined re
ference to 'dlopen'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined re
ference to 'dlclose'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined re
ference to 'dlerror'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_unload: error: undefined
reference to 'dlclose'
collect2: error: ld returned 1 exit status
make[2]: Leaving directory `/Android/openssl/apps'
make[2]: *** [link_app.] Error 1
make[1]: *** [openssl] Error 2
make[1]: Leaving directory `/Android/openssl/apps'
make: *** [build_apps] Error 1
INFO[0135] The command [/bin/sh -c cd openssl && ./config --static no-ssl2 no-ss
l3 no-comp no-hw no-engine && make depend && make && ls -hs . && cp l
ibssl.a /Android/output] returned a non-zero code: 2
docker#boot2docker:/home/curl_ssl$
Do you have suggestions to resolve above error? I am not able to find what is reason behind such error.
Android has openssl already. Perhaps you do not need to compile them. Try answer from this question Compiling OpenSSL on Android

Compile error on opencv cuda program

I tried a sample opencv program to run on cuda. I have doownloaded opencv and compiled it and as last step run make install and it went successfull.
I tried the following program
#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/gpu/gpu.hpp"
int main (int argc, char* argv[])
{
try
{
cv::Mat src_host = cv::imread("file.png", CV_LOAD_IMAGE_GRAYSCALE);
cv::gpu::GpuMat dst, src;
src.upload(src_host);
cv::gpu::threshold(src, dst, 128.0, 255.0, CV_THRESH_BINARY);
cv::Mat result_host = dst;
cv::imshow("Result", result_host);
cv::waitKey();
}
catch(const cv::Exception& ex)
{
std::cout << "Error: " << ex.what() << std::endl;
}
return 0;
}
Saved this as test.cu and compiled. The output is
# nvcc test.cu
/tmp/tmpxft_000018a4_00000000-13_test.o: In function `main':
tmpxft_000018a4_00000000-1_test.cudafe1.cpp:(.text+0x53): undefined reference to `cv::imread(std::string const&, int)'
tmpxft_000018a4_00000000-1_test.cudafe1.cpp:(.text+0xf7): undefined reference to `cv::gpu::GpuMat::upload(cv::Mat const&)'
tmpxft_000018a4_00000000-1_test.cudafe1.cpp:(.text+0xfc): undefined reference to `cv::gpu::Stream::Null()'
tmpxft_000018a4_00000000-1_test.cudafe1.cpp:(.text+0x130): undefined reference to `cv::gpu::threshold(cv::gpu::GpuMat const&, cv::gpu::GpuMat&, double, double, int, cv::gpu::Stream&)'
....................
.....................
.......................
Then I run
# nvcc test.cu -lopencv_gpu
/usr/bin/ld: /tmp/tmpxft_000018df_00000000-13_test.o: undefined reference to symbol '_ZTIN2cv9ExceptionE'
/usr/bin/ld: note: '_ZTIN2cv9ExceptionE' is defined in DSO /usr/local/lib/libopencv_core.so.2.4 so try adding it to the linker command line
/usr/local/lib/libopencv_core.so.2.4: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
and
# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2012 NVIDIA Corporation
Built on Thu_Apr__5_00:24:31_PDT_2012
Cuda compilation tools, release 4.2, V0.2.1221
UPDATE
# nvcc test.cu -lm -lopencv_core -lopencv_highgui
/tmp/tmpxft_00001c51_00000000-13_test.o: In function `main':
tmpxft_00001c51_00000000-1_test.cudafe1.cpp:(.text+0xfc): undefined reference to `cv::gpu::Stream::Null()'
tmpxft_00001c51_00000000-1_test.cudafe1.cpp:(.text+0x130): undefined reference to `cv::gpu::threshold(cv::gpu::GpuMat const&, cv::gpu::GpuMat&, double, double, int, cv::gpu::Stream&)'
collect2: error: ld returned 1 exit status
I gave
# nvcc test.cu -lm -lopencv_core -lopencv_highgui -lopencv_gpu
and its working fine.
Now I m getting following error when running
# ./a.out
OpenCV Error: Gpu API call (invalid configuration argument) in call, file /home/cuda/helloworld/Downloads/OpenCV/opencv-2.4.5/modules/gpu/include/opencv2/gpu/device/detail/transform_detail.hpp, line 361
Error: /home/cuda/helloworld/Downloads/OpenCV/opencv-2.4.5/modules/gpu/include/opencv2/gpu/device/detail/transform_detail.hpp:361: error: (-217) invalid configuration argument in function call
Add " -lm -lopencv_core -lopencv_highgui " options to your comile code
I think you got error because of library linking error.So try
As
nvcc test.cu `pkg-config --cflags --libs opencv` -lopencv_gpu
Or
nvcc test.cu -lm -lopencv_core -lopencv_highgui -lopencv_gpu.

gsoap++ linking error

I wrote a soap-client with gsoap++ library. once i compiled this one as a stand-alone test app it was compiled fine, but when i try to compile these classes including in my project i get a lot of linking errors:
../common/UserGausClient/UserGausClient.o: In function `GAUS::SSLInit()':
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/UserGausClient.h:11: undefined reference to `soap_ssl_init'
../common/UserGausClient/soapC.o: In function `soap_faultdetail':
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:117: undefined reference to `soap_malloc'
../common/UserGausClient/soapC.o: In function `soap_getelement':
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:152: undefined reference to `soap_peek_element'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:154: undefined reference to `soap_lookup_type'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:155: undefined reference to `soap_lookup_type'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:215: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:219: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:223: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:227: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:231: undefined reference to `soap_match_tag'
../common/UserGausClient/soapC.o:/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:235: more undefined references to `soap_match_tag' follow
../common/UserGausClient/soapC.o: In function `soap_ignore_element(soap*)':
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:333: undefined reference to `soap_peek_element'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:337: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:354: undefined reference to `soap_element_end_in'
../common/UserGausClient/soapC.o: In function `soap_class_id_enter(soap*, char const*, void*, int, unsigned int, char const*, char const*)':
and so on. In Codeblocks it linking fined... Here is my Makefile:
CC=g++
RM=rm
CFLAGS=-c -g -Wall -DWITH_OPENSSL
LDFLAGS=-lpcrecpp -lpq -lcryptopp -lprotobuf -lrt -lgsoapssl++ -lssl -lcrypto -L/usr/lib/ -L/usr/local/lib/ -lgsoap
SOURCES=../common/PgConnectionManager.cpp \
../common/RSADecryptor.cpp \
../common/RSAEncryptor.cpp \
../common/RSAKeyGenerator.cpp \
../common/RSAKeyLoaderBase.cpp \
../common/RSAManager.cpp \
../common/TcpServer.cpp \
../common/UserGausClient/UserGausClient.cpp \
../common/UserGausClient/soapC.cpp \
../common/UserGausClient/soapuserBindingProxy.cpp \
../proto/BalanceHistory.pb.cc \
../proto/Bio.pb.cc \
../proto/ClientRegistration.pb.cc \
../proto/EmployeePermissions.pb.cc \
../proto/OperatorAuthentication.pb.cc \
../proto/Passport.pb.cc \
../proto/Ping.pb.cc \
../proto/SearchForBill.pb.cc \
../proto/UpdateClientData.pb.cc \
RequestDispatcher.cpp \
SQLStorage.cpp \
SessionManager.cpp \
main.cpp \
OBJECTS_SEARCHER=$(SOURCES:.cpp=.o)
OBJECTS=$(OBJECTS_SEARCHER:.cc=.o)
SEARCHER=registrator
INCLUDE=-I ../
all: $(SEARCHER)
$(SEARCHER): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $#
clean:
$(RM) -f $(OBJECTS)
.cpp.o:
$(CC) $(CFLAGS) $(INCLUDE) $< -o $#
I linked against all necessary libraries (-lgsoapssl++ -lssl -lcrypto) and I checked out requesting functions in these ones:
$ nm /usr/lib/libgsoapssl++.a | grep soap_begin_count
00018da0 T soap_begin_count
and there are in libraries. so, what a problem?
I believe you have to compile one of gSoap's stdsoap2.* files in your make. The generated soapC file depends on the core gSoap code.
One possible reason for this is the order that the libraries are specified to the linker, some linkers require that the libarary containing the definition of a function appears after the object or library that requires it. Try re-arranging the library definitions so that this is the case here and check your linkers documentaion to see if it requires this.
'stdsoap2.cpp' needs to be from the gsoap source directory.
PATH_TO_GSOAP_BUILD/gsoap-2.8/gsoap/stdsoap2.cpp (assuming gsoap-2.8)

Resources