Skip to content

Instantly share code, notes, and snippets.

@karthicraghupathi
Created August 14, 2022 17:57
Show Gist options
  • Save karthicraghupathi/e656d3d8ba6e5ea0aae75afc2745bb10 to your computer and use it in GitHub Desktop.
Save karthicraghupathi/e656d3d8ba6e5ea0aae75afc2745bb10 to your computer and use it in GitHub Desktop.
Installing Python 3.6.15 on PopOS / Ubuntu 22.04 via pyenv - Segmentation fault (core dumped) make: *** [Makefile:1102: install] Error 139
--- Include/objimpl.h
+++ Include/objimpl.h
@@ -250,7 +250,7 @@
union _gc_head *gc_prev;
Py_ssize_t gc_refs;
} gc;
- double dummy; /* force worst-case alignment */
+ long double dummy; /* force worst-case alignment */
} PyGC_Head;
extern PyGC_Head *_PyGC_generation0;
--- Objects/obmalloc.c
+++ Objects/obmalloc.c
@@ -643,8 +643,8 @@
*
* You shouldn't change this unless you know what you are doing.
*/
-#define ALIGNMENT 8 /* must be 2^N */
-#define ALIGNMENT_SHIFT 3
+#define ALIGNMENT 16 /* must be 2^N */
+#define ALIGNMENT_SHIFT 4
/* Return the number of bytes in size class I, as a uint. */
#define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT)
@karthicraghupathi
Copy link
Author

karthicraghupathi commented Aug 14, 2022

Based on the question and solution at pyenv/pyenv#1889 (comment).

To use this patch with asdf-python, run the following command:

ASDF_PYTHON_PATCH_URL="https://gist.githubusercontent.com/karthicraghupathi/e656d3d8ba6e5ea0aae75afc2745bb10/raw/6a49770f5a4bc84cbc302b6a1f1e1bd4067d33a4/alignment.patch" \
asdf install python 3.6.15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment