wenet安装python报INTTYPES_FORMAT to either C99, BSD, or VC7 and try again

在尝试使用wenet源码安装Python时遇到CMake错误,错误提示涉及uint32_t类型的定义问题。解决方案是修改wenet/runtime/binding/python/fc_base/gflags-src/CMakeLists.txt文件,注释掉相关错误行并添加gflags_set(INTTYPES_FORMATC99)。如果出现gcc-std=c++14不识别的问题,需要升级gcc。安装成功后会显示torch和typing-extensions等依赖的添加信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误信息

在使用wenet源码安装python的时候报错,错误信息如下

CMake Error at fc_base/gflags-src/CMakeLists.txt:286 (message):
Do not know how to define a 32-bit integer quantity on your system! Neither
uint32_t, u_int32_t, nor _int32 seem to be available. Set
[GFLAGS]INTTYPES_FORMAT to either C99, BSD, or VC7 and try again.

-- Configuring incomplete, errors occurred!
See also "/mnt/wenet/runtime/server/x86/build/CMakeFiles/CMakeOutput.log".
See also "/mnt/wenet/runtime/server/x86/build/CMakeFiles/CMakeError.log".
解决办法

wenet/runtime/binding/python/fc_base/gflags-src/CMakeLists.txt279-290行注释掉,如下

   279	  #if (HAVE_uint32_t)
   280	  #  gflags_set (INTTYPES_FORMAT C99)
   281	  #elseif (HAVE_u_int32_t)
   282	  #  gflags_set (INTTYPES_FORMAT BSD)
   283	  #elseif (HAVE___int32)
   284	  #  gflags_set (INTTYPES_FORMAT VC7)
   285	  #else ()
   286	  #  gflags_property (INTTYPES_FORMAT ADVANCED FALSE)
   287	  #  message (FATAL_ERROR "Do not know how to define a 32-bit integer quantity on your system!"
   288	  #                       " Neither uint32_t, u_int32_t, nor __int32 seem to be available."
   289	  #                       " Set [GFLAGS_]INTTYPES_FORMAT to either C99, BSD, or VC7 and try again.")
   290	  #endif ()

278行添加如下的代码

gflags_set (INTTYPES_FORMAT C99)

修改完成之后,退回到wenet/runtime/binding/python下,执行以下命令

#删除之前编译失败的信息
rm build -rf
#安装python版的wenetruntime
python setup.py install

安装成功之后会出现如下信息

Searching for torch1.10.0+cu111
Best match: torch 1.10.0+cu111
Adding torch 1.10.0+cu111 to easy-install.pth file
Installing convert-caffe2-to-onnx script to /root/anaconda3/envs/wenet/bin
Installing convert-onnx-to-caffe2 script to /root/anaconda3/envs/wenet/bin
Installing torchrun script to /root/anaconda3/envs/wenet/bin
Using /root/anaconda3/envs/wenet/lib/python3.8/site-packages
Searching for typing-extensions
4.4.0
Best match: typing-extensions 4.4.0
Adding typing-extensions 4.4.0 to easy-install.pth file

Using /root/anaconda3/envs/wenet/lib/python3.8/site-packages
Finished processing dependencies for wenetruntime==1.0.12

注意

如果在安装的过程中出现unrecognized command line option ‘-std=c++14’,需要将gcc进行升级,gcc升级教程

参考
  1. https://github.com/wenet-e2e/wenet/issues/1488
  2. https://www.cnblogs.com/jixiaohua/p/11732225.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

修炼之路

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值