conda-forge / libcxx-feedstock

A conda-smithy repository for libcxx.
BSD 3-Clause "New" or "Revised" License
2 stars 19 forks source link

more OSX RTTI issues #61

Closed beckermr closed 4 years ago

beckermr commented 4 years ago

Issue: I finally got this test case finished. Interestingly, it now fails completely instead of only partially like last time.

The code is here: https://github.com/beckermr/misc/tree/master/work/pybind11_conda_exceptions The readme has a basic description of how to run the test.

On osx I get (with either the system or the conda compiler)

========================================================================== test session starts ===========================================================================
platform darwin -- Python 3.7.6, pytest-5.4.1, py-1.8.1, pluggy-0.13.0 -- /Users/beckermr/miniconda3/envs/pybind11-test/bin/python
cachedir: .pytest_cache
rootdir: /Users/beckermr/Desktop/misc/work/pybind11_conda_exceptions
collecting ... dyld: loaded: /Users/beckermr/Desktop/misc/work/pybind11_conda_exceptions/exception_test/exceptions.cpython-37m-darwin.so
dyld: loaded: /Users/beckermr/Desktop/misc/work/pybind11_conda_exceptions/tests/testLib.cpython-37m-darwin.so
collected 1 item                                                                                                                                                         

test_exception_catching_python.py::test_exception_catching_python_smoke 
==========
standard throw!
==========
FAILED

================================================================================ FAILURES ================================================================================
__________________________________________________________________ test_exception_catching_python_smoke __________________________________________________________________

    def test_exception_catching_python_smoke():
        with pytest.raises(exception_test.LSSTException):
>           testLib.fail("message1")
E           RuntimeError: message1

test_exception_catching_python.py:9: RuntimeError
======================================================================== short test summary info =========================================================================
FAILED test_exception_catching_python.py::test_exception_catching_python_smoke - RuntimeError: message1
=========================================================================== 1 failed in 0.11s ============================================================================

The runtime error is pybind11 doing its own thing with the uncaught exception in the exception translator block.

On linux, it works fine

========================================================================== test session starts ===========================================================================
platform linux -- Python 3.7.6, pytest-5.4.1, py-1.8.1, pluggy-0.12.0 -- /opt/conda/envs/pybind11-test/bin/python
cachedir: .pytest_cache
rootdir: /root/misc/work/pybind11_conda_exceptions
collected 1 item                                                                                                                                                         

test_exception_catching_python.py::test_exception_catching_python_smoke 
==========
standard throw!
==========

==========
caught
==========
PASSED

=========================================================================== 1 passed in 0.02s ============================================================================
/root/misc/work/pybind11_conda_exceptions


Environment (conda list):

``` $ conda list # packages in environment at /Users/beckermr/miniconda3/envs/pybind11-test: # # Name Version Build Channel appnope 0.1.0 py37hc8dfbb8_1001 conda-forge attrs 19.3.0 py_0 conda-forge backcall 0.1.0 py_0 conda-forge binutils-meta 1.0.4 0 conda-forge c-compiler 1.0.4 h1239861_0 conda-forge ca-certificates 2020.4.5.1 hecc5488_0 conda-forge cctools 927.0.2 h5ba7a2e_4 conda-forge certifi 2020.4.5.1 py37hc8dfbb8_0 conda-forge clang 9.0.0 default_hf57f61e_4 conda-forge clang_osx-64 9.0.0 h22b1bf0_3 conda-forge clangxx 9.0.0 default_hf57f61e_4 conda-forge clangxx_osx-64 9.0.0 h05bbb7f_6 conda-forge compiler-rt 9.0.0 hce3ea14_0 conda-forge/label/broken compilers 1.0.4 0 conda-forge cxx-compiler 1.0.4 h707564b_0 conda-forge decorator 4.4.2 py_0 conda-forge exception-test 0.1.0 dev_0 fortran-compiler 1.0.4 he991be0_0 conda-forge gfortran_impl_osx-64 7.3.0 hf4212f2_2 conda-forge gfortran_osx-64 7.3.0 h22b1bf0_9 conda-forge gmp 6.2.0 h4a8c4bd_2 conda-forge importlib-metadata 1.6.0 py37hc8dfbb8_0 conda-forge importlib_metadata 1.6.0 0 conda-forge ipython 7.13.0 py37hc8dfbb8_2 conda-forge ipython_genutils 0.2.0 py_1 conda-forge isl 0.19 0 conda-forge jedi 0.17.0 py37hc8dfbb8_0 conda-forge ld64 450.3 h3c32e8a_3 conda-forge libcxx 9.0.1 1 conda-forge libffi 3.2.1 h4a8c4bd_1007 conda-forge libgfortran 4.0.0 2 conda-forge libiconv 1.15 h0b31af3_1006 conda-forge libllvm9 9.0.1 h7475705_1 conda-forge llvm-openmp 10.0.0 h28b9765_0 conda-forge more-itertools 8.2.0 py_0 conda-forge mpc 1.1.0 h4160ff4_1007 conda-forge mpfr 4.0.2 h65ac59c_1 conda-forge ncurses 6.1 h0a44026_1002 conda-forge openssl 1.1.1f h0b31af3_0 conda-forge packaging 20.1 py_0 conda-forge parso 0.7.0 pyh9f0ad1d_0 conda-forge pexpect 4.8.0 py37hc8dfbb8_1 conda-forge pickleshare 0.7.5 py37hc8dfbb8_1001 conda-forge pip 20.0.2 py_2 conda-forge pluggy 0.13.0 py37_0 conda-forge prompt-toolkit 3.0.5 py_0 conda-forge ptyprocess 0.6.0 py_1001 conda-forge py 1.8.1 py_0 conda-forge pybind11 2.5.0 py37ha1cc60f_0 conda-forge pygments 2.6.1 py_0 conda-forge pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge pytest 5.4.1 py37hc8dfbb8_0 conda-forge python 3.7.6 h90870a6_5_cpython conda-forge python_abi 3.7 1_cp37m conda-forge readline 8.0 hcfe32e1_0 conda-forge setuptools 46.1.3 py37hc8dfbb8_0 conda-forge six 1.14.0 py_1 conda-forge sqlite 3.30.1 h93121df_0 conda-forge tapi 1000.10.8 ha1b3eb9_4 conda-forge tk 8.6.10 hbbe82c9_0 conda-forge traitlets 4.3.3 py37hc8dfbb8_1 conda-forge wcwidth 0.1.9 pyh9f0ad1d_0 conda-forge wheel 0.34.2 py_1 conda-forge xz 5.2.5 h0b31af3_0 conda-forge zipp 3.1.0 py_0 conda-forge zlib 1.2.11 h0b31af3_1006 conda-forge ```


Details about conda and system ( conda info ):

``` $ conda info active environment : pybind11-test active env location : /Users/beckermr/miniconda3/envs/pybind11-test shell level : 2 user config file : /Users/beckermr/.condarc populated config files : /Users/beckermr/.condarc conda version : 4.8.3 conda-build version : 3.19.2 python version : 3.7.6.final.0 virtual packages : __osx=10.14.6 base environment : /Users/beckermr/miniconda3 (writable) channel URLs : https://conda.anaconda.org/conda-forge/osx-64 https://conda.anaconda.org/conda-forge/noarch https://repo.anaconda.com/pkgs/main/osx-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/osx-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /Users/beckermr/miniconda3/pkgs /Users/beckermr/.conda/pkgs envs directories : /Users/beckermr/miniconda3/envs /Users/beckermr/.conda/envs platform : osx-64 user-agent : conda/4.8.3 requests/2.23.0 CPython/3.7.6 Darwin/18.7.0 OSX/10.14.6 UID:GID : 501:20 netrc file : /Users/beckermr/.netrc offline mode : False ```

cc @isuruf

isuruf commented 4 years ago

It doesn't work with any of the libcxx builds?

beckermr commented 4 years ago

Yup. Not even the OSX system ones. It does work with the linux GCC builds in a docker container, so the code is not wrong. I've tried a bunch of compilation options and cannot get it work.

isuruf commented 4 years ago

How about with system python and system clang?

beckermr commented 4 years ago

Nope. Doesn't work there either. Interestingly, on linux you have to have imported the exception_test module that contains the first pybind11 wrapper for things to work.

This seems to indicate to me that the RTTI info is not propagating properly in clang on OSX. This may not be a conda compiler issue or even an upstream bug. It could very well be that I am building the code wrong.

beckermr commented 4 years ago

This example is working now.