neubig / travatar

This is a repository for the Travatar forest-to-string translation decoder
GNU Lesser General Public License v3.0
28 stars 11 forks source link

Got error with icui18n when compiling #39

Open xuanchien opened 8 years ago

xuanchien commented 8 years ago

Hi,

I got the following issue when compiling travatar on my Mac (version OS X 10.10.5). Here is the log:

depbase=`echo travatar.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    g++ -DHAVE_CONFIG_H -I. -I../../src/include/travatar    -g -O3 -Wall -DKENLM_MAX_ORDER=6 -I./../include -pthread -I/usr/local/include -g -O2 -MT travatar.o -MD -MP -MF $depbase.Tpo -c -o travatar.o travatar.cc &&\
    mv -f $depbase.Tpo $depbase.Po
/bin/sh ../../libtool --tag=CXX   --mode=link g++ -g -O3 -Wall -DKENLM_MAX_ORDER=6 -I./../include -pthread -I/usr/local/include -g -O2   -o travatar travatar.o ../lib/libtravatar.la ../kenlm/lm/libklm.la ../kenlm/util/libklm_util.la ../kenlm/search/libklm_search.la ../tercpp/libter.la ../marisa/libmarisa.la ../liblbfgs/liblbfgs.la -L/usr/local/lib -lboost_thread-mt -lboost_regex-mt -lboost_iostreams-mt -lboost_system -lboost_locale-mt  -lz -licui18n -licuuc -licudata
libtool: link: g++ -g -O3 -Wall -DKENLM_MAX_ORDER=6 -I./../include -pthread -I/usr/local/include -g -O2 -o .libs/travatar travatar.o -Wl,-bind_at_load  ../lib/.libs/libtravatar.dylib ../kenlm/lm/.libs/libklm.dylib ../kenlm/util/.libs/libklm_util.dylib ../kenlm/search/.libs/libklm_search.dylib ../tercpp/.libs/libter.dylib ../marisa/.libs/libmarisa.dylib ../liblbfgs/.libs/liblbfgs.a -L/usr/local/lib -lboost_thread-mt -lboost_regex-mt -lboost_iostreams-mt -lboost_system -lboost_locale-mt -lz -licui18n -licuuc -licudata -pthread
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
ld: library not found for -licui18n
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [travatar] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

Even though I have already installed icu4c using Homebrew, it does not solve the issue. Do you have any suggestions for resolving this?

Thanks in advance!

neubig commented 8 years ago

Thanks for the report @xuanchien !

@akivajp , could you take a look at this? I think you added these libraries. Maybe we need to find an m4 macro that finds the proper location of ICU.

hideakihata commented 8 years ago

This works for me. brew install icu4c && brew link icu4c

rpryzant commented 5 years ago

@hideakihata's fix worked for me. Note that 1) You will need to re-run ./configure after the install and 2) You may need to manually link icu4c:

export PATH=/usr/local/opt/icu4c/bin:/usr/local/opt/icu4c/sbin:$PATH
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"

I think this can be marked as resolved.

LeonIdeal commented 5 years ago

Hi, I met the same problem with the error library not found for -licui18n And I follow the solutions step by step that brew install icu4c and met the warning: `Warning: Refusing to link macOS-provided software: icu4c If you need to have icu4c first in your PATH run: echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile

For compilers to find icu4c you may need to set: export LDFLAGS="-L/usr/local/opt/icu4c/lib" export CPPFLAGS="-I/usr/local/opt/icu4c/include"

For pkg-config to find icu4c you may need to set: export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"

Then I changed the environment variables like above. And ./configure Finally run make However it presented the same problem. I wonder why, thank you!