Detection of malloc.h doesn't work properly, at least not on Mac.
With existing configulation it fails with:
checking malloc.h usability... no checking malloc.h presence... no checking for malloc.h... no checking for stdbool.h that conforms to C99... yes checking for _Bool... yes checking for an ANSI C-conforming const... yes checking for inline... inline checking for size_t... yes checking whether time.h and sys/time.h may both be included... yes checking for working volatile... yes checking whether closedir returns void... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... no ... Undefined symbols for architecture x86_64: "_rpl_malloc", referenced from: _br_strcat in prefix.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[3]: *** [codeblocks] Error 1 make[2]: *** [all-recursive] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all-recursive] Error 1
The following workaround fixes the problem (but you probably need to modify it):
--- configure.ac.orig +++ configure.ac @@ -36,7 +36,7 @@ AC_PROG_LIBTOOL dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/param.h unistd.h malloc.h]) +AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/param.h unistd.h sys/malloc.h]) dnl Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL
The problem with this patch is that it will break the compilation for other OSes...
Sure, I didn't ask you to include that patch literally.
(I'm just saying that the workaround worked for me. The final patch needs to be slightly different, but I don't know what would be the proper way.)
GPERF tools do it like this:
AC_CHECK_HEADERS(malloc.h) # some systems define stuff there, others not
AC_CHECK_HEADERS(sys/malloc.h) # where some versions of OS X put malloc.h
AC_CHECK_HEADERS(malloc/malloc.h) # another place OS X puts malloc.h (?)
...and it works.
So what SHOULD work for us is:
-AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/param.h unistd.h malloc.h])
+AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/param.h unistd.h malloc.h sys/malloc.h malloc/malloc.h])
Teodor/Mojca : If yo are on Linux, can you give it a try?
Just for the reference, here's what I get on a Mac after the proposed change:
I assume that it will work (and will report back in case I'm wrong if it fails some time later during the build).
I haven't tried building CB on linux yet, but I can report once I get access to a suitable setup.
OK, not too bad. I'll still wait to have that confirmed for Linux...
That's what I get on linux:
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking sys/malloc.h usability... no
checking sys/malloc.h presence... no
checking for sys/malloc.h... no
checking malloc/malloc.h usability... no
checking malloc/malloc.h presence... no
checking for malloc/malloc.h... no
and it compiles fine and seems to work.
Fixed a long time ago, actually...