You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 18.04 LTS编译doom_py出现编译错误求助

Fixing doom_py Build Failure on Ubuntu 18.04 LTS

Hey there, let's work through this build error you're hitting with doom_py. Looking at your error logs, the root cause is clear:

/tmp/pip-build-fqKs1A/doom-py/doom_py/src/lib/ViZDoomGame.cpp:743:22: error: ‘cerr’ is not a member of ‘std’

This happens because the ViZDoomGame.cpp source file uses std::cerr (for warning messages) but doesn't include the required <iostream> header file that defines it. Here's how to fix this step by step:

Step 1: Verify Dependencies are Installed

First, make sure you've got all the required system libraries installed (as hinted in the error message):

sudo apt-get install -y python-numpy cmake zlib1g-dev libjpeg-dev libboost-all-dev gcc libsdl2-dev wget unzip

Step 2: Fix the Missing Header in Source Code

You'll need to edit the problematic C++ file to add the missing include:

  1. Navigate to the directory containing ViZDoomGame.cpp (from your log, this is /tmp/pip-build-fqKs1A/doom-py/doom_py/src/lib/ — if you're building from a local clone, use that path instead)
  2. Open ViZDoomGame.cpp in a text editor (like nano or vim)
  3. At the very top of the file, add this line to the list of #include statements:
    #include <iostream>
    
  4. Save the file and close the editor
  5. Re-run the build command:
    python setup.py build
    

Step 3: Fallback Options if the Fix Above Doesn't Work

If you still run into issues, it's likely due to version compatibility between your old doom-py version (0.0.14) and Ubuntu 18.04's default GCC (version 7.x, which uses newer C++ standards). Try these alternatives:

Option A: Use a Pre-compiled Wheel (if available)

Try installing doom-py directly with pip, skipping the local build:

pip install doom-py==0.0.14 --no-cache-dir

Option B: Downgrade GCC for Compatibility

Ubuntu 18.04 allows installing older GCC versions. Install GCC 5 and set it as the default for the build:

sudo apt-get install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10

Then re-run the build command. After building, you can switch back to the default GCC if needed:

sudo update-alternatives --remove gcc /usr/bin/gcc-5
sudo update-alternatives --remove g++ /usr/bin/g++-5

Option C: Upgrade to a Newer doom-py Version

If your OpenAI Gym version (0.9.5) supports it, try upgrading doom-py to a more recent release (note: you may need to adjust other dependencies):

pip install --upgrade doom-py

内容的提问来源于stack exchange,提问作者Abbas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 07:02:56