facebookresearch / nle

The NetHack Learning Environment
Other
939 stars 113 forks source link

warn_unused_result is being redefined on macOS 12.6 #340

Closed k24d closed 1 year ago

k24d commented 1 year ago

🐛 Bug

I tried to install nle on macOS 12.6 but failed with the following error:

    In file included from /Users/k24d/tmp/nle/src/monst.c:6:
    In file included from /Users/k24d/tmp/nle/include/config.h:594:
    In file included from /Users/k24d/tmp/nle/include/global.h:9:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/stdio.h:64:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/_stdio.h:68:
    /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/sys/cdefs.h:302:39: error: too few arguments provided to function-like macro invocation
    #if __has_attribute(warn_unused_result)

I found a similar issue in #297. I commented out the following lines, and now it works.

// nle/include/tradstdc.h

// By deleting these lines, it works.
#define __warn_unused_result__ /*empty*/
#define warn_unused_result /*empty*/

To Reproduce

Steps to reproduce the behavior:

% git clone --recursive https://github.com/facebookresearch/nle.git
Cloning into 'nle'...
...

% cd nle
% pip install -e '.[dev]'
...
  Running setup.py develop for nle
    ERROR: Command errored out with exit status 1:
     command: /opt/miniconda3/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/k24d/tmp/nle/setup.py'"'"'; __file__='"'"'/Users/k24d/tmp/nle/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: /Users/k24d/tmp/nle/
    Complete output (167 lines):
    Building wheel nle-0.8.1+103c667
    running develop
    /private/var/folders/ys/4yy_2g117rs92tcq9nfrswp00000gn/T/pip-build-env-m2bsf_rw/overlay/lib/python3.9/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    /private/var/folders/ys/4yy_2g117rs92tcq9nfrswp00000gn/T/pip-build-env-m2bsf_rw/overlay/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    running egg_info
    creating nle.egg-info
    writing nle.egg-info/PKG-INFO
    writing dependency_links to nle.egg-info/dependency_links.txt
    writing entry points to nle.egg-info/entry_points.txt
    writing requirements to nle.egg-info/requires.txt
    writing top-level names to nle.egg-info/top_level.txt
    writing manifest file 'nle.egg-info/SOURCES.txt'
    reading manifest file 'nle.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no previously-included files matching '*' found under directory 'build'
    warning: no previously-included files found matching 'nle/dashboard'
    warning: no previously-included files found matching 'nle/scripts/nh-clean-install.sh'
    warning: no previously-included files found matching 'nle/scripts/line-changed.sh'
    adding license file 'LICENSE'
    writing manifest file 'nle.egg-info/SOURCES.txt'
    running build_ext
    -- The C compiler identification is AppleClang 14.0.0.14000029
    -- The CXX compiler identification is AppleClang 14.0.0.14000029
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    Release build.
    -- Building nle backend version: 0.8.1
    -- HACKDIR set to: /Users/k24d/tmp/nle/nle/nethackdir
    Seeding enabled.
    -- The ASM compiler identification is Clang with GNU-like command-line
    -- Found assembler: /Library/Developer/CommandLineTools/usr/bin/cc
    -- pybind11 v2.6.2
    CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.24.2/share/cmake/Modules/CMakeDependentOption.cmake:89 (message):
      Policy CMP0127 is not set: cmake_dependent_option() supports full Condition
      Syntax.  Run "cmake --help-policy CMP0127" for policy details.  Use the
      cmake_policy command to set the policy and suppress this warning.
    Call Stack (most recent call first):
      third_party/pybind11/CMakeLists.txt:98 (cmake_dependent_option)
    This warning is for project developers.  Use -Wno-dev to suppress it.

    -- Found PythonInterp: /opt/miniconda3/bin/python (found version "3.9.12")
    -- Found PythonLibs: /opt/miniconda3/lib
    -- Performing Test HAS_FLTO
    -- Performing Test HAS_FLTO - Success
    -- Performing Test HAS_FLTO_THIN
    -- Performing Test HAS_FLTO_THIN - Success
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/k24d/tmp/nle/build/temp.macosx-11.1-arm64-cpython-39
    Scanning dependencies of target fcontext
    [  1%] Building C object util/CMakeFiles/makedefs.dir/makedefs.c.o
    [  1%] Building C object util/CMakeFiles/recover.dir/recover.c.o
    [  1%] Building C object util/CMakeFiles/dlb.dir/dlb_main.c.o
    [  1%] Building C object util/CMakeFiles/makedefs.dir/__/src/monst.c.o
    [  1%] Building C object CMakeFiles/tmt.dir/third_party/libtmt/tmt.c.o
    [  1%] Building C object CMakeFiles/nethackdl.dir/sys/unix/nledl.c.o
    [  2%] Building C object util/CMakeFiles/makedefs.dir/__/src/objects.c.o
    [  3%] Building C object third_party/deboost.context/CMakeFiles/fcontext.dir/source/stack.c.o
    [  4%] Building C object util/CMakeFiles/dlb.dir/__/src/dlb.c.o
    [  4%] Building C object util/CMakeFiles/dlb.dir/panic.c.o
    [  5%] Building ASM object third_party/deboost.context/CMakeFiles/fcontext.dir/asm/make_combined_all_macho_gas.S.o
    [  5%] Building C object util/CMakeFiles/dlb.dir/__/src/alloc.c.o
    [  6%] Building ASM object third_party/deboost.context/CMakeFiles/fcontext.dir/asm/jump_combined_all_macho_gas.S.o
    [  6%] Building ASM object third_party/deboost.context/CMakeFiles/fcontext.dir/asm/ontop_combined_all_macho_gas.S.o
    In file included from /Users/k24d/tmp/nle/src/monst.c:6:
    In file included from /Users/k24d/tmp/nle/include/config.h:594:
    In file included from /Users/k24d/tmp/nle/include/global.h:9:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/stdio.h:64:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/_stdio.h:68:
    /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/sys/cdefs.h:302:39: error: too few arguments provided to function-like macro invocation
    #if __has_attribute(warn_unused_result)
                                          ^
    In file included from /Users/k24d/tmp/nle/util/recover.c:15:
    In file included from /Users/k24d/tmp/nle/include/config.h:594:
    In file included from /Users/k24d/tmp/nle/include/global.h:9:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/stdio.h:64:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/_stdio.h:68:
    /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/sys/cdefs.h:302:39: error: too few arguments provided to function-like macro invocation
    #if __has_attribute(warn_unused_result)
                                          ^
    In file included from /Users/k24d/tmp/nle/util/dlb_main.c:8:
    In file included from /Users/k24d/tmp/nle/include/config.h:594:
    In file included from /Users/k24d/tmp/nle/include/global.h:9:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/stdio.h:64:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/_stdio.h:68:
    /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/sys/cdefs.h:302:39: error: too few arguments provided to function-like macro invocation
    #if __has_attribute(warn_unused_result)
                                          ^
    In file included from /Users/k24d/tmp/nle/util/makedefs.c:11:
    In file included from /Users/k24d/tmp/nle/include/config.h:594:
    In file included from /Users/k24d/tmp/nle/include/global.h:9:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/stdio.h:64:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/_stdio.h:68:
    /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/sys/cdefs.h:302:39: error: too few arguments provided to function-like macro invocation
    #if __has_attribute(warn_unused_result)
                                          ^
    In file included from /Users/k24d/tmp/nle/src/objects.c:35:
    In file included from /Users/k24d/tmp/nle/include/config.h:594:
    In file included from /Users/k24d/tmp/nle/include/global.h:9:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/stdio.h:64:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/_stdio.h:68:
    /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/sys/cdefs.h:302:39: error: too few arguments provided to function-like macro invocation
    #if __has_attribute(warn_unused_result)
                                          ^
    1 error generated.
    1 error generated.
    make[2]: *** [util/CMakeFiles/recover.dir/recover.c.o] Error 1
    make[1]: *** [util/CMakeFiles/recover.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    make[2]: *** [util/CMakeFiles/dlb.dir/dlb_main.c.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    1 error generated.
    In file included from /Users/k24d/tmp/nle/src/dlb.c:5:
    In file included from /Users/k24d/tmp/nle/include/config.h:594:
    In file included from /Users/k24d/tmp/nle/include/global.h:9:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/stdio.h:64:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/_stdio.h:68:
    /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/sys/cdefs.h:302:39: error: too few arguments provided to function-like macro invocation
    #if __has_attribute(warn_unused_result)
                                          ^
    [  7%] Linking C static library libnethackdl.a
    In file included from /Users/k24d/tmp/nle/util/panic.c:12:
    In file included from /Users/k24d/tmp/nle/include/config.h:594:
    In file included from /Users/k24d/tmp/nle/include/global.h:9:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/stdio.h:64:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/_stdio.h:68:
    /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/sys/cdefs.h:302:39: error: too few arguments provided to function-like macro invocation
    #if __has_attribute(warn_unused_result)
                                          ^
    make[2]: *** [util/CMakeFiles/makedefs.dir/makedefs.c.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    1 error generated.
    1 error generated.
    In file included from /Users/k24d/tmp/nle/src/alloc.c:11:
    In file included from /Users/k24d/tmp/nle/include/config.h:594:
    In file included from /Users/k24d/tmp/nle/include/global.h:9:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/stdio.h:64:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/_stdio.h:68:
    /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/sys/cdefs.h:302:39: error: too few arguments provided to function-like macro invocation
    #if __has_attribute(warn_unused_result)
                                          ^
    make[2]: *** [util/CMakeFiles/dlb.dir/__/src/dlb.c.o] Error 1
    1 error generated.
    make[2]: *** [util/CMakeFiles/dlb.dir/panic.c.o] Error 1
    make[2]: *** [util/CMakeFiles/makedefs.dir/__/src/monst.c.o] Error 1
    1 error generated.
    1 error generated.
    make[2]: *** [util/CMakeFiles/dlb.dir/__/src/alloc.c.o] Error 1
    make[2]: *** [util/CMakeFiles/makedefs.dir/__/src/objects.c.o] Error 1
    make[1]: *** [util/CMakeFiles/dlb.dir/all] Error 2
    make[1]: *** [util/CMakeFiles/makedefs.dir/all] Error 2
    [  8%] Linking C static library libfcontext.a
    [  8%] Built target nethackdl
    [  8%] Built target fcontext
    [  9%] Linking C static library libtmt.a
    [  9%] Built target tmt
    make: *** [all] Error 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: /opt/miniconda3/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/k24d/tmp/nle/setup.py'"'"'; __file__='"'"'/Users/k24d/tmp/nle/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

Environment

cdmatters commented 1 year ago

Thanks for opening this bug! Will look into it and revert! :)