gsoap++ linking error - linux

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)

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.

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

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

Creating CMake executables using multiple libraries

I have succeeded in creating static libraries from my source files using CMake. Now I need to create quite a few executables using these libraries. I have read the CMake examples and attempted to duplicate what they had listed but did not seem to work. I am receiving the error:
Linking CXX executable ../../build/bin/discoveryService
armv5l-timesys-linux-uclibcgnueabi-g++: CMakeFiles/discoveryService.dir/discoveryService.cpp.o: linker input file unused because linking not done
Here is a quick overview of my directory structure. Each directory creates a static library from the source files included in that directory. Most directories also need to generate executables which rely on libraries within the 633/arm directory:
Here is my original Makefile:
$(shell ../../build_environment.sh)
BIN = ../../build/bin
TMP = build
BUILD_DEF = -DBUILD=$(BUILD_VERSION) -DBUILD_DATE=$(BUILD_DATE)
# these files are captured from the DSPLink Sample build directory (and the named changed)
# they contain the appropriate includes and flags to build a dsplink application.
DSPLINK_INCLUDES = $(shell cat ../dsplink_config/dsplink_includes.txt)
DSPLINK_FLAGS = $(shell cat ../dsplink_config/dsplink_flags.txt)
DSPLINK_DEFINES = $(shell cat ../dsplink_config/dsplink_defines.txt)
DSPLINK_LIBS = $(DSPLINK_PACKAGE_DIR)/dsplink/gpp/export/BIN/Linux/OMAPL1XX/RELEASE/dsplink.lib
#Our project variables
INCLUDE= -I. -I../framework -I../flagDictionary -I../logging -I../../dsp/include - I../modbus -I../expat
TOOLCHAIN = /OMAP-L137/timesys/SDK/omapl137_evm/toolchain/bin
#TOOLCHAIN = ${FACTORY_DIR}/build_armv5l-timesys-linux-uclibcgnueabi/toolchain/bin
PLATFORM=armv5l-timesys-linux-uclibcgnueabi
#Compile Options
CC=$(TOOLCHAIN)/$(PLATFORM)-g++
LINKER=$(TOOLCHAIN)/$(PLATFORM)-g++
CFLAGS+=$(BUILD_DEF) $(INCLUDE)
DEBUG =
#list of things to compile.
FW_BUILD_DIR=../framework/build
LOG_BUILD_DIR=../logging/build
XML_BUILD_DIR=../expat/build
MODBUS_BUILD_DIR=../modbus/build
FLAG_DICT_BUILD_DIR=../flagDictionary/build
CORE_FRAMEWORK_OBJECTS= $(FW_BUILD_DIR)/application.o \
$(FW_BUILD_DIR)/arguments.o \
$(FW_BUILD_DIR)/com.o \
$(FW_BUILD_DIR)/memoryManagerBase.o \
$(FW_BUILD_DIR)/memoryManager.o \
$(FW_BUILD_DIR)/lockManager.o \
$(FW_BUILD_DIR)/stopWatch.o \
$(FW_BUILD_DIR)/controlCom.o \
$(FW_BUILD_DIR)/status.o \
$(FW_BUILD_DIR)/paths.o \
$(LOG_BUILD_DIR)/subsystemLogMasks.o \
$(LOG_BUILD_DIR)/logger.o
# removed utils.o from CORE
NET_FRAMEWORK_OBJECTS= $(FW_BUILD_DIR)/message.o \
$(FW_BUILD_DIR)/chunk.o \
$(FW_BUILD_DIR)/multicastSocket.o \
$(FW_BUILD_DIR)/serverSocket.o \
$(FW_BUILD_DIR)/socket.o \
$(FW_BUILD_DIR)/tcpReader.o
CONF_FRAMEWORK_OBJECTS= $(FW_BUILD_DIR)/configuration.o \
$(FW_BUILD_DIR)/editConfig.o \
$(FW_BUILD_DIR)/parseConfig.o \
$(FW_BUILD_DIR)/xpath.o \
$(XML_BUILD_DIR)/xmlparse.o \
$(XML_BUILD_DIR)/xmlrole.o \
$(XML_BUILD_DIR)/xmltok.o
MODBUS_OBJECTS= $(MODBUS_BUILD_DIR)/modbus.o \
$(MODBUS_BUILD_DIR)/modbusFacade.o
MODBUS_RTU_OBJECTS= $(MODBUS_BUILD_DIR)/modbus.o \
$(MODBUS_BUILD_DIR)/rtuFacade.o
FLAG_DICT_OBJECTS= $(FLAG_DICT_BUILD_DIR)/flagEntry.o \
$(FLAG_DICT_BUILD_DIR)/flagDictionary.o
OBJECTS = discoveryService.o \
httpService.o \
modbusService.o \
streamingService.o \
trendMap.o \
trendService.o \
tripBuffer.o \
modbusRTUService.o \
tripReader.o
EXES = discoveryService httpService modbusService streamingService trendService tripReader modbusRTUService cmprXfr
all: $(OBJECTS) $(EXES)
.c.o:
mkdir -p build
$(CC) -c $(CFLAGS) $(DSPLINK_INCLUDES) $(DSPLINK_FLAGS) $(DSPLINK_DEFINES) $(DEBUG) -o $(TMP)/$# $<
.cpp.o:
mkdir -p build
$(CC) -c $(CFLAGS) $(DSPLINK_INCLUDES) $(DSPLINK_FLAGS) $(DSPLINK_DEFINES) $(DEBUG) -o $(TMP)/$# $<
discoveryService: $(FRAMEWORK_OBJECTS) discoveryService.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/discoveryService.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS) $(NET_FRAMEWORK_OBJECTS) $(CONF_FRAMEWORK_OBJECTS)
httpService: $(FRAMEWORK_OBJECTS) httpService.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/httpService.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS)
modbusService: $(FRAMEWORK_OBJECTS) modbusService.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/modbusService.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS) $(MODBUS_OBJECTS) $(NET_FRAMEWORK_OBJECTS)
modbusRTUService: $(FRAMEWORK_OBJECTS) modbusRTUService.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/modbusRTUService.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS) $(MODBUS_RTU_OBJECTS)
cmprXfr: $(FRAMEWORK_OBJECTS) cmprXfr.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/cmprXfr.o $(CORE_FRAMEWORK_OBJECTS) $(NET_FRAMEWORK_OBJECTS) $(MODBUS_OBJECTS) $(FLAG_DICT_OBJECTS)
streamingService: $(FRAMEWORK_OBJECTS) streamingService.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/streamingService.o build/tripBuffer.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS) $(NET_FRAMEWORK_OBJECTS) $(CONF_FRAMEWORK_OBJECTS)
trendService: $(FRAMEWORK_OBJECTS) trendService.o trendMap.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/trendService.o build/trendMap.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS) $(NET_FRAMEWORK_OBJECTS) $(CONF_FRAMEWORK_OBJECTS)
tripReader: $(FRAMEWORK_OBJECTS) tripReader.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/tripReader.o build/tripBuffer.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS) $(NET_FRAMEWORK_OBJECTS) $(CONF_FRAMEWORK_OBJECTS)
USBstreamingService: $(FRAMEWORK_OBJECTS) USBstreamingService.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/USBstreamingService.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS)
Here is my top-level CMakeList.txt
INCLUDE(CMakeForceCompiler)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(633.CMake)
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR arm)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
SET(FACTORY_CURRENT /home/projects/OMAP-L137/timesys/factory-current)
SET(DSPLINK_PATH ${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink- 1_65_01/DSPLink-1_65_01)
SET(DSPLINK_PACKAGE_DIR ${FACTORY_CURRENT}/${DSPLINK_PATH})
SET(TOOLCHAIN_LOC ${FACTORY_CURRENT}/build_armv5l-timesys-linux- uclibcgnueabi/toolchain/bin)
#read file into variable 'defines'
file(READ ${CMAKE_SOURCE_DIR}/arm/dsplink_config/dsplink_defines.txt defines)
#turn space separation into CMake list
string(REPLACE " " ";" defines "${defines}")
ADD_DEFINITIONS(${defines})
# specify the cross compiler
SET(CMAKE_C_COMPILER ${TOOLCHAIN_LOC}/armv5l-timesys-linux-uclibcgnueabi-g++)
SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_LOC}/armv5l-timesys-linux-uclibcgnueabi-g++)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -c")
SET(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /home/projects/OMAP-L137/timesys/factory-current)
SET(PROJECT_SOURCE_DIR /home/chrisk/633/)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/bin)
ADD_SUBDIRECTORY(arm)
And here is my CMakeList.txt in the directory 633/arm/communications where my source files are located.
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/arm/framework ${CMAKE_SOURCE_DIR}/arm/flagDictionary ${CMAKE_SOURCE_DIR}/arm/logging ${CMAKE_SOURCE_DIR}/dsp/include ${CMAKE_SOURCE_DIR}/arm/modbus ${CMAKE_SOURCE_DIR}/arm/expat)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux- uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/usr)
INCLUDE_DIRECTORIES(/home/projects/OMAP-L137/timesys/factory-20120925-633/build_armv5l- timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/usr)
INCLUDE_DIRECTORIES(/home/projects/OMAP-L137/timesys/factory-20120925-633/build_armv5l- timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/sys/Linux)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/usr)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/sys/Linux)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/sys/Linux/2.6.18)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/src/samples/loop)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/src/samples/loop/Linux)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/src/samples/loop/Linux/2.6.18)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/BUILD/INCLUDE/USER)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink- 1_65_01/dsplink/gpp/export/INCLUDE/Linux/OMAPL1XX/internal)
INCLUDE_DIRECTORIES(${FACTORY_DIR}/build_armv5l-timesys-linux-uclibcgnueabi/toolchain/include)
TARGET_LINK_LIBRARIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink- 1_65_01/dsplink/gpp/export/BIN/Linux/OMAPL1XX/RELEASE/dsplink.lib)
SET(communications_SOURCES
discoveryService.cpp
httpService.cpp
modbusRTUService.cpp
modbusService.cpp
streamingService.cpp
trendMap.cpp
trendService.cpp
tripBuffer.cpp
tripReader.cpp
)
ADD_LIBRARY(communications ${communications_SOURCES})
TARGET_LINK_LIBRARIES(${CMAKE_SOURCE_DIR}/arm/flagDictionary/libflagDictionary.a)
TARGET_LINK_LIBRARIES(${CMAKE_SOURCE_DIR}/arm/framework/libframework.a)
TARGET_LINK_LIBRARIES(${CMAKE_SOURCE_DIR}/arm/communications/libcommunications.a)
TARGET_LINK_LIBRARIES(${DSPLINK_PACKAGE_DIR}/dsplink/gpp/export/BIN/Linux/OMAPL1XX/RELEASE/dsplink.lib)
ADD_EXECUTABLE(discoveryService discoveryService.cpp)
I used the ADD_EXECUTABLE as shown in the CMake Tutorial and tried using TARGET_LINK_LIBRARIES to link the libraries. Any help is appreciated.

Errors in make file : *** missing separator. Stop

I am facing errors in make file in CentOS 6.02 64 bit. I need to know what should be done to make the makefile workable. Any suggestion will be greatly helpful. My make file is pasted below: -
#
.SUFFIXES: .cc $(.SUFFIXES)
ALL = libpal.a
#all = $(ALL)
all: $(ALL)
.cpp.o:
$(C++) -o $# -c $(PROF) $(CFLAGS) $*.cpp
.cc.o:
$(C++) -o $# -c $(PROF) $(CFLAGS) $*.cc
.c.o:
$(CC) -o $# -c $(PROF) $(CFLAGS) $*.c
top_srcdir = ..
OPENSSL_LIB_DIR = ../../ThirdPartyLibs/openssl-0.9.8e/include
BOOST_DIR = ../../ThirdPartyLibs/boost/stage/lib
BOOST_INCLUDE_DIR = ../../ThirdPartyLibs/boost
CC = gcc
C++ = g++
CCOPT = -Os -Wall -Wno-deprecated
CCOPT_DEBUG = -Wall -g -Wno-deprecated
PROF =
STATIC = -static
INCLUDE = \
-I./usr/include/sys
-I./Headers \
-I$(top_srcdir)/PAL/Headers \
-I$(top_srcdir)/BaseMulti/Headers \
-I$(top_srcdir)/NetworkMulti/Headers \
-I$(top_srcdir)/RTP/Headers \
-I$(BOOST_INCLUDE_DIR) \
-I$(OPENSSL_LIB_DIR) \
LIBDIRS = \
-L$(BOOST_DIR) \
#XXX NLAYER define / MB_DEBUG
DEFINE = -D_LINUX -DDEBUGLOG -D_INDENT_DB_PRINT -fsigned-char -fno-inline -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_POSIX_PER_PROCESS_TIMER_SOURCE -D_PTHREADS -DUNICODE #-DDISABLE_LOG
SHLIB_SUFFIX = .so
SHLIB_LD = gcc -shared
SHLIB_LD_LIBS =
SHLIB_CFLAGS = -fPIC
BFLAGS = $(DEFINE) $(INCLUDE)
CFLAGS = $(CCOPT) $(BFLAGS)
OBJ_C =
OBJ_CC = \
./Sources/PALsystime.o \
./Sources/PALdebug.o \
./Sources/PALdebuglog.o \
./Sources/PALthread.o \
./Sources/PALcritsec.o \
./Sources/PALprofiler.o \
./Sources/PALserializable.o \
./Sources/PALinet.o \
./Sources/PALnetwork.o \
./Sources/PALsocket.o \
./Sources/PALlocalhostUdpEvent.o \
./Sources/PALpollarray.o \
./Sources/PALrandom.o \
OBJS = $(OBJ_C) $(OBJ_CC)
SRCS = $(OBJ_C:.o=.c) $(OBJ_CC:.o=.cc)
debug: DEFINE += -DDEBUG
debug: BFLAGS = $(DEFINE) $(INCLUDE)
debug: CFLAGS = $(CCOPT_DEBUG) $(BFLAGS)
debug: $(OBJS)
ar crsu libpal_debug.a $(OBJS)
libpal.a: $(OBJS)
ar crsu libpal.a $(OBJS)
cleandeps:
$(RM) ./Sources/*.o .depend* core
clean: cleandeps
$(RM) ./libpal.a ./libpal_debug.a
$(RM) $(ALL)
And the resultant error is:
Makefile:34: *** missing separator. Stop.
You can find an explanation of this error in Appendix B Errors Generated by Make.
Every line in a recipe must begin with a tab character. The recipes starting with $(C++) and $(CC) near the top of your file do not seem to start with a tab character.
Additionally, the section
INCLUDE = \
-I./usr/include/sys
-I./Headers \
seems to be missing a backslash after sys and that same section (and many more) have superfluous empty lines.
Open your make file in vim rather than in editors like gedit. Every line in a recipe must begin with a tab character.
This answer is for other Make newbies such as myself who find this question from Googling and get stuck because they are modifying a large pre-existing Makefile, with no lines beginning with a space character. My problem occurred because a makefile in a subdirectory with spaces instead of tabs was getting called by a parent makefile, where I erroneously thought the problem existed.
Once I fixed the makefile in the subdirectory, everything worked like a charm.

Embedded Linux. Symbol lookup error

I made userdef.c for adding some function otsu_Threshold and onBinarOtzu.
The function library header file is pxa_lib.h and I typed function like this
void otzu_Threshold(unsigned char* orgImg, unsigned char* outImg, int height, int width);
void onBinarOtzu(unsigned char* m_InImg);
In camera.c that is in Folder 'demo', I typed
'#include < pxa_lib.h >
....
....
onBinarOtzu(vidbuf->ycbcr.y);
MakeFile
CC=/usr/local/arm-linux-4.1.1/bin/arm-linux-gcc
CFLAGS+= -mcpu=iwmmxt -mtune=iwmmxt -mabi=aapcs-linux \
-Iinclude/ -DDEBUG_BUILD
LFLAGS+=-Llib/ -lpxadev
.PHONY: all compile install-host install-target clean clean-local \
uninstall-host uninstall-target
all: compile install-host install-target
compile: lib/libpxadev.so bin/camera
lib/libpxadev.so: driver/camera.o driver/overlay2.o driver/userdef.o
$(CC) $(CFLAGS) -shared -W1,-soname,libpxadev.so -o lib/libpxadev.so $^
bin/camera: demo/camera.c
$(CC) $(CFLAGS) $(LFLAGS) -o $# $^
install-host:
install-target:
clean: clean-local uninstall-host uninstall-target
clean-local:
-rm -f lib/* driver/*.o
-rm -f bin/*
uninstall-host:
-rm -f $(PXA_HOST_LIB_DIR)/libpxadev.so
uninstall-target:
$(SUDO) rm -f $(PXA_TARGET_BIN_DIR)/camera
$(SUDO) rm -f $(PXA_TARGET_LIB_DIR)/libpxadev.so
I made binary file and transmitted in robot by minicom,zmodem.
But, error had occured.
[root#WENDERS root]# [root#WENDERS root]# ./camera
PXA_CAMERA:choose MT.... sensor
PXA_CAMERA:choose MT.... sensor
camera_config : streamparm.type = 1
count = 3
width=320, height=240
./camera: symbol lookup error: ./camera: undefined symbol: onBinarOtzu
What sould I do...
ps. I'm sorry. I can't English well...
It looks like you linked to shared libraries while compiling, but they aren't loaded on the target.
You'll have to add the libraries somewhere Linux can find them, perhaps in /usr/lib or /lib, or somewhere specified by the $LD_LIBRARY_PATH variable. Exactly how you do this is dependent on the environment you have set up.

Resources