undefined reference to `libiconv'
senisioi opened this issue · 1 comments
senisioi commented
Bug description
I have been trying to compile marianMT on a docker container with this nvcr image nvcr.io/nvidia/pytorch:21.12-py3
and it seems the 3rd party pathie library is making all marian executables fail to link because of the following error:
/usr/bin/ld: ../libmarian.a(pathie.cpp.o): in function `Pathie::convert_encodings(char const*, char const*, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)':
/marian/src/3rd_party/pathie-cpp/src/pathie.cpp:121: undefined reference to `libiconv_open'
/usr/bin/ld: /marian/src/3rd_party/pathie-cpp/src/pathie.cpp:152: undefined reference to `libiconv'
/usr/bin/ld: /marian/src/3rd_party/pathie-cpp/src/pathie.cpp:161: undefined reference to `libiconv_close'
How to reproduce
Pull the nvcr image nvcr.io/nvidia/pytorch:21.12-py3
and install all dependencies.
git clone --depth 1 --branch 1.11.0 https://github.com/marian-nmt/marian /marian
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_SENTENCEPIECE=ON -DUSE_MPI=ON -DCOMPILE_CPU=on -DCOMPILE_SERVER=on && make -j8
Context
- Marian version: 1.11.0
- CMake command: Type the cmake command you used and attach the output of
--build-info all
- Log file: Attach your training/decoding logs
The dependency install for docker is based strongly on this repo
senisioi commented
I found a fix by commenting the if
statement at this line to always
set(EXT_LIBS ${EXT_LIBS} iconv)
Is that condition really necessary only for APPLE?
A working example is available in my branch
Update: it seems this only works if I compile libiconv in the image. Now the comment at line 168 makes perfect sense.