Title segmentation fault when importing a compiled package into a compiled program
Priority bug Status chatting
Superseder Nosy List jimr, kayhayen
Assigned To kayhayen Keywords

Created on 2015-08-26.14:50:08 by jimr, last changed by kayhayen.

msg1800 (view) Author: kayhayen Date: 2016-02-04.08:00:24
Not having a segfault would be an indetermism of the bug. Pure luck. Don't count 
on it. The .so und the .exe will have a conflict when they patch the libpython 
both with their stuff. I would appreciate a reproducer, feel free to send me 
what you have via private mail.

msg1799 (view) Author: Lenny Linus Date: 2016-02-03.21:30:40
Some more details:

|____ <-- this is the script that depends on the .so files inside 
   When i compile using the command "nuitka" it compiles 
and produces a binary 'testapp.exe' upon running which a Segmentation fault' is 
raised, but when I compile it using "nuitka --lto" it compiles a 
binary 'testapp.exe' which runs perfectly, no seg fault.
   I'm running ubuntu 14.04 64bit on intel core i5, I have g++ installed from 
ubuntu's default 'sudo apt-get install g++'.
msg1798 (view) Author: Lenny Linus Date: 2016-02-03.21:19:27
  I am having the exact same problem as jimr, and after allot of googling I 
came across this link:
  Where its mentioned that If we compile the script with clang, the 
segmentation fault will go away. I have not tried clang, because before I could 
try that I just randomly typed in "nuitka --help" and the option "--lto (link 
time optimizations)" caught my eye. I tried the option and the segmentation 
fault went away! I have no idea why. I can provide anyone with the files, just 
email me on ''. Nuitka is amazing!! ^_^
msg1476 (view) Author: kayhayen Date: 2015-08-26.15:01:05
When you compare to this:

There, the issue was that inspect module was not working anymore, but this got fixed in 
the factory version, but generally it worked.

What is strange is that sample apparently is a directory to recurse to and a main program, 
does it have a ? Because if it does, it may conflict with the __main__ that 
the main program has, and that would be something to catch.

I would appreciate it if you could tar up "sample" and send it to me via email or bug 
tracker for easy reproduction.

msg1475 (view) Author: jimr Date: 2015-08-26.14:50:08
I have a package that I compile.  The package does nothing but define a function that prints "hello".

Compiling using:

/opt/nuitka/bin/nuitka --module sample --recurse-directory=sample

This works fine.  And is useable by all my uncompiled python programs.

Then I compile a simple python program, that only loads the compiled package and runs the function.

Compiling using:


The result is "Segmentation fault (core dumped)".

I've found these combinations:

python loading compiled package = OK
compiled program loading python package = OK
compiled program loading compiled package = Segmentation fault (core dumped)

Am I doing something wrong?
Date User Action Args
2016-02-04 08:00:24kayhayensetmessages: + msg1800
2016-02-03 21:30:40Lenny Linussetmessages: + msg1799
2016-02-03 21:19:27Lenny Linussetassignedto: kayhayen
messages: + msg1798
nosy: + kayhayen
2016-02-03 21:06:10Lenny Linussetmessages: - msg1478
2015-08-26 16:03:17jimrsetmessages: + msg1478
2015-08-26 15:01:05kayhayensetstatus: unread -> chatting
messages: + msg1476
2015-08-26 14:50:08jimrcreate