Kautenja / nes-py

A Python3 NES emulator and OpenAI Gym interface
MIT License
235 stars 63 forks source link

Fails to Compile on MacOS (GCC) #55

Closed keenzman closed 5 years ago

keenzman commented 5 years ago

Describe the bug

pip install nes-py failed due to compiling error below:

Requirement already satisfied: gym>=0.10.9 in ./venv/lib/python3.6/site-packages (from nes-py==6.2.1) (0.10.9) Requirement already satisfied: matplotlib>=2.0.2 in ./venv/lib/python3.6/site-packages (from nes-py==6.2.1) (3.0.2) Requirement already satisfied: numpy>=1.12.1 in ./venv/lib/python3.6/site-packages (from nes-py==6.2.1) (1.16.0) Requirement already satisfied: opencv-python>=3.4.0.12 in ./venv/lib/python3.6/site-packages (from nes-py==6.2.1) (4.0.0.21) Requirement already satisfied: pygame>=1.9.3 in ./venv/lib/python3.6/site-packages (from nes-py==6.2.1) (1.9.4) Requirement already satisfied: pyglet>=1.3.2 in ./venv/lib/python3.6/site-packages (from nes-py==6.2.1) (1.3.2) Requirement already satisfied: tqdm>=4.19.5 in ./venv/lib/python3.6/site-packages (from nes-py==6.2.1) (4.30.0) Requirement already satisfied: requests>=2.0 in ./venv/lib/python3.6/site-packages (from gym>=0.10.9->nes-py==6.2.1) (2.21.0) Requirement already satisfied: scipy in ./venv/lib/python3.6/site-packages (from gym>=0.10.9->nes-py==6.2.1) (1.2.0) Requirement already satisfied: six in ./venv/lib/python3.6/site-packages (from gym>=0.10.9->nes-py==6.2.1) (1.12.0) Requirement already satisfied: python-dateutil>=2.1 in ./venv/lib/python3.6/site-packages (from matplotlib>=2.0.2->nes-py==6.2.1) (2.7.5) Requirement already satisfied: kiwisolver>=1.0.1 in ./venv/lib/python3.6/site-packages (from matplotlib>=2.0.2->nes-py==6.2.1) (1.0.1) Requirement already satisfied: cycler>=0.10 in ./venv/lib/python3.6/site-packages (from matplotlib>=2.0.2->nes-py==6.2.1) (0.10.0) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in ./venv/lib/python3.6/site-packages (from matplotlib>=2.0.2->nes-py==6.2.1) (2.3.1) Requirement already satisfied: future in ./venv/lib/python3.6/site-packages (from pyglet>=1.3.2->nes-py==6.2.1) (0.17.1) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./venv/lib/python3.6/site-packages (from requests>=2.0->gym>=0.10.9->nes-py==6.2.1) (3.0.4) Requirement already satisfied: urllib3<1.25,>=1.21.1 in ./venv/lib/python3.6/site-packages (from requests>=2.0->gym>=0.10.9->nes-py==6.2.1) (1.24.1) Requirement already satisfied: idna<2.9,>=2.5 in ./venv/lib/python3.6/site-packages (from requests>=2.0->gym>=0.10.9->nes-py==6.2.1) (2.8) Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.6/site-packages (from requests>=2.0->gym>=0.10.9->nes-py==6.2.1) (2018.11.29) Requirement already satisfied: setuptools in ./venv/lib/python3.6/site-packages (from kiwisolver>=1.0.1->matplotlib>=2.0.2->nes-py==6.2.1) (40.7.1) Installing collected packages: nes-py Running setup.py develop for nes-py Complete output from command /Users/omnidevio/Desktop/gym_mario/venv/bin/python -c "import setuptools, tokenize;file='/Users/omnidevio/Desktop/gym_mario/nes-py/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" develop --no-deps: running develop running egg_info writing nes_py.egg-info/PKG-INFO writing dependency_links to nes_py.egg-info/dependency_links.txt writing entry points to nes_py.egg-info/entry_points.txt writing requirements to nes_py.egg-info/requires.txt writing top-level names to nes_py.egg-info/top_level.txt reading manifest file 'nes_py.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'nes_py.egg-info/SOURCES.txt' running build_ext building 'nes_py.lib_nes_env' extension creating build creating build/temp.macosx-10.7-x86_64-3.6 creating build/temp.macosx-10.7-x86_64-3.6/nes_py creating build/temp.macosx-10.7-x86_64-3.6/nes_py/nes creating build/temp.macosx-10.7-x86_64-3.6/nes_py/nes/src creating build/temp.macosx-10.7-x86_64-3.6/nes_py/nes/src/mappers gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/omnidevio/anaconda3/include -arch x86_64 -I/Users/omnidevio/anaconda3/include -arch x86_64 -Ines_py/nes/include -I/Users/omnidevio/anaconda3/include/python3.6m -c nes_py/nes/src/cartridge.cpp -o build/temp.macosx-10.7-x86_64-3.6/nes_py/nes/src/cartridge.o -std=c++1y -march=native -pipe -O2 nes_py/nes/src/cartridge.cpp:14:19: error: no matching constructor for initialization of 'std::ifstream' (aka 'basic_ifstream') std::ifstream romFile (path, std::ios_base::binary | std::ios_base::in); ^ ~~~~~~~~~~~ /usr/include/c++/4.2.1/fstream:465:7: note: candidate constructor not viable: no known conversion from 'std::string' (aka 'basic_string') to 'const char ' for 1st argument basic_ifstream(const char s, ios_base::openmode __mode = ios_base::in) ^ /usr/include/c++/4.2.1/bits/fstream.tcc:894:25: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided extern template class basic_ifstream; ^ /usr/include/c++/4.2.1/fstream:451:7: note: candidate constructor not viable: requires 0 arguments, but 2 were provided basic_ifstream() : istream_type(), _M_filebuf() ^ 1 error generated. error: command 'gcc' failed with exit status 1

----------------------------------------

Command "/Users/omnidevio/Desktop/gym_mario/venv/bin/python -c "import setuptools, tokenize;file='/Users/omnidevio/Desktop/gym_mario/nes-py/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" develop --no-deps" failed with error code 1 in /Users/omnidevio/Desktop/gym_mario/nes-py/

To Reproduce

Steps to reproduce the behavior:

run pip install nes-py under Mac OS

Expected behavior

successful installation for Mac OS

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

Operating System: MacOS 10.12.6 Python version: 3.6.3

Additional context

Add any other context about the problem here.

Kautenja commented 5 years ago

Odd. Looks like Python is trying to use gcc instead of clang to compile. Do you have the clang compiler installed and linked? gcc is not officially supported nor tested at the moment.

keenzman commented 5 years ago

Issue is now resolved.

Simply update MacOS and make sure you have the latest version of Xcode.

Akhilez commented 3 years ago

Hi. Just making sure, there's no support for arm processors (specifically Apple silicon chips like M1), correct?

Kautenja commented 3 years ago

I've not checked compatibility with Arm platforms (neither R-Pi nor M1) yet and don't have the hardware to test things currently