google-deepmind / lab

A customisable 3D platform for agent-based AI research

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to build deepmind_lab.so

Haoo9988 opened this issue · comments

I am using ubuntu 16.04, and when I run bazel build -c opt //:deepmind_lab.so The error is below, Please help me!

ERROR: /home/haoo/anaconda3/envs/lab/BUILD:962:10: C++ compilation of rule '//:deepmind_lab.so' failed (Exit 1) gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 42 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
python/dmlab_module.c:26:20: fatal error: Python.h: No such file or directory
compilation terminated.
Target //:deepmind_lab.so failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 295.856s, Critical Path: 36.21s
INFO: 914 processes: 914 linux-sandbox.
FAILED: Build did NOT complete successfully

This error was resolved when I modified the content of the workspace

new_local_repository(
    name = "python_system",
    build_file = "@//bazel:python.BUILD",
    path = "/home/haoo/anaconda3",
)

but when I run bazel test -c opt //python/tests:python_module_test a new error appeared

ERROR: /home/haoo/anaconda3/envs/lab/BUILD:962:10: C++ compilation of rule '//:deepmind_lab.so' failed (Exit 1) gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 42 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
python/dmlab_module.c:26:20: fatal error: Python.h: No such file or directory
compilation terminated.
INFO: Elapsed time: 252.799s, Critical Path: 6.01s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
//python/tests:python_module_test.py3                                 NO STATUS
//python/tests:python_module_test.py2                           FAILED TO BUILD

That looks like you haven't configured the build system for your local Python paths correctly. You may need to edit both WORKSPACE and python.BUILD. See https://github.com/deepmind/lab/blob/master/docs/users/build.md#python-dependencies for more information.

@tkoeppe thanks for answering! I have already edited both WORKSPACE and python.BUILD,the problem is actually that the paths of python2 and python3 are different, so the path in WORKSPACE cannot point to both at the same time. I edited the content in the python.BUILD and the problem was solved after deleting the part about python2.

It is possible to configure both Py2 and Py3 at once, but if you don't need that, the your solution sounds fine.

Please reopen if there's anything else.