Friday, March 26, 2021

MultiPolygon, MultiLineString, MultiPoint causes Segmentation fault on M1 Macbook Air

I get "Segmentation fault: 11" when I'm trying to create any Multi* geometry on Macbook Air with M1 processor. I guess this related to some underlying library (GDAL, GEOS?), which is not working correctly on new CPU architecture. On Intel Macbook Pro and Ubuntu 20.40 all Multi* geometries work fine. Everything is installed using HomeBrew.

If someone could tell me how to try to reproduce this using lower level libraries, I could could point the bug report to the right party.

How to try this at home (assuming you have M1 Mac):

# Create virtualenv and open a Django shell
cd /tmp/ && python3 -m venv venv multisegfault && source multisegfault/bin/activate && pip install django && django-admin startproject segfaulttest && cd segfaulttest && python manage.py shell

# Copy and paste this one line to the shell:
from django.contrib.gis.geos import MultiLineString; MultiLineString()

Above should print something like this:
Python 3.9.2 (default, Mar 24 2021, 20:21:37)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.gis.geos import LineString, MultiLineString
>>> LineString()
<LineString object at 0x106a02708>
>>> MultiLineString()
Segmentation fault: 11

System and library versions:

Macbook Air (M1, 2020)
macOS Big Sur, version 11.2.3

$ geos-config --version
3.9.1
$ gdal-config --version
3.2.2
$ brew info postgis
postgis: stable 3.1.1

--
Yours, Aapo Rista


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ef06f786-ab36-4d57-a848-8ef1ea08e896n%40googlegroups.com.

No comments:

Post a Comment