idiap / pkwrap

A pytorch wrapper for LF-MMI training and parallel training in Kaldi
Other
73 stars 12 forks source link

undefined symbol: _ZN5kaldi23SplitStringOnFirstSpaceERKSsPSsS2_ #21

Closed iezhanqingran closed 3 years ago

iezhanqingran commented 3 years ago

Hi,

When I run the script, I had the following errors

Traceback (most recent call last): File "local/chain/train.py", line 16, in <module> import pkwrap File "/home/qzhan/anaconda3/lib/python3.7/site-packages/pkwrap-0.2.31.6-py3.7-linux-x86_64.egg/pkwrap/__init__.py", line 5, in <module> from _pkwrap import * ImportError: /home/qzhan/anaconda3/lib/python3.7/site-packages/pkwrap-0.2.31.6-py3.7-linux-x86_64.egg/_pkwrap.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN5kaldi23SplitStringOnFirstSpaceERKSsPSsS2_

For both Kaldi and Pkwrap, I added CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0"

The kaldi version is 'f1338f'

Thanks, Qingran

mrsrikanth commented 3 years ago

Can you make sure the correct Kaldi libraries are in your LD_LIBRARY_PATH?

iezhanqingran commented 3 years ago

Yes, the kaldi path is correct.

mrsrikanth commented 3 years ago

When I demangle the string

  echo _ZN5kaldi23SplitStringOnFirstSpaceERKSsPSsS2_ | c++filt

I get

kaldi::SplitStringOnFirstSpace(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >*)

One possibility is that your Kaldi is not really compiled with CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0". The other possibility is that there are many conflicting Kaldi libraries in your LD_LIBRARY_PATH. Yet another possibility is that your Kaldi version is old. Are you sure your version is f1338f? I couldn't find such version in Kaldi's revision history.

iezhanqingran commented 3 years ago

Hi,

Sorry, my kaldi version should be 94f3762 and I checked the LD_LIBRARY_PATH, there is only one kaldi, I did echo $LD_LIBRARY_PATH :/home/qzhan/tools/kaldi/src/lib For the CXXFLAGS, I think I compiled with CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0", but I will try it again.

iezhanqingran commented 3 years ago

I recompiled everything and now it works. Thanks, Qingran

jyp0716 commented 3 years ago

@iezhanqingran I compiled with CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0", but I can not build kaldi successfully In kaldi tools folder, I build it with make CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" -j 32, but I met some errors, Can you help me ? Thanks

iezhanqingran commented 3 years ago

@iezhanqingran I compiled with CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0", but I can not build kaldi successfully In kaldi tools folder, I build it with make CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" -j 32, but I met some errors, Can you help me ? Thanks

Can you show the errors?

jyp0716 commented 3 years ago

@iezhanqingran I compiled with CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0", but I can not build kaldi successfully In kaldi tools folder, I build it with make CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" -j 32, but I met some errors, Can you help me ? Thanks

Can you show the errors?

ok, I show part logs /usr/bin/ld alignment_test.cpp: (.text+0x562): undefined reference to "TokenAlignmet::GetTokenFor(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>,> const&)"

I used: gcc -v 9.4 kaldi -v 66f5434

mrsrikanth commented 3 years ago

It looks like you have modified Kaldi code. There looks to be a typo in TokenAlignmet. I am not able to find alignment_test.cpp either.

Also, make sure the tools/ directory is compiled with the same flags. It is best to clean and compile from scratch.

jyp0716 commented 3 years ago

It looks like you have modified Kaldi code. There looks to be a typo in TokenAlignmet. I am not able to find alignment_test.cpp either.

Also, make sure the tools/ directory is compiled with the same flags. It is best to clean and compile from scratch.

Hi, I did not modify kaldi code I git clone kaldi master branch and then compile tools/ directory with make CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" -j 32, then I meet some errors If I compile with make -j 32, it build successfully

mrsrikanth commented 3 years ago

I tried to reproduce it and looks to me that this is a problem with sctk. If I skip installing it, everything else works.

jyp0716 commented 3 years ago

Thanks, I will try to recompile without sctk