dynamically loaded modules (.so files) does not work under openbsd

Trent Mick trentm at ActiveState.com
Thu Oct 26 11:43:14 EDT 2000


On Thu, Oct 26, 2000 at 01:05:55PM +1100, Kiyo Kelvin Lee wrote:
> Under OpenBSD, I can't make dynamically loaded modules work.
> Python responsed with "ImportError: dynamic modules does not define init
> function (initXYZ)" upon import XYZ.
> Any ideas?
> Kiyo

I haven't looked at it and I can't really because I don't have access to a
BSD box but $10 that the problem with the flags that Python configure script
chooses to use for compiling and linking the .so's. They are probably setup
to work for a typical Linux setup with the presumption that the same choices
would work on BSD.

Or actually, looking at the configure script I see:

    case $ac_sys_system/$ac_sys_release in
    AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
    BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L..  -lpython\$(VERSION)";;
    IRIX/5*) LDSHARED="ld -shared";;
    IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
    SunOS/4*) LDSHARED="ld";;
    SunOS/5*)
        if test "$GCC" = "yes"
        then LDSHARED='$(CC) -G'
        else LDSHARED="ld -G";
        fi ;;
    hp*|HP*) LDSHARED="ld -b";;
    OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
    DYNIX/ptx*) LDSHARED="ld -G";;
        Darwin/*|next/*)
        if test "$ns_dyld"
        then
          if test "$ac_sys_system" = Darwin
          then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
          else LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind'
          fi
        else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
        fi
    if test "$with_next_framework" ; then
            LDSHARED="$LDSHARED \$(LDLIBRARY)"
        fi ;;
    Linux*) LDSHARED="gcc -shared";;
    dgux*) LDSHARED="ld -G";;
    BSD/OS*/4*) LDSHARED="gcc -shared";;
    OpenBSD*) LDSHARED="ld -Bshareable";;
    NetBSD*)
        if [ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]
        then
            LDSHARED="cc -shared"
        else
            LDSHARED="ld -Bshareable"
        fi;;
    FreeBSD*)
        if [ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]
        then
            LDSHARED="cc -shared ${LDFLAGS}"
        else
            LDSHARED="ld -Bshareable ${LDFLAGS}"
        fi;;
    SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
    Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
    *)  LDSHARED="ld";;
    esac


THis is the code to choose the flags for linking shared modules. It looks
like there is a special one for OpenBSD. Try flags other than "-Bshareable".
Maybe that is the problem.

Hope that helps,
Trent


-- 
Trent Mick
TrentM at ActiveState.com




More information about the Python-list mailing list