[patch] configure should refuse to build with jemalloc when headers are missing
--with-jemalloc option is passed, the configure script will correctly fail with an error if the library is missing. However, if the library is present and headers are missing, configure will succeed and allow the build to proceed. The actual build is unlikely to succeed in this case since the functions won't be defined.
Steps to reproduce:
- Install jemalloc.
- Delete jemalloc's headers.
- Run ./configure --with-jemalloc &&is make
configure fails because the requested jemalloc's headers are missing
configure succeeds. On macOS, the build then fails with the following:
compiling gc.c gc.c:7955:12: error: implicit declaration of function 'malloc_usable_size' is invalid in C99 [-Werror,-Wimplicit-function-declaration] return malloc_usable_size(ptr); ^ gc.c:7955:12: note: did you mean 'malloc_good_size'? /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/malloc/malloc.h:134:15: note: 'malloc_good_size' declared here extern size_t malloc_good_size(size_t size); ^ 1 error generated. make: *** [gc.o] Error 1
The attached patch fixes this by ensuring that configure fails if
--with-jemalloc is passed but the headers are missing in the same way that it will fail if the library is missing.
This patch is against trunk. I've also reproduced it in several previous versions of Ruby.
Updated by shevegen (Robert A. Heiler) over 3 years ago
The actual build is unlikely to succeed in this case since the functions won't be defined.
Agreed, makes sense to me. I remember that I may run into similar situations every now
and then when I e. g. wish to upgrade some program manually on my own but may have
forgotten to remove all old parts of that program (e. g. under the /usr/ hierarchy). I don't
know if this applies to Mac but on Linux I remember similar situations here and there.
Updated by nobu (Nobuyoshi Nakada) over 3 years ago
- Status changed from Open to Closed