I'm trying to compile ICU sqlite extension.
System: Ubuntu 19.04
src: sqlite-src-3310100.zip
action history:
unzip sqlte-src-3310100.zip
mkdir bld
cd bld
CFLAGS="-O3" ../sqlte-src-3310100/configure && make -j8
# compilation successfull without errors except some warnings
gcc --shared -fPIC -O3 -licui18n -licudata -licuuc -I ./ -I ../src/ext/icu/ -o libSqliteIcu.so ../src/ext/icu/icu.c
# there is no errors
sudo cp libSqliteIcu.so /usr/lib/
Trying to load:
import sqlite3
conn = sqlite3.connect("database.sqlite") # или :memory: чтобы сохранить в RAM
cur = conn.cursor()
conn.enable_load_extension(True)
conn.load_extension('libSqliteIcu')
Error appears:
------------------------------------------------------
OperationalError Traceback (most recent call last)
<ipython-input-67-d5ebe36b8718> in <module>
3 cur = conn.cursor()
4 conn.enable_load_extension(True)
----> 5 conn.load_extension('libSqliteIcu')
OperationalError: /lib/libSqliteIcu.so: undefined symbol: uregex_setText_64
Please help.
Problem solved.
Solution:
gcc --shared -fPIC -O3 -o libSqliteIcu.so ../src/ext/icu/icu.c -licui18n -licuuc -licudata -L/usr/local/lib
Details:
pkg-config --libs icu-i18n
returns:
-licui18n -licuuc -licudata -L/usr/local/lib
Related
I have been following the guide at https://www.tensorflow.org/lite/guide/build_arm in an attempt to compile TfLite for a Nvidia Jetson Nano. Following the instructions for the c++ install, I've installed Bazel and proceeded to build, only to get the following error:
ERROR: /home/user/tensorflow/tensorflow_src/tensorflow/lite/kernels/internal/BUILD:857:11: Compiling tensorflow/lite/kernels/internal/mfcc.cc failed: (Exit 2): aarch64-linux-gnu-gcc failed: error executing command
(cd /home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/execroot/org_tensorflow && \
exec env - \
PATH=/home/user/.cache/bazelisk/downloads/bazelbuild/bazel-5.3.0-linux-arm64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
PWD=/proc/self/cwd \
TF2_BEHAVIOR=1 \
/home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/bin/aarch64-linux-gnu-gcc -fstack-protector -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections -isystem /home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/lib/gcc/aarch64-linux-gnu/8.3.0/include -isystem /home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/lib/gcc/aarch64-linux-gnu/8.3.0/include-fixed -isystem /home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/aarch64-linux-gnu/include/c++/8.3.0/ -isystem /home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/aarch64-linux-gnu/libc/usr/include/ -isystem /usr/include/python3.5 -isystem /usr/include/ -MD -MF bazel-out/aarch64-opt/bin/tensorflow/lite/kernels/internal/_objs/audio_utils/mfcc.pic.d '-frandom-seed=bazel-out/aarch64-opt/bin/tensorflow/lite/kernels/internal/_objs/audio_utils/mfcc.pic.o' -fPIC -iquote . -iquote bazel-out/aarch64-opt/bin -iquote external/fft2d -iquote bazel-out/aarch64-opt/bin/external/fft2d -Wno-all -Wno-extra -Wno-deprecated -Wno-deprecated-declarations -Wno-ignored-attributes -Wno-unknown-warning -Wno-array-parameter -Wno-stringop-overflow -Wno-array-bounds -Wunused-result '-Werror=unused-result' -DAUTOLOAD_DYNAMIC_KERNELS '-std=c++17' -DFARMHASH_NO_CXX_STRING -Wno-sign-compare -O3 -fno-exceptions -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -no-canonical-prefixes -fno-canonical-system-headers -c tensorflow/lite/kernels/internal/mfcc.cc -o bazel-out/aarch64-opt/bin/tensorflow/lite/kernels/internal/_objs/audio_utils/mfcc.pic.o)
# Configuration: ab27fd0d011bfd59c6f8c4ad9e07f710413fd94d9d706bfa323f3377eb0d533e
# Execution platform: #local_execution_config_platform//:platform
/home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/bin/aarch64-linux-gnu-gcc: 1: /home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/bin/aarch64-linux-gnu-gcc: Syntax error: "(" unexpected
Checking the file where it exploded, this seems to be the line in question
# Audio support classes imported directly from TensorFlow.
cc_library(
name = "audio_utils",
srcs = [
"mfcc.cc",
"mfcc_dct.cc",
"mfcc_mel_filterbank.cc",
"spectrogram.cc",
],
hdrs = [
"mfcc.h",
"mfcc_dct.h",
"mfcc_mel_filterbank.h",
"spectrogram.h",
],
compatible_with = get_compatible_with_portable(),
copts = tflite_copts(),
deps = [
"//third_party/fft2d:fft2d_headers",
"#fft2d",
],
)
But I have no idea why it would have an issue here in particular.
This is an otherwise clean OS install. Any idea what might be causing this?
I am trying to cross compile espeak-ng for target=arm-linux-gnueabihf
The sudo make install step gives the following error :
~:~/Downloads/Dependencies/espeak-ng-master$ sudo make install
[sudo] password for abc:
ESPEAK_DATA_PATH=../Downloads/Dependencies/espeak-ng-master src/espeak-ng --compile-intonations && \
ESPEAK_DATA_PATH=../Downloads/Dependencies/espeak-ng-master src/espeak-ng --compile-phonemes && \
touch phsource/phonemes.stamp
src/espeak-ng: line 117: ../Downloads/Dependencies/espeak-ng-master/src/.libs/espeak-ng: cannot execute binary file: Exec format error
src/espeak-ng: line 117: ../Downloads/Dependencies/espeak-ng-master/src/.libs/espeak-ng: Success
Makefile:2590: recipe for target 'phsource/phonemes.stamp' failed
make: *** [phsource/phonemes.stamp] Error 126
I have cross compiled using the following :
./configure CC=arm-linux-gnueabihf-gcc -prefix /opt/myproject-sysroot/usr --build=$MACHTYPE --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
make -B src/speak-ng src/espeak-ng
Configure output
Configuration for eSpeak NG complete.
Source code location: .
C99 Compiler: arm-linux-gnueabihf-gcc
C99 Compiler flags: -Wunused-parameter -Wunused -Wuninitialized -Wreturn-type -Wmissing-prototypes -Wimplicit -g -O2 -std=c99
Sonic: no
PCAudioLib: no
gradle (Android): gradle
ndk-build (Android):
Klatt: yes
MBROLA: yes
Async: yes
Extended Dictionaries:
Russian: no
Chinese (Mandarin): no
Chinese (Cantonese): no
~/Downloads/Dependencies/ESPEAK/espeak-ng-master$ sudo make -B src/speak-ng src/espeak-ng
Output for make command:
---------------
-----------
CC src/libespeak-ng/src_libespeak_ng_la-tr_languages.lo
CC src/libespeak-ng/src_libespeak_ng_la-voices.lo
CC src/libespeak-ng/src_libespeak_ng_la-wavegen.lo
src/libespeak-ng/wavegen.c: In function ‘WavegenFill’:
src/libespeak-ng/wavegen.c:1400:17: warning: variable ‘p_start’ set but not used [-Wunused-but-set-variable]
unsigned char *p_start;
^~~~~~~
CC src/libespeak-ng/src_libespeak_ng_la-klatt.lo
CC src/libespeak-ng/src_libespeak_ng_la-mbrowrap.lo
CC src/libespeak-ng/src_libespeak_ng_la-espeak_command.lo
CC src/libespeak-ng/src_libespeak_ng_la-event.lo
CC src/libespeak-ng/src_libespeak_ng_la-fifo.lo
CCLD src/libespeak-ng.la
arm-linux-gnueabihf-ar: `u' modifier ignored since `D' is the default (see `U')
CCLD src/speak-ng
CC src/espeak-ng.o
src/espeak-ng.c: In function ‘main’:
src/espeak-ng.c:744:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
fread(p_text, 1, filesize, f_text);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CCLD src/espeak-ng
Make install output
~/Downloads/Dependencies/ESPEAK/espeak-ng-master$ sudo make LIBDIR=/opt/myproject-sysroot/usr install
ESPEAK_DATA_PATH=../Downloads/Dependencies/ESPEAK/espeak-ng-master src/espeak-ng --compile-intonations && \
ESPEAK_DATA_PATH=../Downloads/Dependencies/ESPEAK/espeak-ng-master src/espeak-ng --compile-phonemes && \
touch phsource/phonemes.stamp
src/espeak-ng: line 117: ../Downloads/Dependencies/ESPEAK/espeak-ng-master/src/.libs/espeak-ng: cannot execute binary file: Exec format error
src/espeak-ng: line 117: ../Downloads/Dependencies/ESPEAK/espeak-ng-master/src/.libs/espeak-ng: Success
Makefile:2590: recipe for target 'phsource/phonemes.stamp' failed
make: *** [phsource/phonemes.stamp] Error 126
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.
I use GNU Autotools in order to build/configure my mini application.
Here is my configure.ac:
AC_INIT([Tutorial Program], [1.0])
AM_INIT_AUTOMAKE
AC_PROG_CXX
AC_SUBST([GENERAL_INCD], ["-I../Src"])
AC_SUBST([GENERAL_LIBD], ["-L../../Lib"])
AC_SUBST([SOLCPP_LIBS], ["-lsolcpp -lcfsqp"])
AC_SUBST([FFTWPP_INCD], ["-I../fftw++-1.09"])
AC_SUBST([FFTWPP_LIBS], ["../fftw++-1.09/fftw++.o"])
PKG_CHECK_MODULES([GSL], [gsl])
PKG_CHECK_MODULES([FFTW3], [fftw3])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
And here is my Makefile.am:
bin_PROGRAMS = test1
test1_SOURCES = test1.cpp
test1_CPPFLAGS = $(GENERAL_INCD) $(FFTWPP_INCD) $(GSL_CFLAGS) $(FFTW3_CFLAGS)
test1_LDFLAGS= $(GENERAL_LIBD) $(FFTWPP_LIBS) $(SOLCPP_LIBS) $(GSL_LIBS) $(FFTW3_LIBS)
The problem is when I run ./configure and then make, it tries to do:
g++ -g -O2 -L../../Lib ../fftw++-1.09/fftw++.o -lsolcpp -lcfsqp -lgsl -lgslcblas -lm -lfftw3 -lm -o test1 test1-test1.o
test1-test1.o
Although the correct expected command is the following one:
g++ -O2 test1-test1.o -o test1 -L../../Lib -lsolcpp -lcfsqp ../fftw++-1.09/fftw++.o -lgsl -lgslcblas -lm -lfftw3 -lm
How to change configure.ac and Makefile.am ?
Thank you very much
It appears that you just want ../fftw++-1.09/fftw++.o to come after -lsolcpp -lcfsqp in which case you merely need to list FFTWPP_LIBS after SOLCPP_LIBS:
test1_LDFLAGS = $(GENERAL_LIBD) $(SOLCPP_LIBS) $(FFTWPP_LIBS) $(GSL_LIBS) $(FFTW3_LIBS)
I'm having trouble compiling wmii v3.9.2 on Fedora 15; Here's the interesting part (things break down at the linking stage):
% bmake -de
MAKE all libbio/
MAKE all libfmt/
MAKE all libregexp/
MAKE all libutf/
MAKE all libixp/
MAKE all doc/
MAKE all man/
MAKE all cmd/
MAKE all cmd/wmii/
MAKE all cmd/menu/
LD cmd/wmii9menu.out
/usr/bin/ld: wmii/xext.o: undefined reference to symbol 'XRenderFindVisualFormat'
/usr/bin/ld: note: 'XRenderFindVisualFormat' is defined in DSO /usr/lib64/libXrender.so.1 so try adding it to the linker command line
/usr/lib64/libXrender.so.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
*** Failed target: wmii9menu.out
*** Failed command: ../util/link "cc" "$(pkg-config --libs 2>/dev/null) -g -L../lib -L/usr/lib64 ../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a ../lib/libutf.a -L../lib -L/usr/lib64 ../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a ../lib/libutf.a" wmii9menu.out wmii9menu.o clientutil.o wmii/x11.o wmii/xext.o wmii/geom.o wmii/map.o util.o ../lib/libixp.a $(pkg-config --libs xft xrandr xinerama) -lXext
*** Error code 1
Stop.
bmake: stopped in /srv/redhat/BUILD/wmii+ixp-3.9.2/cmd
*** Failed target: dall
*** Failed command: dirs="libbio libfmt libregexp libutf libixp doc man cmd libwmii_hack rc alternative_wmiircs"; set -e; targ=dall; targ=${targ#d}; for i in $dirs; do export WMII_HGVERSION=""; export BASE=$i/; if [ ! -d $i ]; then echo Skipping nonexistent directory: $i 1>&2; else echo MAKE $targ $BASE; (cd $i && bmake $targ) || exit ; fi; done
*** Error code 1
Stop.
bmake: stopped in /srv/redhat/BUILD/wmii+ixp-3.9.2
Finally, in config.mk, I have the following settings:
...
INCLUDES = -I. -I$(ROOT)/include -I$(INCLUDE) -I/usr/include
LIBS = -L$(ROOT)/lib -L/usr/lib64
...
LDFLAGS += -g $(LIBS)
SOLDFLAGS += $(LDFLAGS)
SHARED = -shared -Wl,-soname=$(SONAME)
STATIC = -static
...
With a little more manual resolution, the statement generating the error is essentially as follows:
gcc \
-o wmii9menu.out\
-L../lib -L/usr/lib $(pkg-config --libs xft xrandr xinerama xext)\
../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a\
../lib/libutf.a ../lib/libixp.a\
wmii9menu.o clientutil.o util.o\
wmii/x11.o wmii/xext.o wmii/geom.o wmii/map.o
Here, the pkg-config resolves to the following, which by itself is perfectly correct:
-lXft -lXrandr -lXinerama -lXext
And the solution is as follows:
--- wmii+ixp-3.9.2/config.mk 2011-06-03 14:03:22.950163074 +1000
+++ wmii+ixp-3.9.2/config.mk 2011-06-03 14:03:16.086129011 +1000
## -32 +32 ##
-X11PACKAGES = xft
+X11PACKAGES = xft xext xrandr xrender xinerama