Question

I was trying to build this package I wrote (which I know to be working), first in the usual way through distutils:

# python2.7 setup.py build
running build
running build_py
running build_ext
building 'uptime._posix' extension
gcc -fno-strict-aliasing -Wno-error -march=i586 -DHAVE_DB_185_H -I/usr/pkg/include -I/usr/include -DNDEBUG -Wno-error -march=i586 -DHAVE_DB_185_H -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python2.7 -c src/_posix.c -o build/temp.minix-3-i686-2.7/src/_posix.o
ld -L/usr/tmp/work/lang/python27/work/Python-2.7.2 -lcompat_minix -minlib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib build/temp.minix-3-   i686-2.7/src/_posix.o -o build/lib.minix-3-i686-2.7/uptime/_posix.so
ld: unrecognized option '-Wl,-R/usr/pkg/lib'
ld: use the --help option for usage information
build failed: uptime._posix (no big deal)

Well, fine; distutils is one of those modules that often break on less popular platforms. So I tried compiling the extension part manually:

# gcc -fno-strict-aliasing -march=i586 -DNDEBUG -I/usr/pkg/include/python2.7 -fPIC -shared -o _posix.so src/_posix.c

This worked—that is, it produced _posix.so without complaining—but, trying to import the resulting module in Python didn't:

>>> import _posix
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: Service unavailable

Google suggests this is related to the ability of the OS to load shared libraries (which Python extensions are). I went looking, and it turns out MINIX didn't support shared libraries at all until last year, but now it should. In fact, /usr/pkg/include/python2.7/pyconfig.h defines both HAVE_DLOPEN and HAVE_DYNAMIC_LOADING, so it clearly does.

What's going on?

Was it helpful?

Solution

MINIX does support shared libraries now, but the binary Python packages provided by pkgin are statically linked, which prevents them from being able to load shared libraries anyway. The only way around this is to compile Python yourself, ideally through pkgsrc. All pkgsrc packages are built dynamically by default.

(You'll still have to build the extensions manually, too.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top