how can i link -ldl from Makefile? - c++

I am trying to build the amanda program on ubuntu.
I'm faced with the following error from makefile:
libtool: link: ( cd ".libs" && rm -f "libamserver.la" && ln -s "../libamserver.la" "libamserver.la" )
/bin/bash ../libtool --tag=CC --mode=link gcc -Wall -Wextra -Wparentheses -Wdeclaration-after-statement -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wformat -Wformat-security -Wsign-compare -Wfloat-equal -Wold-style-definition -Wno-strict-aliasing -Wno-unknown-pragmas -Wno-deprecated-declarations -DAMANDA_FILE=\"`basename amindexd.o`\" -g -O2 -fno-strict-aliasing -o amindexd amindexd.o disk_history.o list_dir.o ../common-src/libamanda.la libamserver.la ../device-src/libamdevice.la ../common-src/libamanda.la ../amandad-src/libamandad.la -lm -Wl,--export-dynamic -lgmodule-2.0 -pthread -lgobject-2.0 -lgthread-2.0 -pthread -lglib-2.0 -lnsl -lresolv
libtool: link: gcc -Wall -Wextra -Wparentheses -Wdeclaration-after-statement -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wformat -Wformat-security -Wsign-compare -Wfloat-equal -Wold-style-definition -Wno-strict-aliasing -Wno-unknown-pragmas -Wno-deprecated-declarations -DAMANDA_FILE=\"amindexd.o\" -g -O2 -fno-strict-aliasing -o .libs/amindexd amindexd.o disk_history.o list_dir.o -Wl,--export-dynamic -pthread -pthread ./.libs/libamserver.so /src/amanda-3.3.1/device-src/.libs/libamdevice.so ../device-src/.libs/libamdevice.so /src/amanda-3.3.1/xfer-src/.libs/libamxfer.so /src/amanda-3.3.1/ndmp-src/.libs/libndmlib.so ../common-src/.libs/libamanda.so ../amandad-src/.libs/libamandad.so /src/amanda-3.3.1/common-src/.libs/libamanda.so -lm -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lnsl -lresolv -pthread -Wl,-rpath -Wl,/usr/local/lib/amanda
/usr/bin/ld: /src/amanda-3.3.1/device-src/.libs/libamdevice.so: undefined reference to `dlopen'
/usr/bin/ld: /src/amanda-3.3.1/device-src/.libs/libamdevice.so: undefined reference to `dlerror'
/usr/bin/ld: /src/amanda-3.3.1/device-src/.libs/libamdevice.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
From the error message it seems that libtool is not able to link to ldl.
So I manually added "-ldl" to the provided Makefile.
LIBS = -lm -Wl,--export-dynamic -lgmodule-2.0 -pthread -lgobject-2.0 -lgthread-2.0 -pthread -lglib-2.0 -lnsl -lresolv -ldl
However, Makefile keeps making the exact same error whenever I try to build.
Can anyone suggest a solution?
Thanks.

Related

undefined reference to `__cudaPopCallConfiguration'

I am trying to compile a cuda code that I have received from Github (https://github.com/exafmm/exafmm-alpha).
The Makefile.include contains:
.SUFFIXES: .cxx .cu .f90 .o
.PHONY: docs
CUDA_INSTALL_PATH = /usr/local/cuda
#DEVICE = cpu
DEVICE = gpu
CXX = mpicxx -g -O3 -lstdc++ -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include
NVCC = nvcc -Xcompiler "-fopenmp -O3" -lstdc++ -use_fast_math -I../include
FC = mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include
FCC = mpif90 -c -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include
LFLAGS = -D$(DEVICE) -lstdc++ -ldl -lm
LFLAGS += -lmpi_cxx
LFLAGS += -lpthread
ifeq ($(DEVICE),gpu)
LFLAGS += -lcudart
endif
OBJECT = ../kernel/$(DEVICE)Laplace.o ../kernel/$(DEVICE)BiotSavart.o\
../kernel/$(DEVICE)Stretching.o ../kernel/$(DEVICE)Gaussian.o\
../kernel/$(DEVICE)CoulombVdW.o
.cxx.o:
$(CXX) -c $? -o $# $(LFLAGS)
.cu.o:
$(NVCC) -c $? -o $# $(LFLAGS)
.f90.o:
$(FC) -c $? -o $#
And the Makefile is:
include ../Makefile.include
lib_parallel_ij: parallel_wrapper_ij.o $(OBJECT)
ar -cr libfmm.a parallel_wrapper_ij.o $(OBJECT)
ranlib libfmm.a
test_parallel_ij: test_parallel_ij.o
make lib_parallel_ij
$(FC) $? -L. -lfmm $(LFLAGS)
mpirun -np 2 ./a.out
When I tried to compile the code, I get the following errors.
mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include -c test_parallel_ij.f90 -o test_parallel_ij.o
make lib_parallel_ij
make[1]: Entering directory '/home/bidesh/panelCode/UVLM/NVLM_FMM/solver_single_rotor_try/exafmm-alpha-vortex/wrapper'
mpicxx -g -O3 -lstdc++ -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c parallel_wrapper_ij.cxx -o parallel_wrapper_ij.o -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
nvcc -Xcompiler "-fopenmp -O3" -lstdc++ -use_fast_math -I../include -c ../kernel/gpuLaplace.cu -o ../kernel/gpuLaplace.o -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
nvcc -Xcompiler "-fopenmp -O3" -lstdc++ -use_fast_math -I../include -c ../kernel/gpuBiotSavart.cu -o ../kernel/gpuBiotSavart.o -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
../kernel/gpuBiotSavart.cu(542): warning #177-D: variable "SQRT4PI" was declared but never referenced
../kernel/gpuBiotSavart.cu(548): warning #550-D: variable "r" was set but never used
nvcc -Xcompiler "-fopenmp -O3" -lstdc++ -use_fast_math -I../include -c ../kernel/gpuStretching.cu -o ../kernel/gpuStretching.o -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
nvcc -Xcompiler "-fopenmp -O3" -lstdc++ -use_fast_math -I../include -c ../kernel/gpuGaussian.cu -o ../kernel/gpuGaussian.o -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
nvcc -Xcompiler "-fopenmp -O3" -lstdc++ -use_fast_math -I../include -c ../kernel/gpuCoulombVdW.cu -o ../kernel/gpuCoulombVdW.o -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
ar -cr libfmm.a parallel_wrapper_ij.o ../kernel/gpuLaplace.o ../kernel/gpuBiotSavart.o ../kernel/gpuStretching.o ../kernel/gpuGaussian.o ../kernel/gpuCoulombVdW.o
ranlib libfmm.a
make[1]: Leaving directory '/home/bidesh/panelCode/UVLM/NVLM_FMM/solver_single_rotor_try/exafmm-alpha-vortex/wrapper'
mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include test_parallel_ij.o -L. -lfmm -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
./libfmm.a(gpuLaplace.o): In function `LaplaceL2P_GPU(int*, int*, double*, double*)':
tmpxft_0000397c_00000000-6_gpuLaplace.cudafe1.cpp:(.text+0xc2): undefined reference to `__cudaPopCallConfiguration'
....
./libfmm.a(gpuLaplace.o): In function `Kernel::LaplaceL2P()':
tmpxft_0000397c_00000000-6_gpuLaplace.cudafe1.cpp:(.text+0x3e06): undefined reference to `__cudaPushCallConfiguration'
....
./libfmm.a(gpuCoulombVdW.o): In function `__sti____cudaRegisterAll()':
tmpxft_00003a87_00000000-6_gpuCoulombVdW.cudafe1.cpp:(.text.startup+0x189): undefined reference to `__cudaRegisterFatBinaryEnd'
....
I tried to find the installation of cuda:
whereis cuda
cuda: /usr/lib/cuda /usr/include/cuda.h /usr/local/cuda
I could not fix the error, can anyone give any hint to fix it?
Thank you.

How to rectify `undefined reference to `MPI::Comm::Comm()'` when compiling with Makefile?

I am trying to compile a code by Makefile. I received the code from github. I tried to implement the solution from links:
[https://github.com/LLNL/scr/issues/130][1]
[https://stackoverflow.com/questions/62461718/mpi-complile-error-undefined-reference-to-mpiwinfree][2], etc.
These solutions are not working for me or they are too technical. I am sorry to say as I am not from a programming background, it is difficult for me to understand.
The make file are as follows:
Makefile.include
.SUFFIXES: .cxx .cu .f90 .o
.PHONY: docs
CUDA_INSTALL_PATH = /usr/local/cuda
DEVICE = cpu
#~ DEVICE = gpu
CXX = mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include
NVCC = nvcc -Xcompiler "-fopenmp -O3" -std=c++11 -use_fast_math -I../include
FC = mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include
LFLAGS = -D$(DEVICE) -lstdc++ -ldl -lm
#~ LFLAGS += -lmpi_cxx
ifeq ($(DEVICE),gpu)
LFLAGS += -lcudart
endif
OBJECT = ../kernel/$(DEVICE)Laplace.o ../kernel/$(DEVICE)BiotSavart.o\
../kernel/$(DEVICE)Stretching.o ../kernel/$(DEVICE)Gaussian.o\
../kernel/$(DEVICE)CoulombVdW.o
.cxx.o:
$(CXX) -c $? -o $# $(LFLAGS)
.cu.o:
$(NVCC) -c $? -o $# $(LFLAGS)
.f90.o:
$(FC) -c $? -o $#
and Makefile:
include ../Makefile.include
lib_parallel_ij: parallel_wrapper_ij.o $(OBJECT)
ar -cr libfmm.a parallel_wrapper_ij.o $(OBJECT)
ranlib libfmm.a
test_parallel_ij: test_parallel_ij.o
make lib_parallel_ij
$(FC) $? -L. -lfmm $(LFLAGS)
mpirun -np 2 ./a.out
clean:
make -C .. clean
When I am trying to compile it. It gives me the following errors:
mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include -c test_parallel_ij.f90 -o test_parallel_ij.o
make lib_parallel_ij
make[1]: Entering directory '/home/bidesh/panelCode/UVLM/NVLM_FMM/solver_single_rotor_try/exafmm-alpha-vortex/wrapper'
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c parallel_wrapper_ij.cxx -o parallel_wrapper_ij.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuLaplace.cxx -o ../kernel/cpuLaplace.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuBiotSavart.cxx -o ../kernel/cpuBiotSavart.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuStretching.cxx -o ../kernel/cpuStretching.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuGaussian.cxx -o ../kernel/cpuGaussian.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuCoulombVdW.cxx -o ../kernel/cpuCoulombVdW.o -Dcpu -lstdc++ -ldl -lm
ar -cr libfmm.a parallel_wrapper_ij.o ../kernel/cpuLaplace.o ../kernel/cpuBiotSavart.o ../kernel/cpuStretching.o ../kernel/cpuGaussian.o ../kernel/cpuCoulombVdW.o
ranlib libfmm.a
make[1]: Leaving directory '/home/bidesh/panelCode/UVLM/NVLM_FMM/solver_single_rotor_try/exafmm-alpha-vortex/wrapper'
mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include test_parallel_ij.o -L. -lfmm -Dcpu -lstdc++ -ldl -lm
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool)':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/op_inln.h:121: undefined reference to `ompi_mpi_cxx_op_intercept'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Intracomm::Clone() const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm_inln.h:23: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Graphcomm::Clone() const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Cartcomm::Sub(bool const*) const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Intracomm::Create_graph(int, int const*, int const*, bool) const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Cartcomm::Clone() const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o):/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: more undefined references to `MPI::Comm::Comm()' follow
./libfmm.a(parallel_wrapper_ij.o):(.data.rel.ro._ZTVN3MPI8DatatypeE[_ZTVN3MPI8DatatypeE]+0x78): undefined reference to `MPI::Datatype::Free()'
./libfmm.a(parallel_wrapper_ij.o):(.data.rel.ro._ZTVN3MPI3WinE[_ZTVN3MPI3WinE]+0x48): undefined reference to `MPI::Win::Free()'
collect2: error: ld returned 1 exit status
Makefile:48: recipe for target 'test_parallel_ij' failed
make: *** [test_parallel_ij] Error 1
I am unable to solve the error. I couldn't compile the code. I will be greatly helped if I can get some clue to compile it.
Thanks a lot.
[1]: https://github.com/LLNL/scr/issues/130
[2]: MPI complile error, undefined reference to `MPI::Win::Free()

g++ linker cannot find symbols that are apparently exported

I am trying to compile mod_tile, but it fails after upgrading from Mapnik 2.2 to 3.0 (I checked that only 3.0 versions of the packages exist).
During linking there are now undefined references. The linker command is
g++ -I/usr/include -I/usr/include/mapnik/agg -I/usr/include/mapnik -I/usr/include -I/usr/include/freetype2 -I/usr/include/libxml2 -I/usr/include/gdal -I/usr/include/postgresql -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng16 -DMAPNIK_MEMORY_MAPPED_FILE -DMAPNIK_HAS_DLCFN -DBIGINT -DBOOST_REGEX_HAS_ICU -DHAVE_JPEG -DMAPNIK_USE_PROJ4 -DHAVE_PNG -DHAVE_WEBP -DHAVE_TIFF -DLINUX -DMAPNIK_THREADSAFE -DBOOST_SPIRIT_NO_PREDEFINED_TERMINALS=1 -DBOOST_PHOENIX_NO_PREDEFINED_TERMINALS=1 -DBOOST_SPIRIT_USE_PHOENIX_V3=1 -DNDEBUG -DHAVE_CAIRO -DGRID_RENDERER -DHAVE_LIBXML2 -std=c++11 -g -O2 -fdebug-prefix-map=/build/mapnik-3.0.12+ds=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g0 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -pthread -ftemplate-depth-300 -Wsign-compare -Wshadow -O2 -g -O2 -o .libs/renderd src/daemon.o src/daemon_compat.o src/renderd-gen_tile.o src/sys_utils.o src/request_queue.o src/cache_expire.o src/renderd-metatile.o src/renderd-parameterize_style.o src/protocol_helper.o src/store.o src/store_file.o src/store_file_utils.o src/store_memcached.o src/store_rados.o src/store_ro_http_proxy.o src/store_ro_composite.o src/store_null.o -pthread -Wl,-z -Wl,relro -Wl,-z -Wl,now -g0 -pthread -L/usr/lib -lmapnik -L/usr/lib/x86_64-linux-gnu -lboost_filesystem -lboost_regex -lcairo -lpng /usr/lib/x86_64-linux-gnu/libproj.so /usr/lib/x86_64-linux-gnu/libtiff.so -lwebp -lxml2 -licui18n -lboost_system -lharfbuzz -ljpeg -licuuc /usr/lib/x86_64-linux-gnu/libfreetype.so -lz -ldl /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so -Liniparser3.0b/.libs /home/fheer/src/mod_tile/iniparser3.0b/.libs/libiniparser.so -lm -pthread
The first of the errors is
src/renderd-gen_tile.o: In function `load_fonts(char const*, int)':
mod_tile/src/gen_tile.cpp:175: undefined reference to `mapnik::freetype_engine::register_font(std::string const&)'
libmapnik.so is searched for in /usr/lib, where it exists. nm shows the symbol in question to exist:
$ nm -D /usr/lib/libmapnik.so|grep register_font
0000000000150920 T _ZN6mapnik15freetype_engine13register_fontERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
0000000000150c90 T _ZN6mapnik15freetype_engine14register_fontsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb
000000000014f2c0 T _ZN6mapnik15freetype_engine18register_font_implERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_12font_libraryERSt3mapIS6_St4pairIiS6_ESt4lessIS6_ESaISC_IS7_SD_EEE
00000000001509f0 T _ZN6mapnik15freetype_engine19register_fonts_implERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_12font_libraryERSt3mapIS6_St4pairIiS6_ESt4lessIS6_ESaISC_IS7_SD_EEEb
00000000001abfc0 T _ZN6mapnik3Map14register_fontsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb
I searched for this error, but only found solutions for problems that are not the case here. Maybe I oversee something obvious, any pointers would be appreciated! I just don't see what else I could check for.

cross-compile mc (midnight commander) - error in linking with glib?

I am trying to cross-compile mc for my arm device with arm-linux-gnueabi toolchain.
at the last step of making mc I get many errors like:
make[3]: Entering directory '/home/jacovlev/utils/mc-4.8.14/src'
/bin/sh ../libtool --tag=CC --mode=link arm-linux-gnueabi-gcc -std=gnu99 -Wcomment -Wdeclaration-after-statement -Wfloat-equal -Wformat -Wformat-security -Wimplicit -Wignored-qualifiers -Wmissing-braces -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wno-unreachable-code -Wparentheses -Wpointer-sign -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtype-limits -Wuninitialized -Wunused-but-set-variable -Wunused-function -Wunused-label -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wwrite-strings -I/opt/include -L/opt/lib -L/opt/lib/libncurses.a -o mc main.o libinternal.la ../lib/libmc.la -lrt
libtool: link: arm-linux-gnueabi-gcc -std=gnu99 -Wcomment -Wdeclaration-after-statement -Wfloat-equal -Wformat -Wformat-security -Wimplicit -Wignored-qualifiers -Wmissing-braces -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wno-unreachable-code -Wparentheses -Wpointer-sign -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtype-limits -Wuninitialized -Wunused-but-set-variable -Wunused-function -Wunused-label -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wwrite-strings -I/opt/include -o mc main.o -L/opt/lib -L/opt/lib/libncurses.a ./.libs/libinternal.a ../lib/.libs/libmc.a -lncurses -lrt
main.o: In function `OS_Setup':
main.c:(.text+0xe4): undefined reference to `g_strdup'
main.c:(.text+0xfa): undefined reference to `g_strdup'
main.c:(.text+0x13a): undefined reference to `g_free'
main.c:(.text+0x146): undefined reference to `g_strdup'
...
./.libs/libinternal.a(editoptions.o): In function `edit_options_dialog':
editoptions.c:(.text+0x108): undefined reference to `g_snprintf'
editoptions.c:(.text+0x124): undefined reference to `g_snprintf'
editoptions.c:(.text+0x73a): undefined reference to `g_list_foreach'
editoptions.c:(.text+0x772): undefined reference to `g_free'
editoptions.c:(.text+0x7aa): undefined reference to `g_free'
editoptions.c:(.text+0x820): undefined reference to `g_list_foreach'
collect2: ld returned 1 exit status
Makefile:626: recipe for target 'mc' failed
log above I get with make V=1, so you can trace my parameters.
What exactly can cause this errors? What can I do to try to fix them?
As far as I know this are references to Glib.
I'm already tried to remake glib several times with this toolchain (right now I have compiled static glib), and even edited Makefiles by hand to try different parameters, but this gave me nothing.
If it's required I can attach my configure params.
UPDATE: after adding -lglib flag, as William Jones proposed I have different issue now:
/home/jacovlev/voyager_15/toolchain/trunk/bin/../lib/gcc/arm-linux-gnueabi/4.6.3/../../../../arm-linux-gnueabi/bin/ld: cannot find -lglib

undefined reference to `utf8_nextCharSafeBody_48' icu4c while building a library

I have tried to build the stmd library (http://getassoc.cs.nii.ac.jp/package/stmd-1.1.5.tar.gz) on Ubuntu 12.04.2 amd64 which use the ICU library.
I have installed libicu-dev (version: 48) from Ubuntu repository and using the following configuration.
./configure --with-icu-config=/usr/bin/icu-config --with-defaultstemmer=SNOWBALL --enable-snowball=yes --enable-kill3number=yes
and then,
make
I got the following errors..
/bin/bash ./libtool --mode=link g++ -I. -g -O2 -Wall -Wno-parentheses -Wdeclaration-after- statement -g -O -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 '-DDEFAULT_STEMMER=SNOWBALL' '-DSTMD_MYSTEMMER_DIR="/usr/local/bin"' -g -Wall -O2 -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long -D_REENTRANT -I/usr/include '-DUSE_SNOWBALL=1' -I/usr/local/include -DKILL3NUMBER=1 -L/usr/lib -ldl -lm -L/usr/lib -licui18n -licuuc -licudata -ldl -lm -L/usr/local/lib -o stmd stmd.o stmc.o sigflg.o nio.o -L. -L/usr/lib -ldl -lm -L/usr/lib -licui18n -licuuc -licudata -ldl -lm -L/usr/local/lib -lystem -lstemmer -lexpat -ldl
libtool: link: g++ -I. -g -O2 -Wall -Wno-parentheses -Wdeclaration-after-statement -g -O -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -DDEFAULT_STEMMER=SNOWBALL -DSTMD_MYSTEMMER_DIR=\"/usr/local/bin\" -g -Wall -O2 -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long -D_REENTRANT -I/usr/include -DUSE_SNOWBALL=1 -I/usr/local/include -DKILL3NUMBER=1 -o stmd stmd.o stmc.o sigflg.o nio.o -L/usr/lib -L/usr/local/lib -L/home/kobkrit/stmd-1.1.5 -licui18n -licuuc -licudata -lm -lystem -lstemmer /usr/lib/x86_64-linux-gnu/libexpat.so -ldl
/home/kobkrit/stmd-1.1.5/libystem.a(normalizer.o): In function `utf8toutf16':
/home/kobkrit/stmd-1.1.5/normalizer.c:177: undefined reference to `utf8_nextCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:191: undefined reference to `u_errorName_48'
/home/kobkrit/stmd-1.1.5/libystem.a(normalizer.o): In function `utf16toutf8':
/home/kobkrit/stmd-1.1.5/normalizer.c:227: undefined reference to `u_errorName_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:219: undefined reference to `utf8_appendCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:223: undefined reference to `utf8_appendCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/libystem.a(normalizer.o): In function `normalizer_sparse_tostr':
/home/kobkrit/stmd-1.1.5/normalizer.c:125: undefined reference to `unorm_normalize_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:138: undefined reference to `unorm_normalize_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:140: undefined reference to `u_errorName_48'
/home/kobkrit/stmd-1.1.5/libystem.a(ngram.o): In function `nextchar':
/home/kobkrit/stmd-1.1.5/ngram.c:158: undefined reference to `utf8_nextCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/ngram.c:150: undefined reference to `utf8_nextCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/libystem.a(ngram.o): In function `ng_output':
/home/kobkrit/stmd-1.1.5/ngram.c:182: undefined reference to `utf8_appendCharSafeBody_48'
collect2: ld returned 1 exit status
make: *** [stmd] Error 1
It seems about the problem between linker to ICU library, so I take a look on Makefile, I found
...
CFLAGS+=$(shell /usr/bin/icu-config --cflags)
CFLAGS+=$(shell /usr/bin/icu-config --cppflags)
LDFLAGS+=$(shell /usr/bin/icu-config --ldflags-searchpath)
LDFLAGS+=$(shell /usr/bin/icu-config --ldflags)
...
(I don't quite sure, does it relate to the problem or not?)
I tried build the stmd library on Ubuntu 10.04.4 LTS amd64 and it went fine and work perfectly. But sadly my server's hardware is not compatible with the old Ubuntu. Please help.
Your command line:
g++ ... -licui18n -licuuc -licudata -ldl -lm ... -o stmd stmd.o stmc.o ...
is incorrect: the order of object files and libraries on command line matters.