ます’s Blog - どうでもいい記事100選

どうでもいい記事100選

Fail-Safe C: 安全なC言語コンパイラ(続きの続き)

昨日のですが、懲りずに再挑戦。
コンパイルオプションを最小限にしつつ色々と試した結果、「ext/standard/basic_functions.c」まで進行するようになりました。
後もう少しのように思えますが。。。段々と面倒臭くなってきたのでパッチも適当になってきた。(w
ただ、実用面という意味では(まだまだ)先の話になりそう。

% cd /usr/local/src
% gzip -dc ./php-5.2.5.tar.gz | tar xf -
% cat ./php-5.2.5-php_stream_filter_api.h.diff
--- php-5.2.5,orig/main/streams/php_stream_filter_api.h	2007-01-01 18:36:12.000000000 +0900
+++ php-5.2.5/main/streams/php_stream_filter_api.h	2008-04-18 10:53:08.000000000 +0900
@@ -62,7 +62,7 @@
 typedef enum {
 	PSFS_ERR_FATAL,	/* error in data stream */
 	PSFS_FEED_ME,	/* filter needs more data; stop processing chain until more is available */
-	PSFS_PASS_ON,	/* filter generated output buckets; pass them on to next in chain */
+	PSFS_PASS_ON	/* filter generated output buckets; pass them on to next in chain */
 } php_stream_filter_status_t;
 
 /* Buckets API. */
% patch -p0 < ./php-5.2.5-php_stream_filter_api.h.diff
patching file php-5.2.5/main/streams/php_stream_filter_api.h
% cd ./php-5.2.5
% env CC=fscc ./configure \
--disable-all \
--enable-mbstring \
--without-iconv

% cat ./Makefile | grep fscc
CC = fscc
CPP = fscc -E
% make
/bin/sh /usr/local/src/php-5.2.5/libtool --silent --preserve-dup-deps --mode=compile fscc -DNOT_RUBY -DHAVE_CONFIG_H -Iext/mbstring/ -I/usr/local/src/php-5.2.5/ext/mbstring/ -DPHP_ATOM_INC -I/usr/local/src/php-5.2.5/include -I/usr/local/src/php-5.2.5/main -I/usr/local/src/php-5.2.5 -I/usr/local/src/php-5.2.5/ext/date/lib -I/usr/local/src/php-5.2.5/ext/mbstring/oniguruma -I/usr/local/src/php-5.2.5/ext/mbstring/libmbfl -I/usr/local/src/php-5.2.5/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php-5.2.5/TSRM -I/usr/local/src/php-5.2.5/Zend -g -c /usr/local/src/php-5.2.5/ext/mbstring/oniguruma/regexec.c -o ext/mbstring/oniguruma/regexec.lo
/tmp/fsc-0-nG7bYHfc/regexec.safe.c: In function `FS_FPSh_379d7dae_16_PcPcPcPcPcPc_Pc_bm_search_backward’:
/tmp/fsc-0-nG7bYHfc/regexec.safe.c:38194: error: `T251’ undeclared (first use in this function)
/tmp/fsc-0-nG7bYHfc/regexec.safe.c:38194: error: (Each undeclared identifier is reported only once
/tmp/fsc-0-nG7bYHfc/regexec.safe.c:38194: error: for each function it appears in.)
+ gcc -I/usr/local/lib/fsc/default/runtime -march=pentium4 -msse3 -Wall -Wno-unused -O0 -g -fno-strict-aliasing -DFSC_DEBUG_RUNTIME -o ext/mbstring/oniguruma/regexec.o -c -xc /tmp/fsc-0-nG7bYHfc/regexec.safe.c
fscc: command gcc returned status 1
make: *** [ext/mbstring/oniguruma/regexec.lo] Error 1

% make distclean
% env CC=fscc ./configure \
--disable-all \
--without-iconv

% cat ./Makefile | grep fscc
CC = fscc
CPP = fscc -E
% make
/bin/sh /usr/local/src/php-5.2.5/libtool --silent --preserve-dup-deps --mode=compile fscc  -Iext/reflection/ -I/usr/local/src/php-5.2.5/ext/reflection/ -DPHP_ATOM_INC -I/usr/local/src/php-5.2.5/include -I/usr/local/src/php-5.2.5/main -I/usr/local/src/php-5.2.5 -I/usr/local/src/php-5.2.5/ext/date/lib -I/usr/local/src/php-5.2.5/TSRM -I/usr/local/src/php-5.2.5/Zend    -g  -c /usr/local/src/php-5.2.5/ext/reflection/php_reflection.c -o ext/reflection/php_reflection.lo
Warning: control reaches bottom of non-void function in __zend_malloc
Warning: control reaches bottom of non-void function in __zend_realloc
/bin/sh /usr/local/src/php-5.2.5/libtool --silent --preserve-dup-deps --mode=compile fscc  -Iregex/ -I/usr/local/src/php-5.2.5/regex/ -DPHP_ATOM_INC -I/usr/local/src/php-5.2.5/include -I/usr/local/src/php-5.2.5/main -I/usr/local/src/php-5.2.5 -I/usr/local/src/php-5.2.5/ext/date/lib -I/usr/local/src/php-5.2.5/TSRM -I/usr/local/src/php-5.2.5/Zend    -g  -c /usr/local/src/php-5.2.5/regex/regcomp.c -o regex/regcomp.lo
/usr/local/src/php-5.2.5/regex/regcomp.c(117): CHAR_MAX: var CHAR_MAX not found
Fatal error: exception Failure("type check failed (2)")
+ /usr/local/lib/fsc/default/compiler/trans.nc ---sysinclude /usr/local/lib/fsc/default/include -f multi-module -I regex/ -I /usr/local/src/php-5.2.5/regex/ -I /usr/local/src/php-5.2.5/include -I /usr/local/src/php-5.2.5/main -I /usr/local/src/php-5.2.5 -I /usr/local/src/php-5.2.5/ext/date/lib -I /usr/local/src/php-5.2.5/TSRM -I /usr/local/src/php-5.2.5/Zend -D PHP_ATOM_INC ---output-file /tmp/fsc-0-fA2L7A33/regcomp.safe.c ---input-file /usr/local/src/php-5.2.5/regex/regcomp.c
fscc: command /usr/local/lib/fsc/default/compiler/trans.nc returned status 2
make: *** [regex/regcomp.lo] Error 1

% make distclean
% env CC=fscc ./configure \
--disable-all \
--enable-mbstring \
--disable-mbregex \
--without-iconv \
--with-regex=system

% cat ./Makefile | grep fscc
CC = fscc
CPP = fscc -E
% make
/bin/sh /usr/local/src/php-5.2.5/libtool --silent --preserve-dup-deps --mode=compile fscc -Iext/date/lib -Iext/date/ -I/usr/local/src/php-5.2.5/ext/date/ -DPHP_ATOM_INC -I/usr/local/src/php-5.2.5/include -I/usr/local/src/php-5.2.5/main -I/usr/local/src/php-5.2.5 -I/usr/local/src/php-5.2.5/ext/date/lib -I/usr/local/src/php-5.2.5/ext/mbstring/libmbfl -I/usr/local/src/php-5.2.5/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php-5.2.5/TSRM -I/usr/local/src/php-5.2.5/Zend    -g  -c /usr/local/src/php-5.2.5/ext/date/php_date.c -o ext/date/php_date.lo
In file included from /usr/local/src/php-5.2.5/main/php.h:74,
                 from /usr/local/src/php-5.2.5/ext/date/php_date.c:21:
/usr/local/src/php-5.2.5/main/php_regex.h:59:19: regex.h: No such file or directory
+ /usr/local/lib/fsc/default/compiler/trans.nc ---sysinclude /usr/local/lib/fsc/default/include -f multi-module -I ext/date/lib -I ext/date/ -I /usr/local/src/php-5.2.5/ext/date/ -I /usr/local/src/php-5.2.5/include -I /usr/local/src/php-5.2.5/main -I /usr/local/src/php-5.2.5 -I /usr/local/src/php-5.2.5/ext/date/lib -I /usr/local/src/php-5.2.5/ext/mbstring/libmbfl -I /usr/local/src/php-5.2.5/ext/mbstring/libmbfl/mbfl-I /usr/local/src/php-5.2.5/TSRM -I /usr/local/src/php-5.2.5/Zend -D PHP_ATOM_INC ---output-file /tmp/fsc-0-C1v1nSoP/php_date.safe.c ---input-file /usr/local/src/php-5.2.5/ext/date/php_date.c
fscc: command /usr/local/lib/fsc/default/compiler/trans.nc returned status 1
make: *** [ext/date/php_date.lo] Error 1

% cat ../php-5.2.5-php_regex.h.diff
--- ../php-5.2.5,orig/main/php_regex.h	2007-01-01 18:36:11.000000000 +0900
+++ main/php_regex.h	2008-04-18 11:50:43.000000000 +0900
@@ -56,7 +56,7 @@
 #define _H_REGEX 1              /* This one is for AIX */
 #endif
 #elif REGEX == 0
-#include <regex.h>
+#include </usr/include/regex.h>
 #ifndef _REGEX_H_
 #define _REGEX_H_ 1
 #endif
% patch -p0 < ../php-5.2.5-php_regex.h.diff
patching file main/php_regex.h
% make
/bin/sh /usr/local/src/php-5.2.5/libtool --silent --preserve-dup-deps --mode=compile fscc  -Iext/mbstring/ -I/usr/local/src/php-5.2.5/ext/mbstring/ -DPHP_ATOM_INC -I/usr/local/src/php-5.2.5/include -I/usr/local/src/php-5.2.5/main -I/usr/local/src/php-5.2.5 -I/usr/local/src/php-5.2.5/ext/date/lib -I/usr/local/src/php-5.2.5/ext/mbstring/libmbfl -I/usr/local/src/php-5.2.5/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php-5.2.5/TSRM -I/usr/local/src/php-5.2.5/Zend    -g  -c /usr/local/src/php-5.2.5/ext/mbstring/mbstring.c -o ext/mbstring/mbstring.lo
/usr/local/src/php-5.2.5/ext/mbstring/mbstring.c(152): ((const int *)([php_mb_default_identify_list_ja : const int[5]] [const int[5]])): incompatible type: qualifier mismatch:: converting const int * -> int *
Fatal error: exception Failure("type check failed (1)")
+ /usr/local/lib/fsc/default/compiler/trans.nc ---sysinclude /usr/local/lib/fsc/default/include -f multi-module -I ext/mbstring/ -I /usr/local/src/php-5.2.5/ext/mbstring/ -I /usr/local/src/php-5.2.5/include -I /usr/local/src/php-5.2.5/main -I /usr/local/src/php-5.2.5 -I /usr/local/src/php-5.2.5/ext/date/lib -I /usr/local/src/php-5.2.5/ext/mbstring/libmbfl -I /usr/local/src/php-5.2.5/ext/mbstring/libmbfl/mbfl -I /usr/local/src/php-5.2.5/TSRM -I /usr/local/src/php-5.2.5/Zend -D PHP_ATOM_INC ---output-file /tmp/fsc-0-7gHRPZ0l/mbstring.safe.c ---input-file /usr/local/src/php-5.2.5/ext/mbstring/mbstring.c
fscc: command /usr/local/lib/fsc/default/compiler/trans.nc returned status 2
make: *** [ext/mbstring/mbstring.lo] Error 1

% make distclean
% env CC=fscc ./configure \
--disable-all \
--without-iconv \
--with-regex=system

% cat ./Makefile | grep fscc
CC = fscc
CPP = fscc -E
% make
/bin/sh /usr/local/src/php-5.2.5/libtool --silent --preserve-dup-deps --mode=compile fscc  -Iext/standard/ -I/usr/local/src/php-5.2.5/ext/standard/ -DPHP_ATOM_INC -I/usr/local/src/php-5.2.5/include -I/usr/local/src/php-5.2.5/main -I/usr/local/src/php-5.2.5 -I/usr/local/src/php-5.2.5/ext/date/lib -I/usr/local/src/php-5.2.5/TSRM -I/usr/local/src/php-5.2.5/Zend    -g  -c /usr/local/src/php-5.2.5/ext/standard/base64.c -o ext/standard/base64.lo
Warning: control reaches bottom of non-void function in __zend_malloc
Warning: control reaches bottom of non-void function in __zend_realloc
/bin/sh /usr/local/src/php-5.2.5/libtool --silent --preserve-dup-deps --mode=compile fscc  -Iext/standard/ -I/usr/local/src/php-5.2.5/ext/standard/ -DPHP_ATOM_INC -I/usr/local/src/php-5.2.5/include -I/usr/local/src/php-5.2.5/main -I/usr/local/src/php-5.2.5 -I/usr/local/src/php-5.2.5/ext/date/lib -I/usr/local/src/php-5.2.5/TSRM -I/usr/local/src/php-5.2.5/Zend    -g  -c /usr/local/src/php-5.2.5/ext/standard/basic_functions.c -o ext/standard/basic_functions.lo
Fatal error: exception Assert_failure("ctt_visitor.ml", 129, 26)
+ /usr/local/lib/fsc/default/compiler/trans.nc ---sysinclude /usr/local/lib/fsc/default/include -f multi-module -I ext/standard/ -I /usr/local/src/php-5.2.5/ext/standard/ -I /usr/local/src/php-5.2.5/include -I /usr/local/src/php-5.2.5/main -I /usr/local/src/php-5.2.5 -I /usr/local/src/php-5.2.5/ext/date/lib -I /usr/local/src/php-5.2.5/TSRM -I /usr/local/src/php-5.2.5/Zend -D PHP_ATOM_INC ---output-file /tmp/fsc-0-awGa6qNj/basic_functions.safe.c ---input-file /usr/local/src/php-5.2.5/ext/standard/basic_functions.c
fscc: command /usr/local/lib/fsc/default/compiler/trans.nc returned status 2
make: *** [ext/standard/basic_functions.lo] Error 1