Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed compiling on MacOS with C++17 flags #48

Closed
guyarad opened this issue Nov 26, 2019 · 2 comments · Fixed by #60
Closed

Failed compiling on MacOS with C++17 flags #48

guyarad opened this issue Nov 26, 2019 · 2 comments · Fixed by #60

Comments

@guyarad
Copy link

guyarad commented Nov 26, 2019

When attempting to install the example, the build fails with the error below.
After manually removing the C++17 flag option (I suppose C++14 was selected then) the install was successful. Can you share what I was doing wrong?

System information:
MacOS Mojave 10.14.6
Python 3.8.0
Clang compiler information:
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

╰─$ pip install ./python_example

Processing ./python_example
Requirement already satisfied: pybind11>=2.4 in /Users/guyarad/.pyenv/versions/3.8.0/lib/python3.8/site-packages (from python-example==0.0.1) (2.4.3)
Building wheels for collected packages: python-example
  Building wheel for python-example (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/guyarad/.pyenv/versions/3.8.0/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/gn/h71xdt2s77qd8yx32bp9hhr80000gn/T/pip-req-build-0pg446vd/setup.py'"'"'; __file__='"'"'/private/var/folders/gn/h71xdt2s77qd8yx32bp9hhr80000gn/T/pip-req-build-0pg446vd/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/gn/h71xdt2s77qd8yx32bp9hhr80000gn/T/pip-wheel-f3cb3qjg --python-tag cp38
       cwd: /private/var/folders/gn/h71xdt2s77qd8yx32bp9hhr80000gn/T/pip-req-build-0pg446vd/
  Complete output (38 lines):
  running bdist_wheel
  running build
  running build_ext
  creating var
  creating var/folders
  creating var/folders/gn
  creating var/folders/gn/h71xdt2s77qd8yx32bp9hhr80000gn
  creating var/folders/gn/h71xdt2s77qd8yx32bp9hhr80000gn/T
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/guyarad/.pyenv/versions/3.8.0/include/python3.8 -c /var/folders/gn/h71xdt2s77qd8yx32bp9hhr80000gn/T/tmpm_vh2ear.cpp -o var/folders/gn/h71xdt2s77qd8yx32bp9hhr80000gn/T/tmpm_vh2ear.o -std=c++17
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/guyarad/.pyenv/versions/3.8.0/include/python3.8 -c /var/folders/gn/h71xdt2s77qd8yx32bp9hhr80000gn/T/tmpk1ewzi28.cpp -o var/folders/gn/h71xdt2s77qd8yx32bp9hhr80000gn/T/tmpk1ewzi28.o -fvisibility=hidden
  building 'python_example' extension
  creating build
  creating build/temp.macosx-10.14-x86_64-3.8
  creating build/temp.macosx-10.14-x86_64-3.8/src
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/guyarad/.pyenv/versions/3.8.0/include/python3.8 -I/Users/guyarad/.local/include/python3.8 -I/Users/guyarad/.pyenv/versions/3.8.0/include/python3.8 -c src/main.cpp -o build/temp.macosx-10.14-x86_64-3.8/src/main.o -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO="0.0.1" -std=c++17 -fvisibility=hidden
  In file included from src/main.cpp:1:
  In file included from /Users/guyarad/.pyenv/versions/3.8.0/include/python3.8/pybind11/pybind11.h:44:
  In file included from /Users/guyarad/.pyenv/versions/3.8.0/include/python3.8/pybind11/attr.h:13:
  /Users/guyarad/.pyenv/versions/3.8.0/include/python3.8/pybind11/cast.h:579:34: error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.14 or newer
                          vptr = ::operator new(type->type_size,
                                   ^
  /Users/guyarad/.pyenv/versions/3.8.0/include/python3.8/pybind11/cast.h:579:34: note: if you supply your own aligned allocation functions, use -faligned-allocation to silence this diagnostic
  In file included from src/main.cpp:1:
  /Users/guyarad/.pyenv/versions/3.8.0/include/python3.8/pybind11/pybind11.h:1008:11: error: 'operator delete' is unavailable: introduced in macOS 10.12
          ::operator delete(p, s, std::align_val_t(a));
            ^
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:194:74: note: 'operator delete' has been explicitly marked unavailable here
  _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void  operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
                                                                           ^
  In file included from src/main.cpp:1:
  /Users/guyarad/.pyenv/versions/3.8.0/include/python3.8/pybind11/pybind11.h:1010:11: error: 'operator delete' is unavailable: introduced in macOS 10.12
          ::operator delete(p, s);
            ^
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:177:74: note: 'operator delete' has been explicitly marked unavailable here
  _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void  operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
                                                                           ^
  3 errors generated.
  error: command 'clang' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for python-example
  Running setup.py clean for python-example
Failed to build python-example
@hscspring
Copy link

the same issue.

@ptsmonteiro
Copy link

ptsmonteiro commented Mar 29, 2020

+1

Installing collected packages: python-example

Running setup.py install for python-example ... error
ERROR: Command errored out with exit status 1:
 command: /Users/pedro/Documents/xPython/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/my/365xpvvd2l79lf8rwrztqjp00000gn/T/pip-req-build-cze14bai/setup.py'"'"'; __file__='"'"'/private/var/folders/my/365xpvvd2l79lf8rwrztqjp00000gn/T/pip-req-build-cze14bai/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/my/365xpvvd2l79lf8rwrztqjp00000gn/T/pip-record-06hwp8fg/install-record.txt --single-version-externally-managed --compile --install-headers /Users/pedro/Documents/xPython/venv/include/site/python3.7/python-example
     cwd: /private/var/folders/my/365xpvvd2l79lf8rwrztqjp00000gn/T/pip-req-build-cze14bai/
Complete output (38 lines):
running install
running build
running build_ext
creating var
creating var/folders
creating var/folders/my
creating var/folders/my/365xpvvd2l79lf8rwrztqjp00000gn
creating var/folders/my/365xpvvd2l79lf8rwrztqjp00000gn/T
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/Users/pedro/Documents/xPython/venv/include -I/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c /var/folders/my/365xpvvd2l79lf8rwrztqjp00000gn/T/tmp9980_7ql.cpp -o var/folders/my/365xpvvd2l79lf8rwrztqjp00000gn/T/tmp9980_7ql.o -std=c++17
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/Users/pedro/Documents/xPython/venv/include -I/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c /var/folders/my/365xpvvd2l79lf8rwrztqjp00000gn/T/tmpznk73j7m.cpp -o var/folders/my/365xpvvd2l79lf8rwrztqjp00000gn/T/tmpznk73j7m.o -fvisibility=hidden
building 'python_example' extension
creating build
creating build/temp.macosx-10.15-x86_64-3.7
creating build/temp.macosx-10.15-x86_64-3.7/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/Users/pedro/Documents/xPython/venv/include/site/python3.7 -I/Users/pedro/Documents/xPython/venv/include/site/python3.7 -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/Users/pedro/Documents/xPython/venv/include -I/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/main.cpp -o build/temp.macosx-10.15-x86_64-3.7/src/main.o -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO="0.0.1" -std=c++17 -fvisibility=hidden
In file included from src/main.cpp:1:
In file included from /Users/pedro/Documents/xPython/venv/include/site/python3.7/pybind11/pybind11.h:44:
In file included from /Users/pedro/Documents/xPython/venv/include/site/python3.7/pybind11/attr.h:13:
/Users/pedro/Documents/xPython/venv/include/site/python3.7/pybind11/cast.h:579:34: error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.14 or newer
                        vptr = ::operator new(type->type_size,
                                 ^
/Users/pedro/Documents/xPython/venv/include/site/python3.7/pybind11/cast.h:579:34: note: if you supply your own aligned allocation functions, use -faligned-allocation to silence this diagnostic
In file included from src/main.cpp:1:
/Users/pedro/Documents/xPython/venv/include/site/python3.7/pybind11/pybind11.h:1008:11: error: 'operator delete' is unavailable: introduced in macOS 10.12
        ::operator delete(p, s, std::align_val_t(a));
          ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:208:74: note: 'operator delete' has been explicitly marked unavailable here
_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void  operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
                                                                         ^
In file included from src/main.cpp:1:
/Users/pedro/Documents/xPython/venv/include/site/python3.7/pybind11/pybind11.h:1010:11: error: 'operator delete' is unavailable: introduced in macOS 10.12
        ::operator delete(p, s);
          ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/new:191:74: note: 'operator delete' has been explicitly marked unavailable here
_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void  operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
                                                                         ^
3 errors generated.
error: command 'clang' failed with exit status 1

MacOS Catalina 10.15.3
Python 3.7.7

Apple clang version 11.0.3 (clang-1103.0.32.29)
Target: x86_64-apple-darwin19.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants