Help Compiling 64bit Python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Abel

    Help Compiling 64bit Python

    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_S OURCE=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


  • Martin v. Löwis

    #2
    Re: Help Compiling 64bit Python

    John Abel <john.abel@pa.p ress.net> writes:
    [color=blue]
    > 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.[/color]

    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

    Comment

    • John Abel

      #3
      Re: Help Compiling 64bit Python

      Martin v. Löwis wrote:
      [color=blue]
      >John Abel <john.abel@pa.p ress.net> writes:
      >
      >
      >[color=green]
      >>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.
      >>
      >>[/color]
      >
      >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
      >
      >[/color]
      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_S OURCE=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


      Comment

      • Martin v. Löwis

        #4
        Re: Help Compiling 64bit Python

        John Abel <john.abel@pa.p ress.net> writes:
        [color=blue][color=green][color=darkred]
        > >>c++ -o python \
        > >> Modules/python.o \
        > >> libpython2.3.a -lresolv -lsocket -lnsl -lrt -ldl
        > >>-lpthread -lm[/color][/color][/color]
        [...][color=blue]
        > 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_S OURCE=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.[/color]

        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

        Comment

        • John Abel

          #5
          Re: Help Compiling 64bit Python

          Martin v. Löwis wrote:
          [color=blue]
          >John Abel <john.abel@pa.p ress.net> writes:
          >
          >
          >[color=green][color=darkred]
          >>>>c++ -o python \
          >>>> Modules/python.o \
          >>>> libpython2.3.a -lresolv -lsocket -lnsl -lrt -ldl
          >>>>-lpthread -lm
          >>>>
          >>>>[/color][/color]
          >[...]
          >
          >[color=green]
          >>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_S OURCE=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.
          >>
          >>[/color]
          >
          >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
          >
          >[/color]
          Sorted. I ended up setting the following:

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

          Thanks to Martin for the pointers.

          Regards

          John



          Comment

          Working...