我在 Ubuntu20.04 上运行我的程序。我的程序在使用多个 Kaldi 库时产生了以下错误:
symbol lookup error: /home/Documents/xxx/libkaldi-chain.so: undefined symbol: _ZN5kaldi16g_cuda_allocatorE
按照这个问题下的答案:符号查找错误未定义符号,但所有符号似乎都存在,我查找了输出ldd libkaldi-chain.so
:
linux-vdso.so.1 (0x00007ffea1bc7000)
libkaldi-cudamatrix.so (0x00007fed03c5d000)
libkaldi-lat.so (0x00007fed036b3000)
libkaldi-fstext.so (0x00007fed035f6000)
libkaldi-hmm.so (0x00007fed0330a000)
libkaldi-util.so (0x00007fed0327f000)
libkaldi-matrix.so (0x00007fed0318b000)
libkaldi-base.so (0x00007fed03162000)
libfst.so.10 (0x00007fed0301a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fed02fe3000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fed02e94000)
libcudart.so.9.2 (0x00007fed02c2a000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fed02a47000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fed02a2c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fed0283a000)
/lib64/ld-linux-x86-64.so.2 (0x00007fed04152000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fed02834000)
libkaldi-tree.so (0x00007fed02731000)
libmkl_intel_lp64.so => /lib/x86_64-linux-gnu/libmkl_intel_lp64.so (0x00007fed01bc3000)
libmkl_core.so => /lib/x86_64-linux-gnu/libmkl_core.so (0x00007fecfd8a3000)
libmkl_sequential.so => /lib/x86_64-linux-gnu/libmkl_sequential.so (0x00007fecfc28b000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fecfc280000)
如果我理解正确,看起来这是因为 libkaldi-chain.so 没有链接到几个共享库,如“libkaldi-cudamatrix.so”、“libkaldi-hmm.so”......
有人可以告诉我如何正确链接这些库并修复这个错误吗?我对 gcc 真的很陌生。