From 1d60a66a7bb78ccca4e1b8d35c89606c3ee24d9b Mon Sep 17 00:00:00 2001 From: Robert Izzard <r.izzard@surrey.ac.uk> Date: Wed, 11 Dec 2019 15:10:27 +0000 Subject: [PATCH] updates to build better when malloc.h is not availabe (e.g. on mac) update meson.build to check for objcopy --- meson.build | 11 ++++++++++- src/binary_c_code_options.h | 2 +- src/debug/backtrace-symbols.c | 2 ++ src/librinterpolate/rinterpolate.h | 1 - src/librinterpolate/rinterpolate_alloc_hypertable.c | 5 +---- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 72640a178..fce95952b 100644 --- a/meson.build +++ b/meson.build @@ -58,6 +58,10 @@ find_program('meson', find_program('ninja', version: '>=1.8.2') +############################################################ +# require objcopy +find_program('objcopy') + ############################################################ # compiler object # @@ -321,6 +325,7 @@ elif os == 'darwin' cflags += [ '-DDARWIN', '-DPOSIX', + '-D_XOPEN_SOURCE', ] unix = true posix = true @@ -630,7 +635,11 @@ run_command('meson/make_version_macros.pl') # # list and build them message('Checking and building data objects') -data_objects = run_command('meson/data_object_list_and_build.sh').stdout().strip().split(' ') +data_objects_compilation = run_command('meson/data_object_list_and_build.sh') +if data_objects_compilation.returncode() != 0 + error('There was a problem building the data objects. Please check that you have objcopy installed, and try running meson/data_object_list_and_build.sh from the binary_c root directory manually to check for errors') +endif +data_objects = data_objects_compilation.stdout().strip().split(' ') if get_option('clean_data_objects') == true run_command('meson/clean_data_objects.sh') diff --git a/src/binary_c_code_options.h b/src/binary_c_code_options.h index 80a7fd53b..98a66eb3d 100644 --- a/src/binary_c_code_options.h +++ b/src/binary_c_code_options.h @@ -157,7 +157,7 @@ * provide it through a macro so it's easily changed on other * systems. */ -#if defined __GNUC__ +#if defined __GNUC__ && defined __HAVE_MALLOC_H__ #define HAVE_MALLOC_USABLE_SIZE #define Malloc_usable_size(X) malloc_usable_size(X) #else diff --git a/src/debug/backtrace-symbols.c b/src/debug/backtrace-symbols.c index 6d91eb404..c4627dbe1 100644 --- a/src/debug/backtrace-symbols.c +++ b/src/debug/backtrace-symbols.c @@ -47,7 +47,9 @@ #endif // __HAVE_LIBIBERTY_LIBIBERTYH__ #endif // __HAVE_LIBIBERTY__ #include <string.h> +#ifdef __HAVE_MALLOC_H__ #include <malloc.h> +#endif//__HAVE_MALLOC_H__ #include <stdio.h> #include <stdlib.h> #include <execinfo.h> diff --git a/src/librinterpolate/rinterpolate.h b/src/librinterpolate/rinterpolate.h index e23a17060..aa2e654a4 100644 --- a/src/librinterpolate/rinterpolate.h +++ b/src/librinterpolate/rinterpolate.h @@ -14,7 +14,6 @@ #include <math.h> #include <float.h> #include <stdio.h> -#include <malloc.h> #include "rinterpolate_compiler.h" /************************************************************ diff --git a/src/librinterpolate/rinterpolate_alloc_hypertable.c b/src/librinterpolate/rinterpolate_alloc_hypertable.c index c70c76765..b951aa94e 100644 --- a/src/librinterpolate/rinterpolate_alloc_hypertable.c +++ b/src/librinterpolate/rinterpolate_alloc_hypertable.c @@ -8,9 +8,6 @@ #include "rinterpolate.h" #include "rinterpolate_internal.h" -#ifdef RINTERPOLATE_USE_REALLOC -#include <malloc.h> -#endif void rinterpolate_alloc_hypertable(struct rinterpolate_table_t * RESTRICT const table) { @@ -54,4 +51,4 @@ void rinterpolate_alloc_hypertable(struct rinterpolate_table_t * RESTRICT const } #endif // __HAVE_LIBRINTERPOLATE__ - \ No newline at end of file + -- GitLab