Build failing on Solaris

Andrew Koenig ark at acm.org
Mon Dec 1 22:17:16 EST 2003


> On a Solaris-8 machine i'm trying to build Python-2.3.2.  Using gcc-3.2.
> All seems to go pretty well for a while, but them i'm getting the
> following:
>
> --------------------
> $ make
> ...
> case $MAKEFLAGS in \
> *-s*)  CC='gcc' LDSHARED='gcc -shared'
OPT='-DNDEBUG -g -O3 -Wall -Wstrict-prototypes' ./python -E ./setup.py -q
build;; \
> *)  CC='gcc' LDSHARED='gcc -shared'
OPT='-DNDEBUG -g -O3 -Wall -Wstrict-prototypes' ./python -E ./setup.py
build;; \
> esac
> running build
> running build_ext
> Segmentation Fault - core dumped
> gmake: *** [sharedmods] Error 139

Certain versions of binutils do not correctly support dynamic linking on
Solaris, which gives rise to symptoms similar to the ones you are seeing.  I
am pretty sure that binutils 2.13.2.1 works.  To find out whether the
version on your machine works, you can execute the following shell script:

#! /bin/sh
mkdir /tmp/t.$$ || exit 3
cd /tmp/t.$$ || exit 3
cat >main.c <<'EOF'
#include <stdio.h>
#include <dlfcn.h>
int main(void)
{
    void *handle, *sym;
    char *error;
    puts("calling dlopen");
    handle = dlopen("./dyn.so", RTLD_NOW);
    if (!handle) {
        printf("%s\n", dlerror());
        return 1;
    }
    puts("calling dlsym");
    sym = dlsym(handle, "sym");
    if ((error = dlerror()) != 0) {
        printf("%s\n", error);
        return 1;
    }
    puts("calling sym");
    ((void (*)(void))sym)();
    puts("done");
    return 0;
}
EOF
cat >dyn.c <<'EOF'
#include <stdio.h>
void sym(void)
{
    puts("in sym");
}
EOF
[ -n "$SHFLAGS" ] || SHFLAGS="-fPIC -shared"
[ -n "$CC" ] || CC=gcc
set -x
$CC $CFLAGS $SHFLAGS dyn.c -o dyn.so
$CC $CFLAGS main.c -o main -ldl
./main || exit $?
cd /tmp
rm -rf t.$$






More information about the Python-list mailing list