I have been trying to install pyv8 on my mac (BigSur, M1 Mac) inside a conda environemnt. After spending a whole day resolving dependencies, I got stuck at what seems like a GCC compilation failure. I have attached the log below, can someone help me figure this out?
The previous errors I faced before this was v8.h not found. I resolved them by moving entirely to conda for my python setup, created a fresh environment with python3.8 and installed boost and libv8 using conda-forge.
> pip install pyv8
Collecting pyv8
Using cached PyV8-0.5.zip (22 kB)
Building wheels for collected packages: pyv8
Building wheel for pyv8 (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/anaconda3/envs/r_app/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ds/s560l9211jjcmtngt3mjx91w0000gp/T/pip-install-0gsn8ct1/pyv8_4bed40de7c494760a0da210c69a5782d/setup.py'"'"'; __file__='"'"'/private/var/folders/ds/s560l9211jjcmtngt3mjx91w0000gp/T/pip-install-0gsn8ct1/pyv8_4bed40de7c494760a0da210c69a5782d/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/ds/s560l9211jjcmtngt3mjx91w0000gp/T/pip-wheel-6sf_oi7w
cwd: /private/var/folders/ds/s560l9211jjcmtngt3mjx91w0000gp/T/pip-install-0gsn8ct1/pyv8_4bed40de7c494760a0da210c69a5782d/
Complete output (120 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.8
copying PyV8.py -> build/lib.macosx-10.9-x86_64-3.8
running build_ext
building '_PyV8' extension
creating build/temp.macosx-10.9-x86_64-3.8
creating build/temp.macosx-10.9-x86_64-3.8/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/anaconda3/envs/r_app/include -arch x86_64 -I/usr/local/anaconda3/envs/r_app/include -arch x86_64 -DBOOST_PYTHON_STATIC_LIB -Ilib/python/inc -Ilib/boost/inc -Ilib/v8/inc -I/usr/local/anaconda3/envs/r_app/include/python3.8 -c src/Exception.cpp -o build/temp.macosx-10.9-x86_64-3.8/src/Exception.o
In file included from src/Exception.cpp:1:
In file included from src/Exception.h:6:
In file included from /usr/local/anaconda3/envs/r_app/include/v8.h:29:
/usr/local/anaconda3/envs/r_app/include/cppgc/common.h:14:6: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]
enum class EmbedderStackState {
^
In file included from src/Exception.cpp:1:
In file included from src/Exception.h:6:
In file included from /usr/local/anaconda3/envs/r_app/include/v8.h:30:
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:51:1: error: unknown type name 'constexpr'
constexpr intptr_t kIntptrAllBitsSet = intptr_t{-1};
^
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:51:19: error: expected ';' after top level declarator
constexpr intptr_t kIntptrAllBitsSet = intptr_t{-1};
^
;
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:52:1: error: unknown type name 'constexpr'
constexpr uintptr_t kUintptrAllBitsSet =
^
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:52:20: error: expected ';' after top level declarator
constexpr uintptr_t kUintptrAllBitsSet =
^
;
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:60:10: error: unknown type name 'constexpr'
static constexpr intptr_t kSmiMinValue =
^
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:60:28: error: expected ';' at end of declaration list
static constexpr intptr_t kSmiMinValue =
^
;
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:62:10: error: unknown type name 'constexpr'
static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1);
^
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:62:28: error: expected ';' at end of declaration list
static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1);
^
;
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:69:20: error: unknown type name 'constexpr'
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
^
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:69:46: error: unknown type name 'intptr_t'; did you mean '::intptr_t'?
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
^~~~~~~~
::intptr_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_intptr_t.h:32:33: note: '::intptr_t' declared here
typedef __darwin_intptr_t intptr_t;
^
In file included from src/Exception.cpp:1:
In file included from src/Exception.h:6:
In file included from /usr/local/anaconda3/envs/r_app/include/v8.h:30:
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:73:25: error: unknown type name 'uintptr_t'; did you mean '::uintptr_t'?
return (static_cast<uintptr_t>(value) -
^~~~~~~~~
::uintptr_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uintptr_t.h:30:33: note: '::uintptr_t' declared here
typedef unsigned long uintptr_t;
^
In file included from src/Exception.cpp:1:
In file included from src/Exception.h:6:
In file included from /usr/local/anaconda3/envs/r_app/include/v8.h:30:
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:74:25: error: unknown type name 'uintptr_t'; did you mean '::uintptr_t'?
static_cast<uintptr_t>(kSmiMinValue)) <=
^~~~~~~~~
::uintptr_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uintptr_t.h:30:33: note: '::uintptr_t' declared here
typedef unsigned long uintptr_t;
^
In file included from src/Exception.cpp:1:
In file included from src/Exception.h:6:
In file included from /usr/local/anaconda3/envs/r_app/include/v8.h:30:
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:75:25: error: unknown type name 'uintptr_t'; did you mean '::uintptr_t'?
(static_cast<uintptr_t>(kSmiMaxValue) -
^~~~~~~~~
::uintptr_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uintptr_t.h:30:33: note: '::uintptr_t' declared here
typedef unsigned long uintptr_t;
^
In file included from src/Exception.cpp:1:
In file included from src/Exception.h:6:
In file included from /usr/local/anaconda3/envs/r_app/include/v8.h:30:
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:76:25: error: unknown type name 'uintptr_t'; did you mean '::uintptr_t'?
static_cast<uintptr_t>(kSmiMinValue));
^~~~~~~~~
::uintptr_t
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uintptr_t.h:30:33: note: '::uintptr_t' declared here
typedef unsigned long uintptr_t;
^
In file included from src/Exception.cpp:1:
In file included from src/Exception.h:6:
In file included from /usr/local/anaconda3/envs/r_app/include/v8.h:30:
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:74:36: error: use of undeclared identifier 'kSmiMinValue'
static_cast<uintptr_t>(kSmiMinValue)) <=
^
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:75:36: error: use of undeclared identifier 'kSmiMaxValue'
(static_cast<uintptr_t>(kSmiMaxValue) -
^
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:76:36: error: use of undeclared identifier 'kSmiMinValue'
static_cast<uintptr_t>(kSmiMinValue));
^
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:85:10: error: unknown type name 'constexpr'
static constexpr intptr_t kSmiMinValue =
^
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:85:28: error: expected ';' at end of declaration list
static constexpr intptr_t kSmiMinValue =
^
;
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pyv8
Running setup.py clean for pyv8
Failed to build pyv8
Installing collected packages: pyv8
Running setup.py install for pyv8 ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/anaconda3/envs/r_app/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ds/s560l9211jjcmtngt3mjx91w0000gp/T/pip-install-0gsn8ct1/pyv8_4bed40de7c494760a0da210c69a5782d/setup.py'"'"'; __file__='"'"'/private/var/folders/ds/s560l9211jjcmtngt3mjx91w0000gp/T/pip-install-0gsn8ct1/pyv8_4bed40de7c494760a0da210c69a5782d/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ds/s560l9211jjcmtngt3mjx91w0000gp/T/pip-record-mu0oxv49/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/anaconda3/envs/r_app/include/python3.8/pyv8
cwd: /private/var/folders/ds/s560l9211jjcmtngt3mjx91w0000gp/T/pip-install-0gsn8ct1/pyv8_4bed40de7c494760a0da210c69a5782d/
Complete output (120 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.8
copying PyV8.py -> build/lib.macosx-10.9-x86_64-3.8
running build_ext
building '_PyV8' extension
creating build/temp.macosx-10.9-x86_64-3.8
creating build/temp.macosx-10.9-x86_64-3.8/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/anaconda3/envs/r_app/include -arch x86_64 -I/usr/local/anaconda3/envs/r_app/include -arch x86_64 -DBOOST_PYTHON_STATIC_LIB -Ilib/python/inc -Ilib/boost/inc -Ilib/v8/inc -I/usr/local/anaconda3/envs/r_app/include/python3.8 -c src/Exception.cpp -o build/temp.macosx-10.9-x86_64-3.8/src/Exception.o
In file included from src/Exception.cpp:1:
In file included from src/Exception.h:6:
In file included from /usr/local/anaconda3/envs/r_app/include/v8.h:29:
/usr/local/anaconda3/envs/r_app/include/cppgc/common.h:14:6: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]
enum class EmbedderStackState {
^
In file included from src/Exception.cpp:1:
In file included from src/Exception.h:6:
In file included from /usr/local/anaconda3/envs/r_app/include/v8.h:30:
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:51:1: error: unknown type name 'constexpr'
constexpr intptr_t kIntptrAllBitsSet = intptr_t{-1};
^
/usr/local/anaconda3/envs/r_app/include/v8-internal.h:51:19: error: expected ';' a
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…