27 Oct 2012
Unitex Corpus Processor is a very useful software component for some NLP tasks.
If you have ever needed to compile it as a dynamic library in Unix, with the following command:
make 64BITS=yes LIBRARY=yes
maybe you have found an error similar to this when compiling Unitex 2.1:
g++ *.o -Wall -W -O3 -fPIC -D_NOT_UNDER_WINDOWS -DUNITEX_LIBRARY -I"../include_tre" -Ilibtre/include -I".." -Llibtre/lib -ltre -lpthread -shared -o ../bin/libunitex.so/usr/bin/ld: libtre/lib/libtre.a(regcomp.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC libtre/lib/libtre.a: could not read symbols: Bad value collect2: ld returned 1 exit status make: *** [.libunitex] Error 1
Or maybe your error looks like this (Unitex 3.0):
g++ *.o -Wall -O3 -fPIC -D_NOT_UNDER_WINDOWS -DUNITEX_LIBRARY -I"../include_tre" -Ilibtre/include -I".." -Llibtre/lib -ltre -lpthread -shared -o ../bin/libunitex.so /usr/bin/ld: libtre/lib/libtre.a(regerror.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC libtre/lib/libtre.a: could not read symbols: Bad value collect2: ld returned 1 exit status make: *** [.libunitex] Error 1
I could solve this issue unzipping and installing the "tre" library included in Unitex distribution (<UNITEX_DIR>/Src/C++/tre-0.8.0.tar.gz):
cd .. tar xvfz tre-0.8.0.tar.gz cd tre-0.8.0 ./configure make
And, as "root":
make install
Then, return to <UNITEX_DIR>/Src/C++/build and execute the following command (all in one line):
g++ *.o -Wall -W -O3 -fPIC -D_NOT_UNDER_WINDOWS -DUNITEX_LIBRARY -I"../include_tre" -Ilibtre/include -I".." -L/usr/local/lib -ltre -lpthread -shared -o ../bin/libunitex.so
If all goes well, you will have your Unitex library in <UNITEX_DIR>/Src/C++/bin/libunitex.so
Hope it helps!
blog comments powered by Disqus