Help Compiling 64bit Python

Discussion in 'Python' started by John Abel, Sep 20, 2003.

  1. John Abel

    John Abel Guest

    I'm having a bit of hassle, trying to compile Python in 64bit mode on
    Solaris8, using GCC 3.1/3.3 (tried both). I've set the relevant
    settings ( export CC="gcc -mcpu=v9 -m64 -D_LARGEFILE64_SOURCE=1" -
    hopefully) before ./configure, which seems to work OK. The problem
    happens halfway through the make. It produces the following output:

    c++ -o python \
    Modules/python.o \
    libpython2.3.a -lresolv -lsocket -lnsl -lrt -ldl
    -lpthread -lm
    ld: fatal: file Modules/python.o: wrong ELF class: ELFCLASS64
    ld: fatal: File processing errors. No output written to python
    collect2: ld returned 1 exit status
    make: *** [python] Error 1

    I'd be very grateful for any pointers.

    Regards

    John
     
    John Abel, Sep 20, 2003
    #1
    1. Advertising

  2. John Abel <> writes:

    > c++ -o python \
    > Modules/python.o \
    > libpython2.3.a -lresolv -lsocket -lnsl -lrt -ldl
    > -lpthread -lm
    > ld: fatal: file Modules/python.o: wrong ELF class: ELFCLASS64
    > ld: fatal: File processing errors. No output written to python
    > collect2: ld returned 1 exit status
    > make: *** [python] Error 1
    >
    > I'd be very grateful for any pointers.


    You need to arrange to use the -m options in the linker line as well.

    Looking at the generated Makefile will tell you where to best insert
    these options.

    Regards,
    Martin
     
    Martin v. =?iso-8859-15?q?L=F6wis?=, Sep 20, 2003
    #2
    1. Advertising

  3. John Abel

    John Abel Guest

    Martin v. Löwis wrote:

    >John Abel <> writes:
    >
    >
    >
    >>c++ -o python \
    >> Modules/python.o \
    >> libpython2.3.a -lresolv -lsocket -lnsl -lrt -ldl
    >>-lpthread -lm
    >>ld: fatal: file Modules/python.o: wrong ELF class: ELFCLASS64
    >>ld: fatal: File processing errors. No output written to python
    >>collect2: ld returned 1 exit status
    >>make: *** [python] Error 1
    >>
    >>I'd be very grateful for any pointers.
    >>
    >>

    >
    >You need to arrange to use the -m options in the linker line as well.
    >
    >Looking at the generated Makefile will tell you where to best insert
    >these options.
    >
    >Regards,
    >Martin
    >
    >

    I seem to be missing something really obvious here. I've modified the
    Makefile so it looks like this:

    CONFIG_ARGS= 'CC=gcc -mcpu=v9 -m64 -D_LARGEFILE64_SOURCE=1'
    'LDFLAGS=-mcpu=v9 -m64'

    ran the make, and it still comes up with the same error. I've even
    tried running it with LDFLAGS=-64, with the same result.

    Regards

    John
     
    John Abel, Sep 20, 2003
    #3
  4. John Abel <> writes:

    > >>c++ -o python \
    > >> Modules/python.o \
    > >> libpython2.3.a -lresolv -lsocket -lnsl -lrt -ldl
    > >>-lpthread -lm

    [...]
    > I seem to be missing something really obvious here. I've modified the
    > Makefile so it looks like this:
    >
    > CONFIG_ARGS= 'CC=gcc -mcpu=v9 -m64 -D_LARGEFILE64_SOURCE=1'
    > 'LDFLAGS=-mcpu=v9 -m64'
    >
    > ran the make, and it still comes up with the same error. I've even
    > tried running it with LDFLAGS=-64, with the same result.


    The really obvious thing you are missing is that "c++" is used to link
    python, so setting "CC" has no effect.

    I really encourage you to read the Makefile.

    Regards,
    Martin
     
    Martin v. =?iso-8859-15?q?L=F6wis?=, Sep 20, 2003
    #4
  5. John Abel

    John Abel Guest

    Martin v. Löwis wrote:

    >John Abel <> writes:
    >
    >
    >
    >>>>c++ -o python \
    >>>> Modules/python.o \
    >>>> libpython2.3.a -lresolv -lsocket -lnsl -lrt -ldl
    >>>>-lpthread -lm
    >>>>
    >>>>

    >[...]
    >
    >
    >>I seem to be missing something really obvious here. I've modified the
    >>Makefile so it looks like this:
    >>
    >>CONFIG_ARGS= 'CC=gcc -mcpu=v9 -m64 -D_LARGEFILE64_SOURCE=1'
    >>'LDFLAGS=-mcpu=v9 -m64'
    >>
    >>ran the make, and it still comes up with the same error. I've even
    >>tried running it with LDFLAGS=-64, with the same result.
    >>
    >>

    >
    >The really obvious thing you are missing is that "c++" is used to link
    >python, so setting "CC" has no effect.
    >
    >I really encourage you to read the Makefile.
    >
    >Regards,
    >Martin
    >
    >

    Sorted. I ended up setting the following:

    export CC="gcc -mcpu=v9 -m64 -D_LARGEFILE64_SOURCE=1"
    export LDFLAGS='-mcpu=v9 -m64'
    export LDDFLAGS='-mcpu=v9 -m64 -G'

    Thanks to Martin for the pointers.

    Regards

    John
     
    John Abel, Sep 20, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    8,343
    Chris Smith
    Mar 24, 2005
  2. Jhy-Chun Wang

    build 64bit python on Solaris

    Jhy-Chun Wang, Sep 21, 2004, in forum: Python
    Replies:
    3
    Views:
    618
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Sep 21, 2004
  3. Martijn de Munnik

    Compile python on Solaris 64bit

    Martijn de Munnik, Oct 12, 2006, in forum: Python
    Replies:
    4
    Views:
    720
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Oct 12, 2006
  4. Replies:
    1
    Views:
    349
    Martin v. Löwis
    Jan 22, 2009
  5. Ralph Heinkel
    Replies:
    6
    Views:
    949
    Ralph Heinkel
    Mar 22, 2012
Loading...

Share This Page