3

I'm trying to compile the msgpack-python python module with gcc (v4.7) on solaris 10. The python installed is 2.6.8. Distutils is automatically picking up a incorrect compiler option (-xcode=pic32) that I want to remove from command.

The full command that distutils is putting together is:

/opt/csw/bin/gcc-4.7 -DNDEBUG -O -O2 -pipe -mcpu=v9 -I/opt/csw/include -xcode=pic32 -I/opt/csw/include/python2.6 -c msgpack/_msgpack.c -o build/temp.solaris-2.10-sun4v-2.6/msgpack/_msgpack.o

but produces this error:

gcc-4.7: error: language code=pic32 not recognized

then fails. If I remove that -xcode=pic32 option and manually execute the above command the module compiles successfully.

I need to be able to do this in an automated fashion though (using a buildfarm to produce the packages). The question is, Without modifying or changing the current python or distutils, is there a way to "remove" this option that distutils is picking up, so I can have the python setup.py process build the module appropriately (i.e. without the pic32 option)?

Thanks

user1522264
  • 123
  • 1
  • 1
  • 5

2 Answers2

1

Do not compile with that gcc. -xcode=pic32 is Sun Studio complier command line parameter. It will lead to linking problems too, even if you compile OK. Compile with SUN CoolTools gcc which can understand such parameter, or use Oracle Solaris Studio for SPARC.

Some hints:

  1. GCC produce very slow code for SPARC, that's for why SUN created Cool Tools.
  2. You haven't to remove -xcode=pic32, but change for -m32 -fpic, when you insist on gcc-4.7
  3. To get mature setup of OSS tool I'm using pkgsrc compiling with Studio Express to particular CPU (-xtarget=native)
nudzo
  • 17,166
  • 2
  • 19
  • 19
0

You may also find luck by setting the follow env vars:

export CC=$gcc_dir_path  # Example: /usr/bin/gcc
export CXX=$gxx_dir_path  # Example: /usr/bin/g++
export CFLAGS=''
export CPPFLAGS=''
export CXXFLAGS=''
export LDFLAGS=''

Note: There is a difference between unset env var, and set-as-empty env var. I had build bugs with Python packages when my *FLAGS env vars were unset. (Calling gcc with option -xO2 was the cause.) Setting as empty did the trick.

kevinarpe
  • 20,319
  • 26
  • 127
  • 154