1. 程式人生 > >安裝ale_python_interface時遇到make錯誤

安裝ale_python_interface時遇到make錯誤

1、

 首先按照https://pypi.org/project/ale-python-interface/0.0.1/ 來安裝,直接python3 -m pip

但提示缺少一個頭檔案ale_c_wrapper.h,報錯如下:

1     ale_python_interface/ale_c_wrapper.cpp:1:10: fatal error: ale_c_wrapper.h: No such file or directory
2      #include "ale_c_wrapper.h"
3               ^~~~~~~~~~~~~~~~~
4     compilation terminated.
5 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 6

不過這個網上有一個blog寫到這個問題,不過他的方法我試了不可以,你們可以試試:https://blog.csdn.net/senjie_wang/article/details/84073823

 

2、

然後按照https://github.com/bbitmaster/ale_python_interface/wiki/Installation-Instructions,來安裝。

結果在第一大步的最後一小步,make時出錯,報錯如下:

 1
MsPacman.cpp:(.text+0x18a): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 2 MsPacman.cpp:(.text+0x1da): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 3 MsPacman.cpp:(.text+0x1c2): undefined reference to `StellaEnvironmentWrapper::softReset()'
4 src/games/supported/NameThisGame.o: In function `NameThisGameSettings::setMode(unsigned int, System&, std::unique_ptr<StellaEnvironmentWrapper, std::default_delete<StellaEnvironmentWrapper> >)': 5 NameThisGame.cpp:(.text+0x172): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 6 NameThisGame.cpp:(.text+0x193): undefined reference to `StellaEnvironmentWrapper::softReset()' 7 src/games/supported/Pong.o: In function `PongSettings::setMode(unsigned int, System&, std::unique_ptr<StellaEnvironmentWrapper, std::default_delete<StellaEnvironmentWrapper> >)': 8 Pong.cpp:(.text+0x152): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 9 Pong.cpp:(.text+0x173): undefined reference to `StellaEnvironmentWrapper::softReset()' 10 src/games/supported/Pooyan.o: In function `PooyanSettings::setMode(unsigned int, System&, std::unique_ptr<StellaEnvironmentWrapper, std::default_delete<StellaEnvironmentWrapper> >)': 11 Pooyan.cpp:(.text+0x18a): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 12 Pooyan.cpp:(.text+0x1ab): undefined reference to `StellaEnvironmentWrapper::softReset()' 13 src/games/supported/PrivateEye.o: In function `PrivateEyeSettings::setMode(unsigned int, System&, std::unique_ptr<StellaEnvironmentWrapper, std::default_delete<StellaEnvironmentWrapper> >)': 14 PrivateEye.cpp:(.text+0x152): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 15 PrivateEye.cpp:(.text+0x173): undefined reference to `StellaEnvironmentWrapper::softReset()' 16 src/games/supported/SpaceInvaders.o: In function `SpaceInvadersSettings::setMode(unsigned int, System&, std::unique_ptr<StellaEnvironmentWrapper, std::default_delete<StellaEnvironmentWrapper> >)': 17 SpaceInvaders.cpp:(.text+0x192): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 18 SpaceInvaders.cpp:(.text+0x1b3): undefined reference to `StellaEnvironmentWrapper::softReset()' 19 src/games/supported/StarGunner.o: In function `StarGunnerSettings::setMode(unsigned int, System&, std::unique_ptr<StellaEnvironmentWrapper, std::default_delete<StellaEnvironmentWrapper> >)': 20 StarGunner.cpp:(.text+0x1e2): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 21 StarGunner.cpp:(.text+0x203): undefined reference to `StellaEnvironmentWrapper::softReset()' 22 src/games/supported/Tennis.o: In function `TennisSettings::setMode(unsigned int, System&, std::unique_ptr<StellaEnvironmentWrapper, std::default_delete<StellaEnvironmentWrapper> >)': 23 Tennis.cpp:(.text+0x1da): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 24 Tennis.cpp:(.text+0x1fb): undefined reference to `StellaEnvironmentWrapper::softReset()' 25 src/games/supported/Tutankham.o: In function `TutankhamSettings::setMode(unsigned int, System&, std::unique_ptr<StellaEnvironmentWrapper, std::default_delete<StellaEnvironmentWrapper> >)': 26 Tutankham.cpp:(.text+0x1aa): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 27 Tutankham.cpp:(.text+0x1cb): undefined reference to `StellaEnvironmentWrapper::softReset()' 28 src/games/supported/VideoPinball.o: In function `VideoPinballSettings::setMode(unsigned int, System&, std::unique_ptr<StellaEnvironmentWrapper, std::default_delete<StellaEnvironmentWrapper> >)': 29 VideoPinball.cpp:(.text+0x19a): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 30 VideoPinball.cpp:(.text+0x1bb): undefined reference to `StellaEnvironmentWrapper::softReset()' 31 src/games/supported/YarsRevenge.o: In function `YarsRevengeSettings::setMode(unsigned int, System&, std::unique_ptr<StellaEnvironmentWrapper, std::default_delete<StellaEnvironmentWrapper> >)': 32 YarsRevenge.cpp:(.text+0x171): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 33 YarsRevenge.cpp:(.text+0x199): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 34 YarsRevenge.cpp:(.text+0x1b9): undefined reference to `StellaEnvironmentWrapper::softReset()' 35 src/games/supported/Zaxxon.o: In function `ZaxxonSettings::setMode(unsigned int, System&, std::unique_ptr<StellaEnvironmentWrapper, std::default_delete<StellaEnvironmentWrapper> >)': 36 Zaxxon.cpp:(.text+0x149): undefined reference to `StellaEnvironmentWrapper::pressSelect(unsigned long)' 37 Zaxxon.cpp:(.text+0x169): undefined reference to `StellaEnvironmentWrapper::softReset()' 38 src/environment/stella_environment.o: In function `StellaEnvironment::getWrapper()': 39 stella_environment.cpp:(.text+0x7ae): undefined reference to `StellaEnvironmentWrapper::StellaEnvironmentWrapper(StellaEnvironment&)' 40 collect2: error: ld returned 1 exit status 41 makefile:149: recipe for target 'ale' failed 42 make: *** [ale] Error 1

 從這個報錯中,就可以發現,基本就是StellaEnvironmentWrapper::*   什麼什麼沒有定義。

終於找到相關的檔案stella_environment_wrapper.cpp 和 stella_environment_wrapper.hpp

在下載的檔案Arcade-Learning-Environment的./src/environment/目錄下面。

從下面截圖就能發現很奇怪,在make一遍後,相關檔案都被編譯成.o檔案了,卻沒有stella_environment_wrapper.o檔案:

於是開啟這個目錄裡面的module.mk檔案:$ vi module.mk

為什麼只產生三個.o檔案,不生成stella_environment_wrapper.o檔案啊。

於是把它改成:

就是多加了一行,生成對應的stella_environment_wrapper.o檔案。

然後再返回到Arcade-Learning-Environment目錄,然後再執行一遍make。

再執行一遍$ ls,看到當前目錄下有libale.so,就成功了

 

OK

done.