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

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

Related

How to associate source files with dynamic library

I need to debug Postgres foreign data wrapper mysql_fdw.so. In Clion i try to attach postgres process.
Debugger attached to process 8818
In source code of fdw i try to set break points, but it says no executable code associated with this line.
How can i associate source code? Or can i debug this in another way?
compile commands:
gcc -g3 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -ggdb -O0 -fno-omit-frame-pointer -I/usr/local/mysql/include -g3 -D _MYSQL_LIBNAME=\"libmysqlclient.dylib\" -I. -I./ -I/usr/local/pgsql/include/server -I/usr/local/pgsql/include/internal -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -c -o mysql_fdw.o mysql_fdw.c
gcc -g3 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -ggdb -O0 -fno-omit-frame-pointer -bundle -multiply_defined suppress -o mysql_fdw.so connection.o option.o deparse.o mysql_query.o mysql_fdw.o -L/usr/local/pgsql/lib -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -Wl,-dead_strip_dylibs -bundle_loader /usr/local/pgsql/bin/postgres

how can i link -ldl from Makefile?

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.

C++ no equal sign but compiles without assigning value

While tracking down a bug in my software, I encountered a weird behavior, and was wondering if anyone would have some hindsight.
Here is the code (it compiles and does not have any runtime errors):
#define ERR_OK 0
#define ERR_NOT_OK -41
int some_class::some_function(uint32_t verbose){
int ret_value = ERR_OK;
if (some_condition) {
ret_value ERR_NOT_OK;
}
return ret_value;
}
Why does this line compile; it's missing an equal sign:
ret_value ERR_NOT_OK;
Xcodebuild log:
CompileC /Users/user_name/Library/Developer/Xcode/DerivedData/xxx-emkfpcfmbsgbyrammutcuwrgpqox/Build/Intermediates/project_name.build/Debug/project_nameAPI.build/Objects-normal/x86_64/some_class.o api/src/some_class.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/user_name/Documents/project_name/project_name_dev
export LANG=en_US.US-ASCII
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -fno-common -Werror -Wno-missing-field-initializers -Wno-missing-prototypes -Wunreachable-code -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wassign-enum -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -fasm-blocks -funroll-loops -fstrict-aliasing -Wno-deprecated-declarations -Winvalid-offsetof -mmacosx-version-min=10.10 -g -Wno-sign-conversion -Winfinite-recursion -Wmove -iquote /Users/user_name/Library/Developer/Xcode/DerivedData/jal-emkfpcfmbsgbyrammutcuwrgpqox/Build/Intermediates/project_name.build/Debug/project_nameAPI.build/project_nameAPI-generated-files.hmap -I/Users/user_name/Library/Developer/Xcode/DerivedData/jal-emkfpcfmbsgbyrammutcuwrgpqox/Build/Intermediates/project_name.build/Debug/project_nameAPI.build/project_nameAPI-own-target-headers.hmap -I/Users/user_name/Library/Developer/Xcode/DerivedData/jal-emkfpcfmbsgbyrammutcuwrgpqox/Build/Intermediates/project_name.build/Debug/project_nameAPI.build/project_nameAPI-all-target-headers.hmap -iquote /Users/user_name/Library/Developer/Xcode/DerivedData/jal-emkfpcfmbsgbyrammutcuwrgpqox/Build/Intermediates/project_name.build/Debug/project_nameAPI.build/project_nameAPI-project-headers.hmap -I/Users/user_name/Library/Developer/Xcode/DerivedData/jal-emkfpcfmbsgbyrammutcuwrgpqox/Build/Products/Debug/include -I/Users/user_name/Library/Developer/Xcode/DerivedData/jal-emkfpcfmbsgbyrammutcuwrgpqox/Build/Intermediates/project_name.build/DerivedSources/include -I/Users/user_name/Library/Developer/Xcode/DerivedData/jal-emkfpcfmbsgbyrammutcuwrgpqox/Build/Intermediates/project_name.build/Debug/project_nameAPI.build/DerivedSources/x86_64 -I/Users/user_name/Library/Developer/Xcode/DerivedData/jal-emkfpcfmbsgbyrammutcuwrgpqox/Build/Intermediates/project_name.build/Debug/project_nameAPI.build/DerivedSources -Wno-address-of-packed-member -Wno-unknown-warning-option -F/Users/user_name/Library/Developer/Xcode/DerivedData/jal-emkfpcfmbsgbyrammutcuwrgpqox/Build/Products/Debug -Wall -MMD -MT dependencies -MF /Users/user_name/Library/Developer/Xcode/DerivedData/jal-emkfpcfmbsgbyrammutcuwrgpqox/Build/Intermediates/project_name.build/Debug/project_nameAPI.build/Objects-normal/x86_64/some_class.d --serialize-diagnostics /Users/user_name/Library/Developer/Xcode/DerivedData/jal-emkfpcfmbsgbyrammutcuwrgpqox/Build/Intermediates/project_name.build/Debug/project_nameAPI.build/Objects-normal/x86_64/some_class.dia -c /Users/user_name/Documents/project_name/project_name_dev/api/src/some_class.cpp -o /Users/user_name/Library/Developer/Xcode/DerivedData/jal-emkfpcfmbsgbyrammutcuwrgpqox/Build/Intermediates/project_name.build/Debug/project_nameAPI.build/Objects-normal/x86_64/some_class.o
Edit: Removed semicolons and changed #define ERR_NOT_OK 1 to #define ERR_NOT_OK -41; added xcodebuild log.
If ERR_NOT_OK is defined as -41, then your
ret_value ERR_NOT_OK;
is substituted with
ret_value -41;
which is a valid expression statement, even though it is effectively a no-op. What was originally intended as unary - gets interpreted as binary - in this context.
This is why it is a good idea to define it as
#define ERR_NOT_OK (-41)

Expression is not an integer constant expression

I am using xcode 4.2.1, Apple LLVM compiler 3.0.
Project cleans successfully in xcode and builds successfully from the command line. The problem is the project fails to build in xcode. I feel like I am missing something in my xcode configuration. I have made no edits to the original source I pulled down.
From the log navigator:
CompileC /Developer/Code/blender-build/cmake/source/blender/blenkernel/Blender.build/Debug/bf_blenkernel.build/Objects-normal/x86_64/idcode.o source/blender/blenkernel/intern/idcode.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
cd /Developer/Code/blender-build/blender
setenv LANG en_US.US-ASCII
/Developer/usr/bin/clang -x c -arch x86_64 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -O0 -Wno-return-type -Wparentheses -Wswitch -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-shorten-64-to-32 "-DCMAKE_INTDIR=\"Debug\"" -DHAVE_STDBOOL_H -D__SSE__ -D__MMX__ -D__SSE2__ -D__LITTLE_ENDIAN__ -DOPJ_STATIC -DGLEW_STATIC -DWITH_AUDASPACE -DWITH_BULLET -DWITH_OPENEXR -DWITH_TIFF -DWITH_OPENJPEG -DWITH_DDS -DWITH_CINEON -DWITH_FRAMESERVER -DWITH_HDR -DWITH_AVI -DWITH_QUICKTIME -DWITH_PYTHON -DWITH_PYTHON_SECURITY -DWITH_MOD_FLUID -DWITH_SMOKE -DWITH_LZO -DWITH_LZMA -DWITH_GAMEENGINE -DWITH_LIBMV -DFFTW3=1 -DWITH_INTERNATIONAL -DWITH_FREESTYLE -DDEBUG -D_DEBUG -isysroot /Developer/SDKs/MacOSX10.7.sdk -fasm-blocks -mmacosx-version-min=10.6 -gdwarf-2 -Wno-sign-conversion -I/Developer/Code/blender-build/cmake/lib/Debug/include -I/Developer/Code/blender-build/blender/source/blender/blenkernel -I/Developer/Code/blender-build/blender/source/blender/blenfont -I/Developer/Code/blender-build/blender/source/blender/blenlib -I/Developer/Code/blender-build/blender/source/blender/blenloader -I/Developer/Code/blender-build/blender/source/blender/gpu -I/Developer/Code/blender-build/blender/source/blender/ikplugin -I/Developer/Code/blender-build/blender/source/blender/imbuf -I/Developer/Code/blender-build/blender/source/blender/makesdna -I/Developer/Code/blender-build/blender/source/blender/makesrna -I/Developer/Code/blender-build/blender/source/blender/bmesh -I/Developer/Code/blender-build/blender/source/blender/modifiers -I/Developer/Code/blender-build/blender/source/blender/nodes -I/Developer/Code/blender-build/blender/source/blender/render/extern/include -I/Developer/Code/blender-build/blender/intern/guardedalloc -I/Developer/Code/blender-build/blender/intern/iksolver/extern -I/Developer/Code/blender-build/blender/intern/memutil -I/Developer/Code/blender-build/blender/intern/mikktspace -I/Developer/Code/blender-build/blender/intern/raskter -I/Developer/Code/blender-build/blender/intern/smoke/extern -I/Developer/Code/blender-build/blender/extern/libmv -I/Developer/Code/blender-build/blender/intern/atomic -I/Developer/Code/blender-build/blender/source/blender/windowmanager -I/Developer/Code/blender-build/blender/intern/audaspace/intern -I/Developer/Code/blender-build/blender/intern/rigidbody -I/Developer/Code/blender-build/blender/source/blender/avi -I/Developer/Code/blender-build/blender/source/blender/quicktime -I/Developer/Code/blender-build/blender/source/blender/python -I/Developer/Code/blender-build/blender/intern/elbeem/extern -I/Developer/Code/blender-build/blender/extern/glew/include -I/Developer/Code/blender-build/blender/extern/bullet2/src -I/Developer/Code/blender-build/blender/extern/lzo/minilzo -I/Developer/Code/blender-build/blender/extern/lzma -I/Developer/Code/blender-build/blender/extern/recastnavigation -I/Developer/Code/blender-build/lib/darwin-9.x.universal/fftw3/include -I/Developer/Code/blender-build/cmake/source/blender/blenkernel/Blender.build/Debug/bf_blenkernel.build/DerivedSources/x86_64 -I/Developer/Code/blender-build/cmake/source/blender/blenkernel/Blender.build/Debug/bf_blenkernel.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Developer/Code/blender-build/cmake/lib/Debug -F/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks -Wall -Wcast-align -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=return-type -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts -Wno-unknown-pragmas -Wpointer-arith -Wunused-parameter -Wwrite-strings -Wundef -Winit-self -Wnonnull -Wmissing-include-dirs -Wno-div-by-zero -Wtype-limits -msse2 -msse -pipe -funsigned-char -fno-strict-aliasing -MMD -MT dependencies -MF /Developer/Code/blender-build/cmake/source/blender/blenkernel/Blender.build/Debug/bf_blenkernel.build/Objects-normal/x86_64/idcode.d -c /Developer/Code/blender-build/blender/source/blender/blenkernel/intern/idcode.c -o /Developer/Code/blender-build/cmake/source/blender/blenkernel/Blender.build/Debug/bf_blenkernel.build/Objects-normal/x86_64/idcode.o
Error:
/Developer/Code/blender-build/blender/source/blender/blenkernel/intern/idcode.c:90:10:{90:10-90:29}: error: expression is not an integer constant expression [3]
int i = ARRAY_SIZE(idtypes);
^~~~~~~~~~~~~~~~~~~
/Developer/Code/blender-build/blender/source/blender/blenlib/BLI_utildefines.h:353:36: note: instantiated from:
((sizeof(struct {int isnt_array : ((void *)&(arr) == &(arr)[0]);}) * 0) + \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What can I do to get a clean build?
I upgraded xcode to version 4.6.3. The compiler updated to LLVM 4.2 and these problems were resolved. Otherwise I don't know why the previous version was failing.

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.