suncc and PHP compatibility

it seems that suncc have some trouble when working with PHP,hope you can imporve it:

luoyi@4Email:~/src/lylib/trunk/topbuild$ cat do.sh

#!/bin/sh

echo "**************** first gcc *****************"

make -B lib/xarray_php5.do

echo "**************** then icc *****************"

make -B lib/xarray_php5.do INTEL=1

echo "**************** then pgroup *****************"

make -B lib/xarray_php5.do PGROUP=1

echo "**************** then pathscale *****************"

make -B lib/xarray_php5.do PATHSCALE=1

echo "**************** then suncc *****************"

make -B lib/xarray_php5.do SUN=1

luoyi@4Email:~/src/lylib/trunk/topbuild$ ./do.sh

**************** first gcc *****************

g++-c -shared -fpic -fPIC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include -march=i686 -O2 -o lib/xarray_php5.do ../cnqp/xarray/source/xarray.cpp

[DEP] ./build/dep/xarray.d

**************** then icc *****************

icpc-c -shared -fpic -fPIC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include -O3 -parallel -o lib/xarray_php5.do ../cnqp/xarray/source/xarray.cpp

[DEP] ./build/dep/xarray.d

**************** then pgroup *****************

pgCC-c -shared -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include -fastsse -o lib/xarray_php5.do ../cnqp/xarray/source/xarray.cpp

[DEP] ./build/dep/xarray.d

**************** then pathscale *****************

pathCC-c -shared -fpic -fPIC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include -march=i686 -O2 -ipa -ffast-stdlib -o lib/xarray_php5.do ../cnqp/xarray/source/xarray.cpp

[DEP] ./build/dep/xarray.d

**************** then suncc *****************

sunCC -library=stlport4 -c -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include -fast -Bdynamic -o lib/xarray_php5.do ../cnqp/xarray/source/xarray.cpp

"/usr/local/include/php/Zend/zend_alloc.h", line 34: Error: Type name expected instead of "uint".

"/usr/local/include/php/Zend/zend_alloc.h", line 36: Error: Type name expected instead of "uint".

"/usr/local/include/php/Zend/zend_hash.h", line 39: Error: "," expected instead of "(".

"/usr/local/include/php/Zend/zend_hash.h", line 50: Error: Type name expected instead of "uint".

"/usr/local/include/php/Zend/zend_hash.h", line 61: Error: Type name expected instead of "uint".

"/usr/local/include/php/Zend/zend_hash.h", line 62: Error: Type name expected instead of "uint".

"/usr/local/include/php/Zend/zend_hash.h", line 63: Error: Type name expected instead of "uint".

"/usr/local/include/php/Zend/zend_hash.h", line 81: Error: Type name expected instead of "uint".

"/usr/local/include/php/Zend/zend_hash.h", line 93: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 94: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 101: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 107: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 113: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 119: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 147: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 153: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 156: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 157: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 161: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 162: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 172: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 177: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 207: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 208: Error: uint is not defined.

"/usr/local/include/php/Zend/zend_hash.h", line 209: Error: uint is not defined.

Compilation aborted, too many Error messages.

make: *** [lib/xarray_php5.do] Error 1

luoyi@4Email:~/src/lylib/trunk/topbuild$ head ../cnqp/xarray/source/xarray.cpp

// xarray = xml array

// usage: php -r '$xml=file_get_contents("./data.xml");

// $xml=iconv("GBK", "UTF-8", $xml);

// $xml=str_replace("encoding=\"GBK\"", "encoding=\"UTF-8\"", $xml);

// print_r(xmlarray($xml));'

#include "php.h"

#include "zend_API.h"

#include "expat.h"

#include "cnqp_log.h"

Message was edited by:

luoyi82

[5180 byte] By [luoyi82a] at [2007-11-27 9:04:56]
# 1

Add -D_GNU_SOURCE to your command line.

stlport4 defines _XOPEN_SOURCE (I was told it would go away, but it looks like it is still there), which means you need to explicitly tell the glibc headers that you still want the non-standard extensions as well.

By the way, you probably also want the -PIC flag if you are trying to make a shared library.

Marc_Glissea at 2007-7-12 21:38:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

> Add -D_GNU_SOURCE to your command line.

-D_BSD_SOURCE will do the trick as well

> stlport4 defines _XOPEN_SOURCE (I was told it would go away, but it looks like it is still there)

Yeah, thats right. _XOPEN_SOURCE=500

I admit I dont have full information on this, but we definitely want to get rid of any restrictions of this sort.

>By the way, you probably also want the -PIC flag if you are trying to make a shared library.

-KPIC for sunCC

SFVa at 2007-7-12 21:38:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3

oh, yes, thx for your reply. I can get it compile now:

luoyi@4Email:~/src/lylib/trunk/topbuild$ ./do.sh

**************** first gcc *****************

g++-c -shared -fpic -fPIC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include -march=i686 -O2 -o lib/xarray_php5.do ../cnqp/xarray/source/xarray.cpp

[DEP] ./build/dep/xarray.d

**************** then icc *****************

icpc-c -shared -fpic -fPIC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include -O3 -parallel -o lib/xarray_php5.do ../cnqp/xarray/source/xarray.cpp

[DEP] ./build/dep/xarray.d

**************** then pgroup *****************

pgCC-c -shared -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include -fastsse -o lib/xarray_php5.do ../cnqp/xarray/source/xarray.cpp

[DEP] ./build/dep/xarray.d

**************** then pathscale *****************

pathCC-c -shared -fpic -fPIC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include -march=i686 -O2 -ipa -ffast-stdlib -o lib/xarray_php5.do ../cnqp/xarray/source/xarray.cpp

[DEP] ./build/dep/xarray.d

**************** then suncc *****************

sunCC -library=stlport4 -c -KPIC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include -fast -DLINUX -D_GNU_SOURCE -Bdynamic -o lib/xarray_php5.do ../cnqp/xarray/source/xarray.cpp

"/usr/local/include/php/main/streams/php_stream_filter_api.h", line 66: Warning: Identifier expected instead of "}".

"../cnqp/xarray/source/xarray.cpp", line 20: Warning: String literal converted to char* in initialization.

"../cnqp/xarray/source/xarray.cpp", line 23: Warning: String literal converted to char* in initialization.

"../cnqp/xarray/source/xarray.cpp", line 45: Warning: String literal converted to char* in initialization.

"../cnqp/xarray/source/xarray.cpp", line 45: Warning (Anachronism): Using void(*)(int,_zval_struct*,_zval_struct**,_zval_struct*,int) to initialize extern "C" void(*)(int,_zval_struct*,_zval_struct**,_zval_struct*,int).

"../cnqp/xarray/source/xarray.cpp", line 53: Warning: String literal converted to char* in initialization.

"../cnqp/xarray/source/xarray.cpp", line 61: Warning: String literal converted to char* in initialization.

"../cnqp/xarray/source/xarray.cpp", line 223: Warning: String literal converted to char* in formal argument type_spec in call to zend_parse_parameters(int, char*, ...).

8 Warning(s) detected.

[DEP] ./build/dep/xarray.d

BTW: do you have any option that can make string literal not "const" ? so it'll not throw so many warnings.

luoyi82a at 2007-7-12 21:38:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...