facebookresearch / ELF

An End-To-End, Lightweight and Flexible Platform for Game Research
Other
2.09k stars 284 forks source link

Compilation error in atari #28

Closed swtyree closed 7 years ago

swtyree commented 7 years ago

After following the instructions to build ALE (in ~/Arcade-Learning-Environment/), I attempted to build atari/. Here's the error with the default make instruction:

# PYTHON_CONFIG=/opt/conda/bin/python3-config make
Package ale was not found in the pkg-config search path.
Perhaps you should add the directory containing `ale.pc'
to the PKG_CONFIG_PATH environment variable
No package 'ale' found
[cc] atari_game.cc ...
In file included from atari_game.cc:13:0:
atari_game.h:15:33: fatal error: ale/ale_interface.hpp: No such file or directory
compilation terminated.
Makefile:64: recipe for target 'obj/atari_game.o' failed
make: *** [obj/atari_game.o] Error 1

Here's the error with PKG_CONFIG_PATH set to the ale build/ directory (which contains ale.pc):

# PYTHON_CONFIG=/opt/conda/bin/python3-config PKG_CONFIG_PATH=~/Arcade-Learning-Environment/build/ make
[cc] atari_game.cc ...
In file included from atari_game.cc:13:0:
atari_game.h:15:33: fatal error: ale/ale_interface.hpp: No such file or directory
compilation terminated.
Makefile:64: recipe for target 'obj/atari_game.o' failed
make: *** [obj/atari_game.o] Error 1

Any idea how to fix this? Thanks!

qucheng commented 7 years ago

Can you check pkg-config --cflags ale gives the right location? If not can you try add the ale directory to INCLUDE_DIR

swtyree commented 7 years ago

When I call pkg-config --cflags ale the result is:

Package ale was not found in the pkg-config search path.
Perhaps you should add the directory containing `ale.pc'
to the PKG_CONFIG_PATH environment variable
No package 'ale' found

When I call PKG_CONFIG_PATH=~/Arcade-Learning-Environment/build/ pkg-config --cflags ale, I get -I/usr/local/include.

I've tried adding INCLUDE_DIR += ~/Arcade-Learning-Environment/, INCLUDE_DIR += ~/Arcade-Learning-Environment/build/, and INCLUDE_DIR += ~/Arcade-Learning-Environment/src/ to the Makefile, each to no avail. Am I missing something in the ALE build? I built according to the instructions on the website.

haoxu13 commented 7 years ago

Hi! I met the same problem as you.And I solved it by running make install While building ALE. Right after the official instruction: cmake -DUSE_SDL=ON -DUSE_RLGLUE=OFF -DBUILD_EXAMPLES=ON . make -j 4

But I encountered another problem. Here is the log:

$make
find: illegal option -- n
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
       find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
[dep] python_wrapper.cc ...
[dep] atari_game.cc ...
find: illegal option -- n
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
       find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
[cc] atari_game.cc ...
atari_game.cc: In member function 'void AtariGame::MainLoop(const std::atomic_bool&)':
atari_game.cc:108:27: error: 'using AIComm = using AIComm = class AICommT<ContextT<GameOptions, GameState, Reply> >' has no member named 'newest'
           act = _ai_comm->newest().reply.action;
                           ^
atari_game.cc: In member function 'int AtariGame::_prevent_stuck(std::default_random_engine&, int)':
atari_game.cc:158:17: error: 'using AIComm = using AIComm = class AICommT<ContextT<GameOptions, GameState, Reply> >' has no member named 'newest'
       _ai_comm->newest().reply.action = act;
                 ^
make: *** [obj/atari_game.o] Error 1

I am running on macOS Sierra and the default python version is 2.7. So I modified Makefile a single line: PYTHON_CONFIG ?= python3-config Before makefile I executed some commands:

$ export CC=/usr/local/bin/gcc-4.9
$ export CXX=/usr/local/bin/g++-4.9

Otherwise I get another error: clang: error: unsupported option '-fopenmp' I have tried to fix the error by referring to #23

Changed the code in atari_game.cc to _ai_comm->history().newest().reply; But it even became worse... Any idea how to fix this? Thank you so much!

swtyree commented 7 years ago

Thanks, @haoxu13. I'm running in Docker with Ubuntu 16.04, and I'm now getting the same error you are:

root@9d0d2101153a:~/ELF/atari# PYTHON_CONFIG=/opt/conda/bin/python3-config make
[cc] atari_game.cc ...
atari_game.cc: In member function 'void AtariGame::MainLoop(const atomic_bool&)':
atari_game.cc:108:27: error: 'using AIComm = using AIComm = class AICommT<ContextT<GameOptions, GameState, Reply> > {aka class AICommT<ContextT<GameOptions, GameState, Reply> >}' has no member named 'newest'
           act = _ai_comm->newest().reply.action;
                           ^
atari_game.cc: In member function 'int AtariGame::_prevent_stuck(std::default_random_engine&, int)':
atari_game.cc:158:17: error: 'using AIComm = using AIComm = class AICommT<ContextT<GameOptions, GameState, Reply> > {aka class AICommT<ContextT<GameOptions, GameState, Reply> >}' has no member named 'newest'
       _ai_comm->newest().reply.action = act;
                 ^
Makefile:65: recipe for target 'obj/atari_game.o' failed
make: *** [obj/atari_game.o] Error 1
yuandong-tian commented 7 years ago

@swtyree fixed in https://github.com/facebookresearch/ELF/commit/60d9533fe74b81542df78530626b034914eb9ce9

WendyShang commented 7 years ago

Hi, I run into this issue too, and this is how it was resolved: (1) make sure pkg-config --cflags ale finds the package. (2) in my case, without root, my package is not properly installed. so the /usr/local/include is empty (3) I provide the absolute path for header files to ale_interface.hpp in all relevant code (#include "path/to/Arcade-Learning-Environment/src/ale_interface.hpp")

(but i didn't have additional errors and make worked)