tonybaloney / Pyjion

Pyjion - A JIT for Python based upon CoreCLR
https://www.trypyjion.com
MIT License
1.42k stars 59 forks source link

Failed to build on MacOS #21

Closed xqzhou closed 3 years ago

xqzhou commented 3 years ago

Any way to make the build & installation work on Mac?

Building wheels for collected packages: pyjion
  Building wheel for pyjion (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/xq/Workspace/python/pyjion/venv/bin/python /Users/xq/Workspace/python/pyjion/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/9p/ldszvry55lschwkflts79j640000gn/T/tmpciqpk20t
       cwd: /private/var/folders/9p/ldszvry55lschwkflts79j640000gn/T/pip-req-build-ihurkonb
  Complete output (131 lines):
  Not searching for unused variables given on the command line.
  -- The C compiler identification is AppleClang 11.0.0.11000033
  -- 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
  -- The CXX compiler identification is AppleClang 11.0.0.11000033
  -- 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
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /private/var/folders/9p/ldszvry55lschwkflts79j640000gn/T/pip-req-build-ihurkonb/_cmake_test_compile/build
  -- The C compiler identification is AppleClang 11.0.0.11000033
  -- The CXX compiler identification is AppleClang 11.0.0.11000033
  -- 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
  -- Found PythonInterp: /Users/xq/Workspace/python/pyjion/venv/bin/python (found version "3.9")
  -- Found PythonLibs: /Library/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib (found version "3.9.0")
  -- Using Python libraries for skbuild /Library/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib
  -- Using Python headers for skbuild /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9
  -- Using Python libraries /Library/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib
  -- Using Python headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9
  -- Enabling UNIX Patches
  -- Enabling AMD64
  -- Enabling AMD64 ABI
  -- Found .NET 5 in /usr/local/share/dotnet/shared/Microsoft.NETCore.App/5.0.0
  -- Performing Test Weak Link MODULE -> SHARED (gnu_ld_ignore) - Failed
  -- Performing Test Weak Link MODULE -> SHARED (osx_dynamic_lookup) - Success
  _modinit_prefix:PyInit_
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /private/var/folders/9p/ldszvry55lschwkflts79j640000gn/T/pip-req-build-ihurkonb/_skbuild/macosx-10.15-x86_64-3.9/cmake-build
  [1/11] Building CXX object CMakeFiles/pyjionlib.dir/pyjion/jitinit.cpp.o
  [2/11] Building CXX object CMakeFiles/pyjionlib.dir/pyjion/block.cpp.o
  [3/11] Building CXX object CMakeFiles/pyjionlib.dir/pyjion/stack.cpp.o
  [4/11] Building CXX object CMakeFiles/pyjionlib.dir/pyjion/pyjit.cpp.o
  FAILED: CMakeFiles/pyjionlib.dir/pyjion/pyjit.cpp.o
  /Library/Developer/CommandLineTools/usr/bin/c++ -DFEATURE_HW_INTRINSICS -DFEATURE_SIMD -DGIL -DHOST_64BIT -DHOST_AMD64 -DPROFILING_SUPPORTED -DTARGET_64BIT -DTARGET_AMD64 -DTARGET_OSX -DTARGET_UNIX -DUNICODE -DUNIX_AMD64_ABI -DUNIX_AMD64_ABI_ITF -DUSE_STL -D_TARGET_AMD64_ -D_XOPEN_SOURCE -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -I../../../CoreCLR/src/coreclr/src/pal/inc/rt -I../../../CoreCLR/src/coreclr/src/pal/inc -I../../../CoreCLR/src/coreclr/src/pal/prebuilt/inc -I../../../CoreCLR/src/coreclr/src/inc -I../../../CoreCLR/src/coreclr/src/jit -I../../../pyjion/compat -std=c++0x -O3 -DNDEBUG -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.15 -DPAL_STDCPP_COMPAT -fexceptions -fvisibility=hidden -Wno-null-arithmetic -fdeclspec -std=gnu++17 -MD -MT CMakeFiles/pyjionlib.dir/pyjion/pyjit.cpp.o -MF CMakeFiles/pyjionlib.dir/pyjion/pyjit.cpp.o.d -o CMakeFiles/pyjionlib.dir/pyjion/pyjit.cpp.o -c ../../../pyjion/pyjit.cpp
  In file included from ../../../pyjion/pyjit.cpp:27:
  ../../../pyjion/pyjit.h:32:10: fatal error: 'windows.h' file not found
  #include <windows.h>
           ^~~~~~~~~~~
  1 error generated.
  [5/11] Building CXX object CMakeFiles/pyjionlib.dir/pyjion/pycomp.cpp.o
  FAILED: CMakeFiles/pyjionlib.dir/pyjion/pycomp.cpp.o
  /Library/Developer/CommandLineTools/usr/bin/c++ -DFEATURE_HW_INTRINSICS -DFEATURE_SIMD -DGIL -DHOST_64BIT -DHOST_AMD64 -DPROFILING_SUPPORTED -DTARGET_64BIT -DTARGET_AMD64 -DTARGET_OSX -DTARGET_UNIX -DUNICODE -DUNIX_AMD64_ABI -DUNIX_AMD64_ABI_ITF -DUSE_STL -D_TARGET_AMD64_ -D_XOPEN_SOURCE -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -I../../../CoreCLR/src/coreclr/src/pal/inc/rt -I../../../CoreCLR/src/coreclr/src/pal/inc -I../../../CoreCLR/src/coreclr/src/pal/prebuilt/inc -I../../../CoreCLR/src/coreclr/src/inc -I../../../CoreCLR/src/coreclr/src/jit -I../../../pyjion/compat -std=c++0x -O3 -DNDEBUG -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.15 -DPAL_STDCPP_COMPAT -fexceptions -fvisibility=hidden -Wno-null-arithmetic -fdeclspec -std=gnu++17 -MD -MT CMakeFiles/pyjionlib.dir/pyjion/pycomp.cpp.o -MF CMakeFiles/pyjionlib.dir/pyjion/pycomp.cpp.o.d -o CMakeFiles/pyjionlib.dir/pyjion/pycomp.cpp.o -c ../../../pyjion/pycomp.cpp
  ../../../pyjion/pycomp.cpp:27:10: fatal error: 'windows.h' file not found
  #include <windows.h>
           ^~~~~~~~~~~
  1 error generated.
  [6/11] Building CXX object CMakeFiles/pyjionlib.dir/pyjion/exceptionhandling.cpp.o
  [7/11] Building CXX object CMakeFiles/pyjionlib.dir/pyjion/absvalue.cpp.o
  In file included from ../../../pyjion/absvalue.cpp:26:
  ../../../pyjion/absvalue.h:60:13: warning: enumeration values 'AVK_Any' and 'AVK_Undefined' not handled in switch [-Wswitch]
      switch (kind) {
              ^
  ../../../pyjion/absvalue.h:60:13: note: add missing switch cases
      switch (kind) {
              ^
  1 warning generated.
  [8/11] Building CXX object CMakeFiles/pyjionlib.dir/pyjion/intrins.cpp.o
  [9/11] Building CXX object CMakeFiles/pyjionlib.dir/pyjion/absint.cpp.o
  In file included from ../../../pyjion/absint.cpp:33:
  In file included from ../../../pyjion/absint.h:33:
  ../../../pyjion/absvalue.h:60:13: warning: enumeration values 'AVK_Any' and 'AVK_Undefined' not handled in switch [-Wswitch]
      switch (kind) {
              ^
  ../../../pyjion/absvalue.h:60:13: note: add missing switch cases
      switch (kind) {
              ^
  ../../../pyjion/absint.cpp:983:13: warning: enumeration values 'AVK_Any' and 'AVK_Undefined' not handled in switch [-Wswitch]
      switch (kind) {
              ^
  ../../../pyjion/absint.cpp:983:13: note: add missing switch cases
      switch (kind) {
              ^
  2 warnings generated.
  ninja: build stopped: subcommand failed.
    File "/private/var/folders/9p/ldszvry55lschwkflts79j640000gn/T/pip-build-env-kx445ewv/overlay/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 590, in setup
      cmkr.make(make_args, env=env)
    File "/private/var/folders/9p/ldszvry55lschwkflts79j640000gn/T/pip-build-env-kx445ewv/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 496, in make
      raise SKBuildError(

  --------------------------------------------------------------------------------
  -- Trying "Ninja" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "Ninja" generator - success
  --------------------------------------------------------------------------------

  Configuring Project
    Working directory:
      /private/var/folders/9p/ldszvry55lschwkflts79j640000gn/T/pip-req-build-ihurkonb/_skbuild/macosx-10.15-x86_64-3.9/cmake-build
    Command:
      cmake /private/var/folders/9p/ldszvry55lschwkflts79j640000gn/T/pip-req-build-ihurkonb -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/private/var/folders/9p/ldszvry55lschwkflts79j640000gn/T/pip-req-build-ihurkonb/_skbuild/macosx-10.15-x86_64-3.9/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/Users/xq/Workspace/python/pyjion/venv/bin/python -DPYTHON_VERSION_STRING:STRING=3.9.0 -DPYTHON_INCLUDE_DIR:PATH=/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -DPYTHON_LIBRARY:FILEPATH=/Library/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/private/var/folders/9p/ldszvry55lschwkflts79j640000gn/T/pip-build-env-kx445ewv/overlay/lib/python3.9/site-packages/skbuild/resources/cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.15 -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64

  Traceback (most recent call last):

  An error occurred while building with CMake.
    Command:
      cmake --build . --target install --config Release --
    Source directory:
      /private/var/folders/9p/ldszvry55lschwkflts79j640000gn/T/pip-req-build-ihurkonb
    Working directory:
      /private/var/folders/9p/ldszvry55lschwkflts79j640000gn/T/pip-req-build-ihurkonb/_skbuild/macosx-10.15-x86_64-3.9/cmake-build
  Please see CMake's output for more information.
  ----------------------------------------
  ERROR: Failed building wheel for pyjion
Failed to build pyjion
ERROR: Could not build wheels for pyjion which use PEP 517 and cannot be installed directly
xqzhou commented 3 years ago

sorry, forget the --recurse-submodules when cloning the repo. it now builds. But after python -m pip install ., I get the following error:

Python 3.9.0 (v3.9.0:9cf6752276, Oct  5 2020, 11:29:23)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyjion
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/xq/Workspace/python/pyjion/pyjion/__init__.py", line 62, in <module>
    from ._pyjion import *  # NOQA
ModuleNotFoundError: No module named 'pyjion._pyjion'
>>>
oroppas commented 3 years ago

Isn't your current working directory /Users/xq/Workspace/python/pyjion?

tonybaloney commented 3 years ago
xqzhou commented 3 years ago
  • Make sure you don't start the REPL from the root, otherwise when you type import pyjion it'll import the subdirectories, rather than the compiled module

This solved my issue, Thanks. My stupidity.