Hello Jakub,
thank you for the report. I confirmed the bug indeed. Python is right here:
nm Mini.so | grep PyInit
000000000000b5b0 t PyInit_Mini
The "t" in lower case means it's a local text symbol, i.e. it is not
exported.
Using CCFLAGS="-save-temps", I check the produced C++ code behind the
preprocessor:
grep PyInit module.Mini.ii
extern "C" PyObject* PyInit_Mini( void );
extern "C" PyObject* PyInit_Mini( void )
It seems related to -fvisibility=hidden, the problem goes away which I
remove that (from SingleExe.scons), one probably can override it from
CCFLAGS too.
Trying to get it what is used with Python2:
extern "C" PyObject* __attribute__(( visibility( "default" )))
PyInit_Mini( void );
extern "C" PyObject* __attribute__(( visibility( "default" )))
PyInit_Mini( void )
gives this:
Mini.build/module.Mini.hpp:7:82: warning: ‘visibility’ attribute ignored
on non-class types [-Wattributes]
Mini.build/module.Mini.cpp:225:82: warning: ‘visibility’ attribute
ignored on non-class types [-Wattributes]
And of course, still won't work.
Unfortunately, the test, which is run at build time, to ensure that
compiling modules works properly (and seems to compile them), is still
working, i.e. there is also an error in
tests/reflected/compile_itself.py
that prevented me from detecting it. I will analyse this some more, and
try to come up with a fix.
However, using "nuitka --execute", it's also supposed to give you a
warning, as it's a trap, but only if it sees you use "__main__". It's
very likely though, that a user wants "nuitka --exe --execute" or rather
"nuitka-python" instead.
But this only as a side issue, in case your minimal test case, is not
the reduction of a actual use. Thanks again for the report.
I do have some hope, that the placement of the attribute is at fault,
because with Python2, this gives "T":
extern "C" void __attribute__(( visibility( "default" ))) initMini( void );
extern "C" void __attribute__(( visibility( "default" ))) initMini( void )
But that needs further research (over the weekend). Will keep you updated.
Thanks,
Kay Hayen
Am 07.06.2013 02:10, schrieb Jakub Wilk:
Package: nuitka
Version: 0.4.3+ds-1
I cannot import modules that were compiled for Python 3.2:
$ echo 'print(42)' > testcase.py
$ nuitka --python-version=3.2 --execute testcase.py
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: dynamic module does not define init function (PyInit_testcase)
-- System Information:
Debian Release: jessie/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 3.9-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Versions of packages nuitka depends on:
ii g++-4.6 4.6.4-2
ii python 2.7.3-5
ii python-dev 2.7.3-5
ii scons 2.3.0-2
--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org