【问题描述】
在鲲鹏环境(openEuler 20.03 LTS SP3)编译wenet 2.0.1报undefined reference to `at::_ops::zeros::call(c10:ArrayRef<long>, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>)'和undefined reference to `at::_ops::cat::call(c10::ArrayRef<at::Tensor>, long)'错误,详细报错信息如下:
[ 81%] Building CXX object bin/CMakeFiles/websocket_server_main.dir/websocket_server_main.cc.o
[ 82%] Linking CXX executable websocket_server_main
/usr/bin/ld: CMakeFiles/websocket_server_main.dir/websocket_server_main.cc.o: in function `at::zeros(c10::ArrayRef<long>, c10::TensorOptions)':
websocket_server_main.cc:(.text._ZN2at5zerosEN3c108ArrayRefIlEENS0_13TensorOptionsE[_ZN2at5zerosEN3c108ArrayRefIlEENS0_13TensorOptionsE]+0x7c): undefined reference to `at::_ops::zeros::call(c10::ArrayRef<long>, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>)'
/usr/bin/ld: ../decoder/libdecoder.a(torch_asr_model.cc.o): in function `at::cat(c10::ArrayRef<at::Tensor>, long)':
torch_asr_model.cc:(.text._ZN2at3catEN3c108ArrayRefINS_6TensorEEEl[_ZN2at3catEN3c108ArrayRefINS_6TensorEEEl]+0x24): undefined reference to `at::_ops::cat::call(c10::ArrayRef<at::Tensor>, long)'
collect2: error: ld returned 1 exit status
gmake[2]: *** [bin/CMakeFiles/websocket_server_main.dir/build.make:97: bin/websocket_server_main] Error 1
gmake[2]: Leaving directory '/root/wenet-2.0.1/runtime/server/x86/build'
gmake[1]: *** [CMakeFiles/Makefile2:2177: bin/CMakeFiles/websocket_server_main.dir/all] Error 2
gmake[1]: Leaving directory '/root/wenet-2.0.1/runtime/server/x86/build'
gmake: *** [Makefile:152: all] Error 2

【解决方法】
手动下载获取libtorch-shared-with-deps-1.13.0%2Bcpu.zip解压并替换../fc_base/路径下的libtorch-src文件夹
cd ../fc_base/
wget cid:link_0

rm -rf libtorch-src
mv libtorch libtorch-src

然后再次执行cmake --build .编译。
【问题描述】
在鲲鹏环境(openEuler 20.03 LTS SP3)编译wenet 2.0.1报undefined reference to `at::_ops::zeros::call(c10:ArrayRef<long>, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>)'和undefined reference to `at::_ops::cat::call(c10::ArrayRef<at::Tensor>, long)'错误,详细报错信息如下:
[ 81%] Building CXX object bin/CMakeFiles/websocket_server_main.dir/websocket_server_main.cc.o
[ 82%] Linking CXX executable websocket_server_main
/usr/bin/ld: CMakeFiles/websocket_server_main.dir/websocket_server_main.cc.o: in function `at::zeros(c10::ArrayRef<long>, c10::TensorOptions)':
websocket_server_main.cc:(.text._ZN2at5zerosEN3c108ArrayRefIlEENS0_13TensorOptionsE[_ZN2at5zerosEN3c108ArrayRefIlEENS0_13TensorOptionsE]+0x7c): undefined reference to `at::_ops::zeros::call(c10::ArrayRef<long>, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>)'
/usr/bin/ld: ../decoder/libdecoder.a(torch_asr_model.cc.o): in function `at::cat(c10::ArrayRef<at::Tensor>, long)':
torch_asr_model.cc:(.text._ZN2at3catEN3c108ArrayRefINS_6TensorEEEl[_ZN2at3catEN3c108ArrayRefINS_6TensorEEEl]+0x24): undefined reference to `at::_ops::cat::call(c10::ArrayRef<at::Tensor>, long)'
collect2: error: ld returned 1 exit status
gmake[2]: *** [bin/CMakeFiles/websocket_server_main.dir/build.make:97: bin/websocket_server_main] Error 1
gmake[2]: Leaving directory '/root/wenet-2.0.1/runtime/server/x86/build'
gmake[1]: *** [CMakeFiles/Makefile2:2177: bin/CMakeFiles/websocket_server_main.dir/all] Error 2
gmake[1]: Leaving directory '/root/wenet-2.0.1/runtime/server/x86/build'
gmake: *** [Makefile:152: all] Error 2
【解决方法】
手动下载获取libtorch-shared-with-deps-1.13.0%2Bcpu.zip解压并替换../fc_base/路径下的libtorch-src文件夹
cd ../fc_base/
wget cid:link_0
rm -rf libtorch-src
mv libtorch libtorch-src
然后再次执行cmake --build .编译。