Nuitka: macOS: Segfault on module import when using macos

Created on 20 Nov 2019  Â·  27Comments  Â·  Source: Nuitka/Nuitka

  • Tested with Nuitka 0.6.5 and 0.6.6rc7 and Python 3.6.9, 3.7.4 and 3.7.5
  • Python version managed by miniconda, rest (primarily Nuitka) managed through a pip -m venv virtual environment.
  • macOS 1.14.6 (a coworker just tried macos 1.15.x, same problem)

Minimal example:

Directory mod containing empty __init__.py file. Nuitika run from mod's parent directory. Afterwards, the mod.so file is moved to different directory where I try to import it.

Same example works fine when running it in a ubuntu:18.04 docker container.

Nuitka run:

(.venv)  % python3 -m nuitka --show-scons --unstripped --debugger --show-modules --module mod
Nuitka:INFO:Included compiled module 'mod'.
Scons command: [...]/.venv/bin/python3 -W ignore [...]/.venv/lib/python3.7/site-packages/nuitka/build/inline_copy/bin/scons.py -f [...]/.venv/lib/python3.7/site-packages/nuitka/build/SingleExe.scons --jobs 8 --warn=no-deprecated --no-site-dir --debug=explain name=mod result_name=mod source_dir=mod.build debug_mode=true python_debug=false unstripped_mode=true module_mode=true full_compat=false experimental= trace_mode=false python_version=3.7 target_arch=x86_64 python_prefix=/usr/local/miniconda3 nuitka_src=[...]/.venv/lib/python3.7/site-packages/nuitka/build nuitka_cache=[...]/Library/Caches/Nuitka module_count=2 show_scons=true abiflags=m
scons: Reading SConscript files ...
Scons: Tools= ['default']
Scons: CC 'gcc' version check:
Scons: CC 'gcc' version check gives '4.2.1' from '4.2.1'
Scons: CC 'cc' version check:
Scons: CC 'cc' version check gives '11.0.0' from 'Apple clang version 11.0.0 (clang-1100.0.33.12)'
Scons: CC 'g++' version check:
Scons: CC 'g++' version check gives '4.2.1' from '4.2.1'
Scons: Initial CC: gcc
Scons: Initial CCVERSION: 4.2.1
Scons: Initial CXX: g++
Scons: Initial CXXVERSION: 4.2.1
Scons: Picked compiler: clang
Scons: Picked name: clang
Scons: Using C11 mode: True
Scons: Compiler used /usr/bin/clang 
Scons: Using resource mode: code
Scons: Told to run compilation on 8 CPUs.
Scons: Launching target: ['mod.so']
scons: done reading SConscript files.
scons: Building targets ...
scons: building `mod.build/module.mod.os' because it doesn't exist
clang -o mod.build/module.mod.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/module.mod.c
scons: building `mod.build/__constants_data.os' because it doesn't exist
clang -o mod.build/__constants_data.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/__constants_data.c
scons: building `mod.build/__constants.os' because it doesn't exist
clang -o mod.build/__constants.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/__constants.c
scons: building `mod.build/__helpers.os' because it doesn't exist
clang -o mod.build/__helpers.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/__helpers.c
scons: building `mod.build/__frozen.os' because it doesn't exist
clang -o mod.build/__frozen.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/__frozen.c
scons: building `mod.build/CompiledCellType.os' because it doesn't exist
clang -o mod.build/CompiledCellType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/CompiledCellType.c
scons: building `mod.build/CompiledFunctionType.os' because it doesn't exist
clang -o mod.build/CompiledFunctionType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/CompiledFunctionType.c
scons: building `mod.build/CompiledMethodType.os' because it doesn't exist
clang -o mod.build/CompiledMethodType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/CompiledMethodType.c
scons: building `mod.build/CompiledGeneratorType.os' because it doesn't exist
clang -o mod.build/CompiledGeneratorType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/CompiledGeneratorType.c
scons: building `mod.build/CompiledCoroutineType.os' because it doesn't exist
clang -o mod.build/CompiledCoroutineType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/CompiledCoroutineType.c
scons: building `mod.build/CompiledAsyncgenType.os' because it doesn't exist
clang -o mod.build/CompiledAsyncgenType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/CompiledAsyncgenType.c
scons: building `mod.build/CompiledFrameType.os' because it doesn't exist
clang -o mod.build/CompiledFrameType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/CompiledFrameType.c
scons: building `mod.build/CompiledCodeHelpers.os' because it doesn't exist
clang -o mod.build/CompiledCodeHelpers.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/CompiledCodeHelpers.c
scons: building `mod.build/InspectPatcher.os' because it doesn't exist
clang -o mod.build/InspectPatcher.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/InspectPatcher.c
scons: building `mod.build/MetaPathBasedLoader.os' because it doesn't exist
clang -o mod.build/MetaPathBasedLoader.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/include/python3.7m -I/usr/local/miniconda3/PC -Imod.build -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/include -I[...]/.venv/lib/python3.7/site-packages/nuitka/build/static_src mod.build/MetaPathBasedLoader.c
mscons: building `mod.so' because it doesn't exist
clang -o mod.so -dynamiclib mod.build/module.mod.os mod.build/__constants_data.os mod.build/__constants.os mod.build/__helpers.os mod.build/__frozen.os mod.build/CompiledCellType.os mod.build/CompiledFunctionType.os mod.build/CompiledMethodType.os mod.build/CompiledGeneratorType.os mod.build/CompiledCoroutineType.os mod.build/CompiledAsyncgenType.os mod.build/CompiledFrameType.os mod.build/CompiledCodeHelpers.os mod.build/InspectPatcher.os mod.build/MetaPathBasedLoader.os -L/usr/local/miniconda3/lib -lm -lpython3.7m
scons: done building targets.

Error:

(.venv)  % python -q -X faulthandler 
>>> import mod
Fatal Python error: Segmentation fault

Current thread 0x00000001088b85c0 (most recent call first):
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1043 in create_module
  File "<frozen importlib._bootstrap>", line 583 in module_from_spec
  File "<frozen importlib._bootstrap>", line 670 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 983 in _find_and_load
  File "<stdin>", line 1 in <module>
[1]    21766 segmentation fault  python -q -X faulthandler

Expectation (which works when directly importing the empty module):

(.venv)  % python
Python 3.7.4 (default, Aug 13 2019, 15:17:50) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mod
>>> 
bug

Most helpful comment

Ok, this is all about macOS by default not lazy linking symbols, which is why I made an exception for macOS to link the shared library, apparently thinking it was needed, and with platform python, you get away with it, as with many linux forms of Python, however not with Anaconda.

Also, it's wrong, extension modules are not supposed to do that. So this is fixed now on factory, where I finish up a few packaging tweaks before I can release.

Check this out or wait for the pre-release with it http://nuitka.net/doc/factory.html

With that Anaconda 3.6 and 3.7 on macOS are working. Going to try 3.8 soon, but I expect it to be OK as well.

All 27 comments

There was a corruption bug, that seemed to show more often on macOS, and was resolved for 0.6.6, this probably was it, let me know if that is not true.

Problem still exists, original description still holds.

Context:

$ python3 -m nuitka --version
0.6.6
Python: 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 13:42:17) 
Executable: [...]/.venv/bin/python3
OS: Darwin
Arch: x86_64

@kayhayen -- this issue still persists. Are you re-opening this or is it a wont-fix?

@ahoereth Can you see if you can get --debugger to work? If so, please send us the output.

Above output was generated from running nuitka with --debugger flag

python3 -m nuitka --show-scons --unstripped --debugger --show-modules --module mod

Here with --debug flag instead. I am not quite sure what you are looking for?

(.venv)  % python3 -m nuitka --show-scons --unstripped --debug --show-modules --module mod
Nuitka:INFO:Included compiled module 'mod'.
Scons command: /usr/local/bin/scons -f [...]/lib/python3.6/site-packages/nuitka/build/SingleExe.scons --jobs 8 --warn=no-deprecated --no-site-dir --debug=explain name=mod result_name=mod source_dir=mod.build debug_mode=true python_debug=false unstripped_mode=true module_mode=true full_compat=false experimental= trace_mode=false python_version=3.6 target_arch=x86_64 python_prefix=/usr/local/miniconda3/envs/py36 nuitka_src=[...]/lib/python3.6/site-packages/nuitka/build nuitka_cache=[...]/Library/Caches/Nuitka module_count=2 show_scons=true abiflags=m
scons: Reading SConscript files ...
Scons: Tools= ['default']
Scons: CC 'gcc' version check:
Scons: CC 'gcc' version check gives '4.2.1' from '4.2.1'
Scons: CC 'cc' version check:
Scons: CC 'cc' version check gives '11.0.0' from 'Apple clang version 11.0.0 (clang-1100.0.33.16)'
Scons: CC 'g++' version check:
Scons: CC 'g++' version check gives '4.2.1' from '4.2.1'
Scons: Initial CC: gcc
Scons: Initial CCVERSION: 4.2.1
Scons: Initial CXX: g++
Scons: Initial CXXVERSION: 4.2.1
Scons: Picked compiler: clang
Scons: Picked name: clang
Scons: Using C11 mode: True
Scons: Compiler used /usr/bin/clang 
Scons: Using resource mode: code
Scons: Told to run compilation on 8 CPUs.
Scons: Launching target: ['mod.so']
scons: done reading SConscript files.
scons: Building targets ...
scons: building `mod.build/__constants.os' because it doesn't exist
clang -o mod.build/__constants.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/__constants.c
scons: building `mod.build/__constants_data.os' because it doesn't exist
clang -o mod.build/__constants_data.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/__constants_data.c
scons: building `mod.build/__frozen.os' because it doesn't exist
clang -o mod.build/__frozen.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/__frozen.c
scons: building `mod.build/__helpers.os' because it doesn't exist
clang -o mod.build/__helpers.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/__helpers.c
scons: building `mod.build/module.mod.os' because it doesn't exist
clang -o mod.build/module.mod.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/module.mod.c
scons: building `mod.build/CompiledCellType.os' because it doesn't exist
clang -o mod.build/CompiledCellType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/CompiledCellType.c
scons: building `mod.build/CompiledFunctionType.os' because it doesn't exist
clang -o mod.build/CompiledFunctionType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/CompiledFunctionType.c
scons: building `mod.build/CompiledMethodType.os' because it doesn't exist
clang -o mod.build/CompiledMethodType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/CompiledMethodType.c
scons: building `mod.build/CompiledGeneratorType.os' because it doesn't exist
clang -o mod.build/CompiledGeneratorType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/CompiledGeneratorType.c
scons: building `mod.build/CompiledCoroutineType.os' because it doesn't exist
clang -o mod.build/CompiledCoroutineType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/CompiledCoroutineType.c
scons: building `mod.build/CompiledAsyncgenType.os' because it doesn't exist
clang -o mod.build/CompiledAsyncgenType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/CompiledAsyncgenType.c
scons: building `mod.build/CompiledFrameType.os' because it doesn't exist
clang -o mod.build/CompiledFrameType.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/CompiledFrameType.c
scons: building `mod.build/CompiledCodeHelpers.os' because it doesn't exist
clang -o mod.build/CompiledCodeHelpers.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/CompiledCodeHelpers.c
scons: building `mod.build/InspectPatcher.os' because it doesn't exist
clang -o mod.build/InspectPatcher.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/InspectPatcher.c
scons: building `mod.build/MetaPathBasedLoader.os' because it doesn't exist
clang -o mod.build/MetaPathBasedLoader.os -c -fvisibility=hidden -std=c11 -fwrapv -w -fvisibility=hidden -fvisibility-inlines-hidden -Wunused-but-set-variable -Wall -Werror -Wno-error=strict-aliasing -Wno-strict-aliasing -Wno-error=format -Wno-format -g -O2 -pipe -fPIC -D_XOPEN_SOURCE -D_NUITKA_SYSFLAG_BYTES_WARNING=0 -D_NUITKA_SYSFLAG_NO_SITE=0 -D_NUITKA_SYSFLAG_VERBOSE=0 -D_NUITKA_SYSFLAG_UTF8=0 -D_NUITKA_SYSFLAG_OPTIMIZE=0 -D_NUITKA_FROZEN=0 -D_NUITKA_MODULE_COUNT=2 -D_NUITKA_MODULE -I/usr/local/miniconda3/envs/py36/include/python3.6m -I/usr/local/miniconda3/envs/py36/PC -Imod.build -I[...]/lib/python3.6/site-packages/nuitka/build/include -I[...]/lib/python3.6/site-packages/nuitka/build/static_src mod.build/MetaPathBasedLoader.c
scons: building `mod.so' because it doesn't exist
clang -o mod.so -dynamiclib mod.build/__constants.os mod.build/__constants_data.os mod.build/__frozen.os mod.build/__helpers.os mod.build/module.mod.os mod.build/CompiledCellType.os mod.build/CompiledFunctionType.os mod.build/CompiledMethodType.os mod.build/CompiledGeneratorType.os mod.build/CompiledCoroutineType.os mod.build/CompiledAsyncgenType.os mod.build/CompiledFrameType.os mod.build/CompiledCodeHelpers.os mod.build/InspectPatcher.os mod.build/MetaPathBasedLoader.os -L/usr/local/miniconda3/envs/py36/lib -lm -lpython3.6m
scons: done building targets.
(.venv)  % python -q -X faulthandler     
>>> import mod
Fatal Python error: Segmentation fault

Current thread 0x0000000104abb5c0 (most recent call first):
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 922 in create_module
  File "<frozen importlib._bootstrap>", line 571 in module_from_spec
  File "<frozen importlib._bootstrap>", line 658 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 955 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 971 in _find_and_load
  File "<stdin>", line 1 in <module>
[1]    96223 segmentation fault  python -q -X faulthandler

I am looking for the C traceback that gdb would give you. I didn't see it though. what you issue was there, no output in comment "above" that statement.

How can I get the gdb output when importing the module in python?

Did you try --run --module --debugger` at compile time? Nuitka is supposed to the trick for you.

Otherwise
gdb python
run # gdb prompt
where # stack trace output

Should work normally and point you to the segfaulting line and its call stack. Not sure if macOS works there, that is why I was wondering if it works.

Yours,
Kay

Any resolution to this? I'm seeing very similar behavior. I've tried every combination of python env, version (conda, pip, tar.gz on website and GitHub repo) but I get seg fault when trying to load a very simple hello.py script (just a simple import and print statement)

Sadly, no. I wasn’t able to get gdb to work with python on Mac yet.

My one success is using a 'framework' python on mac for nuitka build and
loading with the same python. If I use a conda python then I get seg faults
no matter the version or source of Nuitka.
Dr. Scott W Sides
(303) 718-7028

On Mon, Jan 6, 2020 at 12:49 PM ahoereth notifications@github.com wrote:

Sadly, no. I wasn’t able to get gdb to work with python on Mac yet.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Nuitka/Nuitka/issues/574?email_source=notifications&email_token=ADHTEK6L2M7JHV2TDJRAPHDQ4ODNDA5CNFSM4JPSUSKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIGSINA#issuecomment-571286580,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADHTEK323PS2ZLD3N5QAIATQ4ODNDANCNFSM4JPSUSKA
.

The Anaconda versions works in the Github actions though, there we use Anaconda, rather than the framwork Python, and it covers creating packages too, so this ought to work @scottwsides

Older versions as I said had crashes, but I am surprised about 0.6.6 doing it.

thanks for the reply. Not sure what to do... as I said I tried all the
Nuitka versions I could find and running with conda python seg faults.

Dr. Scott W Sides
(303) 718-7028

On Thu, Jan 9, 2020 at 4:25 AM Kay Hayen notifications@github.com wrote:

The Anaconda versions works in the Github actions though, there we use
Anaconda, rather than the framwork Python, and it covers creating packages
too, so this ought to work @scottwsides https://github.com/scottwsides

Older versions as I said had crashes, but I am surprised about 0.6.6 doing
it.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Nuitka/Nuitka/issues/574?email_source=notifications&email_token=ADHTEK7G2TNPKNV53JKM5JDQ44CQZA5CNFSM4JPSUSKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIP7FRQ#issuecomment-572519110,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADHTEK2EDTDLGWABMP4P4ULQ44CQZANCNFSM4JPSUSKA
.

@scottwsides Which Python version was this with? So far I only did 3.7 on Github, but on Travis I think we did 2.7 and 3.7 until it stopped working, but that was homebrew. I will now try and expand the version coverage like I did for Windows already, maybe I find one version which will segfault.

3.7
Dr. Scott W Sides
(303) 718-7028

On Thu, Jan 9, 2020 at 9:59 AM Kay Hayen notifications@github.com wrote:

@scottwsides https://github.com/scottwsides Which Python version was
this with? So far I only did 3.7 on Github, but on Travis I think we did
2.7 and 3.7 until it stopped working, but that was homebrew. I will now try
and expand the version coverage like I did for Windows already, maybe I
find one version which will segfault.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Nuitka/Nuitka/issues/574?email_source=notifications&email_token=ADHTEKZCWAYUC3H7F7UVQQ3Q45JYHA5CNFSM4JPSUSKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIRAQ6Q#issuecomment-572655738,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADHTEK3N43TAZ46AQKKDHB3Q45JYHANCNFSM4JPSUSKA
.

So, turns out the macOS configuration for Github Actions was flawed, and in fact the framework Python was used. Now I am making sure to use the Anaconda Python, I am getting the same error on Github Actions too. Seems we might want to add automatic stack traces there too, and not only for programs.

As an aside, it's observed there with 3.6 too.

So, this is what I got from the automatic debugger run it now does.

  * frame #0: 0x0000000101c4758b libpython3.6m.dylib`PyUnicode_InternInPlace + 107
    frame #1: 0x0000000101cc72af libpython3.6m.dylib`PyImport_Import + 351
    frame #2: 0x0000000101cc86bc libpython3.6m.dylib`PyImport_ImportModule + 28
    frame #3: 0x0000000101b603ed kitty.so`_initBuiltinModule + 29
    frame #4: 0x0000000101b475e3 kitty.so`modulecode_kitty + 99

This is without line numbers, probably because it is not ran in debug mode first, and gets stripped, however it's enough to know that it's dramatically little code that is run there. The module template calls _initBuiltinModule first thing and that then does first PyImport_ImportModule on the builtins module.

Basically it's only the module entry point, straight going into it. I am at loss.

From current Nuitka code:

`void _initBuiltinModule() {
#if _NUITKA_MODULE
    if (builtin_module)
        return;
#else
    assert(builtin_module == NULL);
#endif

#if PYTHON_VERSION < 300
    builtin_module = (PyModuleObject *)PyImport_ImportModule("__builtin__");
#else
    builtin_module = (PyModuleObject *)PyImport_ImportModule("builtins");
#endif

and

// Internal entry point for module code.
PyObject *modulecode_%(module_identifier)s(char const *module_full_name) {
#if defined(_NUITKA_EXE) || PYTHON_VERSION >= 300
    static bool _init_done = false;

    // Modules might be imported repeatedly, which is to be ignored.
    if (_init_done) {
        return module_%(module_identifier)s;
    } else {
        _init_done = true;
    }
#endif

#ifdef _NUITKA_MODULE
    // In case of a stand alone extension module, need to call initialization
    // the init here because that's the first and only time we are going to get
    // called here.

    // May have to activate constants blob.
#if defined(_NUITKA_CONSTANTS_FROM_RESOURCE)
    loadConstantsResource();
#endif

    // Initialize the constant values used.
    _initBuiltinModule();

That is almost as direct as it can go into the crashing call. Maybe we manage to disobey anything about the ABI, take includes from else where, or what not, this is of course also very unreproducible on Linux.

Loading the wrong or a duplicate libpython might be some to blame as well, actually might even be likely here. Actually on the call stack it's all python.3.6 all the way, before it then enters the Nuitka compiled kitty.dylib which prefers the libpython3.6m.dylib which is not needed.

I distinctly recall the same issue on Linux, removing it as at least unneeded to link against the DLL, for some versions.

Ok, this is all about macOS by default not lazy linking symbols, which is why I made an exception for macOS to link the shared library, apparently thinking it was needed, and with platform python, you get away with it, as with many linux forms of Python, however not with Anaconda.

Also, it's wrong, extension modules are not supposed to do that. So this is fixed now on factory, where I finish up a few packaging tweaks before I can release.

Check this out or wait for the pre-release with it http://nuitka.net/doc/factory.html

With that Anaconda 3.6 and 3.7 on macOS are working. Going to try 3.8 soon, but I expect it to be OK as well.

Seems to be working now locally, will double check with some varying setups.

In our CI (azure) I run into the following error, not sure if related:

Traceback (most recent call last):
  File "/Users/runner/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nuitka/__main__.py", line 182, in <module>
    main()
  File "/Users/runner/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nuitka/__main__.py", line 175, in main
    MainControl.main()
  File "/Users/runner/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nuitka/MainControl.py", line 746, in main
    result, options = compileTree(main_module=main_module)
  File "/Users/runner/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nuitka/MainControl.py", line 682, in compileTree
    result, options = runScons(main_module=main_module, quiet=not Options.isShowScons())
  File "/Users/runner/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nuitka/MainControl.py", line 545, in runScons
    if python_version >= 370 and sys.flags.utf8_mode:
AttributeError: 'sys.flags' object has no attribute 'utf8_mode'

Ouch, this is an overflow, with my stupic decimal version, Nuitka mistakes a 3.6.10 for a 3.7 ...

Both lib and executable work for me as well, thanks!
Nuitka 0.6.7rc3, MacOS 10.15.2, Python 3.7.6 in miniconda

This is now on develop branch and awaits release soonish.

Ouch, this is an overflow, with my stupic decimal version, Nuitka mistakes a 3.6.10 for a 3.7 ...

Just for reference, because I was checking whether you already fixed this as well: related commit 6e0e321b6960ccb148071e7f044a14583eb66084

Will test this and get back to you.

Seems to be working now locally, will double check with some varying setups.

In our CI (azure) I run into the following error, not sure if related:

Traceback (most recent call last):
  File "/Users/runner/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nuitka/__main__.py", line 182, in <module>
    main()
  File "/Users/runner/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nuitka/__main__.py", line 175, in main
    MainControl.main()
  File "/Users/runner/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nuitka/MainControl.py", line 746, in main
    result, options = compileTree(main_module=main_module)
  File "/Users/runner/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nuitka/MainControl.py", line 682, in compileTree
    result, options = runScons(main_module=main_module, quiet=not Options.isShowScons())
  File "/Users/runner/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nuitka/MainControl.py", line 545, in runScons
    if python_version >= 370 and sys.flags.utf8_mode:
AttributeError: 'sys.flags' object has no attribute 'utf8_mode'

Fixed on develop! :) Thank you for the great support, @kayhayen

The release 0.6.8 was just made and contains the correction.

Was this page helpful?
0 / 5 - 0 ratings