Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#16590 closed defect (worksforme)

php5 5.2.6: malloc.h: No such file or directory

Reported by: news@… Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 1.6.0
Keywords: php5 OS X Cc: jyrkiwahlstedt
Port: php5

Description

I get the following error while trying to install php5 5.2.6 on OSX 10.4.11

/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/libxml/libxml.c: In function '_php_list_set_error_structure':
/bin/sh /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/libtool --silent --preserve-dup-deps --mode=compile /usr/bin/gcc-4.0  -Iext/dom/ -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/dom/ -DPHP_ATOM_INC -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/main -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6 -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/date/lib -I/opt/local/include/freetype2 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/mbstring/oniguruma -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/mbstring/libmbfl -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/mbstring/libmbfl/mbfl -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/mysql5/include/mysql -I/opt/local/include/mysql5/mysql -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/TSRM -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/Zend  -I/opt/local/include -no-cpp-precomp  -I/opt/local/include -O2  -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/dom/domerrorhandler.c -o ext/dom/domerrorhandler.lo 
/bin/sh /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/libtool --silent --preserve-dup-deps --mode=compile /usr/bin/gcc-4.0  -Iext/dom/ -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/dom/ -DPHP_ATOM_INC -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/main -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6 -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/date/lib -I/opt/local/include/freetype2 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/mbstring/oniguruma -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/mbstring/libmbfl -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/mbstring/libmbfl/mbfl -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/mysql5/include/mysql -I/opt/local/include/mysql5/mysql -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/TSRM -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/Zend  -I/opt/local/include -no-cpp-precomp  -I/opt/local/include -O2  -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/dom/domerror.c -o ext/dom/domerror.lo 
/bin/sh /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/libtool --silent --preserve-dup-deps --mode=compile /usr/bin/gcc-4.0  -DNOT_RUBY -DHAVE_CONFIG_H -Iext/mbstring/ -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/mbstring/ -DPHP_ATOM_INC -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/main -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6 -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/date/lib -I/opt/local/include/freetype2 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/mbstring/oniguruma -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/mbstring/libmbfl -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/mbstring/libmbfl/mbfl -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/mysql5/include/mysql -I/opt/local/include/mysql5/mysql -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/TSRM -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/Zend  -I/opt/local/include -no-cpp-precomp  -I/opt/local/include -O2  -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6/ext/mbstring/oniguruma/regerror.c -o ext/mbstring/oniguruma/regerror.lo 
/opt/local/include/mutils/mincludes.h:66:20: error: malloc.h: No such file or directory
make: *** [ext/mhash/mhash.lo] Error 1
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/php-5.2.6" && make all " returned error 2
/opt/local/include/mutils/mincludes.h:66:20: error: malloc.h: No such file or directory
make: *** [ext/mhash/mhash.lo] Error 1
Error: Status 1 encountered during processing.

I figured out a way to compile it anyway. First i checked who provides mhash.h Then I commented out the #include <malloc.h> stuff. After that php 5.2.6 build fine

medianet@intermac1:/opt/local/include/mutils$ port provides mhash.h
/opt/local/include/mutils/mhash.h is provided by: mhash

medianet@intermac1:/opt/local/include/mutils$ port list mhash
mhash                          @0.9.9          devel/mhash
medianet@intermac1:/opt/local/include/mutils$ port info mhash
mhash 0.9.9, devel/mhash (Variants: universal)
http://mhash.sourceforge.net/

Libmhash is a library which implements some hash algorithms like crc32, md5 and sha-1.

Platforms: darwin freebsd
Maintainers: ryandesign@macports.org openmaintainer@macports.org
medianet@intermac1:/opt/local/include/mutils$ 



medianet@intermac1:/opt/local/include/mutils$ sudo vi mincludes.h


/*
#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
*/ 

medianet@intermac1:/opt/local/include/mutils$ sudo port -v upgrade php5

Change History (7)

comment:1 Changed 16 years ago by mf2k (Frank Schima)

Cc: jwa@… added
Owner: changed from macports-tickets@… to ryandesign@…

comment:2 Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)

I have been building php for years on Mac OS X on several machines without ever encountering this problem. Something must be different about your system.

I see these definitions in ${prefix}/include/mutils/mhash_config.h:

/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
   to 0 otherwise. */
#define HAVE_MALLOC 1

/* Define to 1 if you have the <malloc.h> header file. */
/* #undef HAVE_MALLOC_H */

Also I have this in ${prefix}/include/php/main/php_config.h:

/* Define if you have the <malloc.h> header file.  */
/* #undef HAVE_MALLOC_H */

So on my system, HAVE_MALLOC_H is 0, thus it's never trying to include malloc.h. This is correct for Mac OS X according to Apple documentation. But on yours I suspect HAVE_MALLOC_H is 1, so it is trying to include it. Now we need to figure out why.

Do you have the same definitions in your mhash_config.h and php_config.h files?

What version of Xcode are you using? Get info on /Developer/Applications/Xcode.app to find out. I'm using 2.5. Please update if you have anything earlier than 2.4.1.

Do you have anything installed in /usr/local, or do you have Fink installed (in /sw)? These can interfere with MacPorts and should be removed if present.

comment:3 in reply to:  2 ; Changed 16 years ago by news@…

Replying to ryandesign@…:

I see these definitions in ${prefix}/include/mutils/mhash_config.h:

/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
   to 0 otherwise. */
#define HAVE_MALLOC 1

/* Define to 1 if you have the <malloc.h> header file. */
/* #undef HAVE_MALLOC_H */

Also I have this in ${prefix}/include/php/main/php_config.h:

/* Define if you have the <malloc.h> header file.  */
/* #undef HAVE_MALLOC_H */

So on my system, HAVE_MALLOC_H is 0, thus it's never trying to include malloc.h. This is correct for Mac OS X according to Apple documentation. But on yours I suspect HAVE_MALLOC_H is 1, so it is trying to include it. Now we need to figure out why.

Do you have the same definitions in your mhash_config.h and php_config.h files?

Thats what i have in:

/opt/local/include/php/main/php_config.h

/* Define if you have the <malloc.h> header file.  */
/* #undef HAVE_MALLOC_H */

and in:

/opt/local/include/mutils/mhash_config.h

/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
   to 0 otherwise. */
#define HAVE_MALLOC 1

/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 0

So it seems to me that my files not differ from yours.

What version of Xcode are you using? Get info on /Developer/Applications/Xcode.app to find out. I'm using 2.5. Please update if you have anything earlier than 2.4.1.

medianet@intermac1:/Developer/Applications/Xcode.app/Contents$ more version.plist

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-Apple ComputerDTD PLIST 1.0EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict>

<key>BuildVersion</key> <string>2</string> <key>CFBundleShortVersionString</key> <string>2.5</string> <key>CFBundleVersion</key> <string>799</string> <key>ProjectName</key> <string>DevToolsIDE</string> <key>SourceVersion</key> <string>7990000</string>

</dict> </plist>

Do you have anything installed in /usr/local, or do you have Fink installed (in /sw)? These can interfere with MacPorts and should be removed if present.


No /sw directory on this machine

Under /usr/local there are a few things installed. What do I have to check there?

Any way to find out what ist filling my HAVE_MALLOC_H ??

I found a lot of malloc.h files in:

medianet@intermac1:/usr/local$ locate malloc.h
/Developer/SDKs/MacOSX10.3.9.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/malloc.h
/Developer/SDKs/MacOSX10.3.9.sdk/usr/include/malloc/malloc.h
/Developer/SDKs/MacOSX10.3.9.sdk/usr/include/objc/malloc.h
/Developer/SDKs/MacOSX10.3.9.sdk/usr/include/sys/malloc.h
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/malloc.h
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/malloc/malloc.h
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/objc/malloc.h
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/sys/malloc.h
/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/malloc.h
/opt/local/var/macports/software/cgilib/0.5_2/opt/local/include/malloc.h
/usr/include/malloc/malloc.h
/usr/include/objc/malloc.h
/usr/include/sys/malloc.h

Maybe I can delete all of them ?? But is this save ?

Or is my last change to clean the harddrive, instal 10.5.x and reinstall all ports and programs again?

Greetings an many thanks for your help from Germany

Jürgen

comment:4 in reply to:  3 ; Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to news@…:

Under /usr/local there are a few things installed. What do I have to check there?

Try moving /usr/local aside (rename it), clean php5 and try installing it again.

sudo mv /usr/local /usr/local-off
sudo port clean --work php5

Any way to find out what ist filling my HAVE_MALLOC_H ??

I'm not sure at the moment.

I found a lot of malloc.h files in: [snip] Maybe I can delete all of them ?? But is this save ?

You should not delete those files; they are part of your operating system and belong right where they are. :) I have them on my system too -- except for /opt/local/var/macports/software/cgilib/0.5_2/opt/local/include/malloc.h. I don't have the cgilib port installed. You might try uninstalling the cgilib port and see if that helps, though I don't see how: a) it looks like your cgilib port is not active (else locate should have found /opt/local/include/malloc.h too) and inactive ports shouldn't affect anything, and b) the error is that malloc.h cannot be found, so it's not even trying to use cgilib's malloc.h.

Or is my last change to clean the harddrive, instal 10.5.x and reinstall all ports and programs again?

Hopefully that won't be necessary but if moving /usr/local doesn't help I'm not sure what to suggest next. Though perhaps if you attach your config.log it will reveal something.

comment:5 in reply to:  4 Changed 16 years ago by news@…

Replying to ryandesign@…:

Replying to news@…:

Under /usr/local there are a few things installed. What do I have to check there?

Try moving /usr/local aside (rename it), clean php5 and try installing it again.

sudo mv /usr/local /usr/local-off
sudo port clean --work php5


OK ! But under /usr/local are some critical apps installed. So this is not possible at the moment. If I find some time I'll try it anyway.

As I already wrote I got php5 to work fine with some changes in mincludes.h which comes with mhash.

medianet@intermac1:/opt/local/include/mutils$ sudo vi mincludes.h


/*
#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
*/ 

I think the problem must sit somewhere around this port (sorry for my english, I'm german)

So this port or any of the ports included by php5 may have set the <HAVE_MALLOC_H> to <1>

But for now I think I live with my workaround.

Thanks again for any help

Jürgen

comment:6 Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: worksforme
Status: newclosed
Summary: php5 5.2.6 on OSX 10.4.11 build fails (possible fix included)php5 5.2.6: malloc.h: No such file or directory

Closing, since we could not rule out interference from something in /usr/local. If you can reproduce this with an empty /usr/local, please re-open.

comment:7 Changed 16 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

Note: See TracTickets for help on using tickets.