Skip to content

Test failure when build with libc++ #165

Closed
@oraluben

Description

@oraluben

Hi, I'm trying to build pyosmium with libc++ on Debian and got an interesting failure.
The build was successful but few tests failed with an unexpected exception thrown:

..........................................EE..............E......E.......................................................
======================================================================
ERROR: test_clear (test_index.TestLocationTable)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/pyosmium/test/test_index.py", line 42, in test_clear
    self.table.get(593)
RuntimeError: id 593 not found

You might notice that the error message is correct but not the error class.
I dug around and found this try-catch is not working well: https://github.com/osmcode/pyosmium/blob/master/lib/osmium.cc#L20-L26

I came up with some small PoC, trying to identify the root cause but have no luck. libc++ seems to have no issue work together with libstdc++ and exception.

Could you please take some time to see if you've got any idea about this? I would be greatful since I'm not very familiar with the code itself.

Build script I use in a debian:buster docker image:

apt-get update

apt-get install -y -qq libboost-dev libexpat1-dev zlib1g-dev libbz2-dev libproj-dev libgeos-dev liblz4-dev cmake

apt-get install -y -qq python3-pip git
pip3 install nose shapely setuptools

git clone https://github.com/osmcode/pyosmium.git

cd pyosmium
git clone --quiet --depth 1 https://github.com/osmcode/libosmium.git contrib/libosmium
git clone --quiet --depth 1 https://github.com/mapbox/protozero.git contrib/protozero
git clone --quiet --depth 1 https://github.com/pybind/pybind11.git contrib/pybind11

apt-get install -y libc++1 libc++-dev
# https://libcxx.llvm.org/docs/UsingLibcxx.html
export CXXFLAGS="-nostdinc++ -I/usr/lib/llvm-7/include/c++/v1"
export LDFLAGS="-nodefaultlibs -L/usr/lib/llvm-7/lib -lc++ -lc++abi -lm -lc -lgcc_s -lgcc"
ln -s /usr/lib/llvm-7/lib/libc++abi.so.1 /usr/lib/llvm-7/lib/libc++abi.so

python3 setup.py build
cd test && python3 run_tests.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions