Building msgpack-python on Solaris 10 - Use of <stdbool.h> is valid only in a c99 compilation environment

StackOverflow https://stackoverflow.com/questions/11462527

Question

I'm trying to build the python module msgpack-python on Solaris with the Sun compiler and am getting this error during the python ./setup.py build:

/opt/SUNWspro/bin/cc -DNDEBUG -O -xO3 -m32 -xarch=sparc -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
"/usr/include/stdbool.h", line 42: #error: "Use of <stdbool.h> is valid only in a c99 compilation environment."

I also tried compiling by adding'-std=c99' like mentioned here: Node.JS on Solaris

but end up with:

cc: Warning: illegal option -d=c99

Anyone have any ideas on what this stdbool.h error is and how to work around it.

Thanks.

Was it helpful?

Solution

I don't know which version of Sun Studio you are running (which is important when it comes to whether or not it supports the Solaris 10 release you are using), but to get C99 mode, you can do one of two things:

  1. Run the command /opt/SUNWspro/bin/c99 - This is a wrapper executable which will kick off the Sun CC compiler in C99 mode.

  2. Run your command with the -xc99 flag - which will also trigger C99 mode in the compiler:

    /opt/SUNWspro/bin/cc -xc99 ...

Alternatively, you can also use the GCC compiler (usually installed in /usr/sfw/bin/gcc) to compile this C module, which is the compiler that supports the -std=c99 flag option. If I remember my Solaris work correctly, the gcc included with Solaris will use Sun's ld and link against the normal libc.so on the system just like cc will (not true at all for the C++ versions of each compiler).

OTHER TIPS

Try export following:

export CFLAGS="-D_XOPEN_SOURCE=500 -D__EXTENSIONS__ -features=extensions"

And then run configure script again, recompile. I think it will not require C99 compliance anymore. Most of OpenSource SW requires this defines to switch more OpenSource behavior of system headers.

More better use pkgsrc to compile OS software. It will do such tricks automatically.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top