Compiling PHP with GD crashes with EXC_BREAKPOINT (SIGTRAP) on PPC Mac

0

First of all, I should say that I have searched the whole Internet for this problem but I couldn't find any solution yet.

I have a Mac mini PowerPC (PPC) and I run Apache webserver (httpd-2.2.22) with PHP (5.4.0) and I do all the configure & compilation jobs by myself.

If configure with:
'./configure' '--prefix=/usr/local/php5' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--sysconfdir=/etc' '--with-config-file-path=/etc' '--with-zlib' '--with-zlib-dir=/usr' '--with-openssl=/usr' '--without-iconv' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--enable-mbregex' '--enable-sockets' '--with-mysql=/usr/local/mysql' '--with-pdo-mysql=/usr/local/mysql' '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mcrypt'

then the PHP works flawlessly. But if I add the GD module by adding these to the script above:

'--with-gd' '--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/X11R6' '--with-png-dir=/usr/X11R6' '--with-xpm-dir=/usr/X11R6'

the PHP gets configured and compiled without any errors but it causes EXC_BREAKPOINT (SIGTRAP) (see the Crash Reporter log below) when I request a page which calls PHP module.

It's obvious that something related to the GD module is causing this, probably FreeType module because it's present in the log but it may not be definite of course.

When the PHP crashes (or more accurately, httpd) the CPU goes 100% for 10 to 15 seconds until it recovers.

I need to use the GD module and keep the Mac mini PowerPC. So, what should I do to solve this problem?

Process:         httpd [79852]
Path:            /usr/local/apache2/bin/httpd
Identifier:      httpd
Version:         ??? (???)
Code Type:       PPC (Native)
Parent Process:  httpd [79846]

Date/Time:       2013-11-04 15:44:28.444 +0200
OS Version:      Mac OS X 10.5.8 (9L31a)
Report Version:  6
Anonymous UUID:  0178B7F8-2241-43F7-A651-9E7234D41A37

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000093c11e0c
Crashed Thread:  0

Application Specific Information:
*** single-threaded process forked ***

Thread 0 Crashed:
0   com.apple.CoreFoundation        0x93c11e0c __CFRunLoopFindMode + 328
1   com.apple.CoreFoundation        0x93c13d88 CFRunLoopAddSource + 276
2   com.apple.DiskArbitration       0x901a6e8c DAApprovalSessionScheduleWithRunLoop + 52
3   ...ple.CoreServices.CarbonCore  0x9512e67c _FSGetDiskArbSession(__DASession**, __DAApprovalSession**) + 540
4   ...ple.CoreServices.CarbonCore  0x9512e420 CreateDiskArbDiskForMountPath(char const*) + 84
5   ...ple.CoreServices.CarbonCore  0x9512d2c8 FSCacheableClient_GetVolumeCachedInfo(char const*, statfs const*, CachedVolumeInfo*, __DADisk*, __DADisk**) + 280
6   ...ple.CoreServices.CarbonCore  0x9512cca4 MountVolume(char const*, statfs*, unsigned char, unsigned char, __DADisk*, short*) + 352
7   ...ple.CoreServices.CarbonCore  0x9512ca48 MountInitialVolumes() + 172
8   ...ple.CoreServices.CarbonCore  0x9512c4d4 INIT_FileManager() + 164
9   ...ple.CoreServices.CarbonCore  0x9512c390 GetRetainedVolFSVCBByVolumeID(unsigned long) + 48
10  ...ple.CoreServices.CarbonCore  0x9512adf4 PathGetObjectInfo(char const*, unsigned long, unsigned long, VolumeInfo**, unsigned long*, unsigned long*, char*, unsigned long*, unsigned char*) + 184
11  ...ple.CoreServices.CarbonCore  0x9512acc4 FSPathMakeRefInternal(unsigned char const*, unsigned long, unsigned long, FSRef*, unsigned char*) + 64
12  libfreetype.6.dylib             0x0070a0fc FT_New_Face_From_Resource + 56
13  libfreetype.6.dylib             0x0070a3b0 FT_New_Face + 48
14  libphp5.so                      0x0118d1a8 fontFetch + 824
15  libphp5.so                      0x0118edac php_gd_gdCacheGet + 220
16  libphp5.so                      0x0118d6d8 php_gd_gdImageStringFTEx + 360
17  libphp5.so                      0x011763c0 php_imagettftext_common + 1504
18  libphp5.so                      0x01176494 zif_imagefttext + 20
19  libphp5.so                      0x014b9c68 zend_do_fcall_common_helper_SPEC + 1048
20  libphp5.so                      0x01452898 _ZEND_DO_FCALL_SPEC_CONST_HANDLER + 440
21  libphp5.so                      0x014ba878 execute + 776
22  libphp5.so                      0x013f190c zend_execute_scripts + 316
23  libphp5.so                      0x013779f4 php_execute_script + 596
24  libphp5.so                      0x014bbe64 php_handler + 1972
25  httpd                           0x000020c0 ap_run_handler + 96
26  httpd                           0x00006ae0 ap_invoke_handler + 224
27  httpd                           0x000305c4 ap_process_request + 116
28  httpd                           0x0002c768 ap_process_http_connection + 104
29  httpd                           0x00012d30 ap_run_process_connection + 96
30  httpd                           0x00012ecc ap_process_connection + 92
31  httpd                           0x000373e4 child_main + 1220
32  httpd                           0x000376a8 make_child + 296
33  httpd                           0x000377e4 startup_children + 100
34  httpd                           0x000387d4 ap_mpm_run + 3988
35  httpd                           0x0000a320 main + 3280
36  httpd                           0x000019c0 start + 64
php
macos
gd
asked on Stack Overflow Nov 4, 2013 by Terry

1 Answer

0

The cause and solution of the problem are found: As I suspected, the cause of the problem was FreeType, or more precisely its relation to Apple.CoreServices.CarbonCore and the solution is to decouple FreeType from CarbonCode and here is how it is done:

reconfigure FreeType library like this:

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bindatload" ./configure --with-fsspec=no --with-fsref=no --with-quickdraw-toolbox=no --with-quickdraw-carbon=no

Note the "no" options at the end, they decouple FT from CC. I don't know if the preceding LDFLAGS and -bindatload expressions are necessary, but I put them as is.

After this reconfiguration and a general PHP recompilation, the GD extension started to work flawlessly.

answered on Stack Overflow Nov 5, 2013 by Terry

User contributions licensed under CC BY-SA 3.0