error: ‘__GMP_BITS_PER_MP_LIMB’ undeclared

2017年1月10日 | 分类: 【技术】

编译PHP5.2.17时,报错:

...
ext/gmp/gmp.c: In function ‘zif_gmp_random’:
ext/gmp/gmp.c:1399:69: error: ‘__GMP_BITS_PER_MP_LIMB’ undeclared (first use in this function)
ext/gmp/gmp.c:1399:69: note: each undeclared identifier is reported only once for each function it appears in
...

方法,打开源码目录下的 ext/gmp/gmp.c ,在1399行,将 __GMP_BITS_PER_MP_LIMB 替换为 GMP_LIMB_BITS 。

	mpz_urandomb(*gmpnum_result, GMPG(rand_state), GMP_ABS (limiter) * GMP_LIMB_BITS);

参考:http://www.cnblogs.com/zhanghw0354/archive/2012/09/23/2698951