wlav / cppyy

Other
387 stars 39 forks source link

Cannot import cppyy under Mac OS #164

Closed yzhang-23 closed 8 months ago

yzhang-23 commented 1 year ago

I'm trying to use cppyy on my Mac mini M2 pro (Mac OS Ventura 13.3.1). Following the documentation, I ran

python -m pip install cppyy

and then want to test the installation with python, but I got the following error messages (only the top messages are shown):

% python Python 3.11.1 (main, Feb 15 2023, 12:26:07) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import cppyy (Re-)building pre-compiled headers (options: -O2); this may take a minute ... In file included from input_line_10:9: In file included from ./etc/dictpch/allHeaders.h:373: ./include/TClassEdit.h:29:10: fatal error: 'cxxabi.h' file not found

include

     ^~~~~~~~~~

Error: ./bin/rootcling: compilation failure (/var/folders/rc/fl4k257n5qd_385smlp095lh0000gn/T/allDict55c2af541f_dictUmbrella.h) /Users/yzhang/Library/Python/3.11/lib/python/site-packages/cppyy_backend/loader.py:139: UserWarning: No precompiled header available (failed to build); this may impact performance. warnings.warn('No precompiled header available (%s); this may impact performance.' % msg) In file included from libCoreLegacy dictionary payload:7: In file included from /Users/yzhang/Library/Python/3.11/lib/python/site-packages/cppyy_backend/include/Riostream.h:24: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/fstream:192: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/filesystem:938:29: error: constructor for 'std::filesystem::path' must explicitly initialize the member '_pn' which does not have a default constructor _LIBCPP_INLINE_VISIBILITY path() noexcept {} ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/filesystem:1512:15: note: member is declared here string_type _pn; ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:693:5: note: 'std::string' declared here basic_string ^ ...

What could be the reason for these errors? Any hint? Thank you very much!

wlav commented 1 year ago

Same as #150. Unfortunately, I can't reproduce it and have no idea what is causing it. :( In addition, on a normal install, the pre-compiled header should be build as part of the install process, not on first use.

yzhang-23 commented 1 year ago

on a normal install, the pre-compiled header should be build as part of the install process, not on first use.

I was also surprised that the pre-compiled headers were built on first use. Is there a way to build the headers before importing cppyy?

wlav commented 1 year ago

The install process already does that. You should be able to find a .pch file in /Users/yzhang/Library/Python/3.11/lib/python/site-packages/cppyy_backend/etc. But otherwise the process of building the PCH is the same as cppyy uses when it fails to find it.

Alex-EEE commented 1 year ago

Have you tried installing with conda

(WORK) $ conda install -c conda-forge cppyy
(WORK) [current compiler] $

this installs a different compiler, might have better luck

yzhang-23 commented 1 year ago

Have you tried installing with conda

(WORK) $ conda install -c conda-forge cppyy
(WORK) [current compiler] $

this installs a different compiler, might have better luck

I tried to install with conda, but that was for cppyy 2.4.0. Is there a way to install cppyy 3.0.0 with conda?

wlav commented 10 months ago

I'm trying to complete the github workflows that were contributed (https://github.com/wlav/cppyy-backend/pull/8). Although it doesn't run all yet, the building of the Mac wheels does and I'm finding that those wheels do NOT work on my laptop. In a way, that's not good, but it may also help me to get some fixes for upstream as it's the only reliable way that I have to break things on my box.

wlav commented 8 months ago

Should all be good now with release 3.1.0. Feel free to reopen if you find otherwise.