问题描述:

Ubuntu16.04安装uwsgi时出现的错误。
fatal error: bytecode stream generated with LTO version x.0 instead of the expected x.x

原因

官方文档上说
To build uWSGI you need Python and a C compiler (gcc and clang are supported).
系统已经安装了Python 3.6, 可能gcc的版本不对, 但是上面错误说是LTO的版本不对。
查了一哈,【这里
This error basically means that you’ve got some binary build results (mostly object files) which are incompatible with other binary build results, but you’re trying to link them together.
ubuntu16.04的版本太高了。

解决方法

把GCC的版本改成需要的版本,安装4.8试试。
Ubuntu16.04多个版本GCC编译器的安装和切换

  1. 查看GCC,G++的版本的版本
    gcc -v
    g++ -v
    fatal error: bytecode stream generated with LTO version x.0 instead of the expected x.x
  2. 安装
    sudo apt-get install gcc-4.8
    fatal error: bytecode stream generated with LTO version x.0 instead of the expected x.x
    3.查看当前版本
    ls /usr/bin/gcc*
    4.设置4.8为优先使用版本
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100
    5.重新安装uwsgi
    pip install uwsgi
    fatal error: bytecode stream generated with LTO version x.0 instead of the expected x.x

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-05
  • 2021-07-15
  • 2022-12-23
  • 2021-06-27
  • 2021-09-30