aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Marquez Tello <pablo.tello@arm.com>2021-11-18 10:15:23 +0000
committerPablo Marquez Tello <pablo.tello@arm.com>2021-11-24 10:28:01 +0000
commit48f261526b77f61607478f3f809dd8647e626f2b (patch)
tree9e72fca4da6c61643f9d8c93475ed57b46c8b3f5
parent9e8a7701532377073220613b3642468f96cba62f (diff)
downloadComputeLibrary-48f261526b77f61607478f3f809dd8647e626f2b.tar.gz
Fixed build errors
* Resolves problem in macOS Monterey + Clang 13 where there is no memalloc and memalign must be used * Resolves builld error when passing an empty list of files to the AR tool * Resolves MLCE-685 Change-Id: I862ff1dc7f74b2ba32479f6e8abaa32a88d47995 Signed-off-by: Pablo Marquez Tello <pablo.tello@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6706 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gunes Bayir <gunes.bayir@arm.com> Reviewed-by: Giorgio Arena <giorgio.arena@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--SConscript7
-rw-r--r--src/cpu/CpuContext.cpp9
2 files changed, 12 insertions, 4 deletions
diff --git a/SConscript b/SConscript
index 6198445b08..a8995aca92 100644
--- a/SConscript
+++ b/SConscript
@@ -540,7 +540,12 @@ if env['os'] != 'bare_metal' and not env['standalone']:
Export('arm_compute_so')
# Generate dummy core lib for backwards compatibility
-arm_compute_core_a = build_library('arm_compute_core-static', arm_compute_env, [], static=True)
+if env['os'] == 'macos':
+ # macos static library archiver fails if given an empty list of files
+ arm_compute_core_a = build_library('arm_compute_core-static', arm_compute_env, [lib_files], static=True)
+else:
+ arm_compute_core_a = build_library('arm_compute_core-static', arm_compute_env, [], static=True)
+
Export('arm_compute_core_a')
if env['os'] != 'bare_metal' and not env['standalone']:
diff --git a/src/cpu/CpuContext.cpp b/src/cpu/CpuContext.cpp
index 1a971a6a16..917bf68a0c 100644
--- a/src/cpu/CpuContext.cpp
+++ b/src/cpu/CpuContext.cpp
@@ -28,7 +28,10 @@
#include "src/cpu/CpuTensor.h"
#include <cstdlib>
+#if !defined(__APPLE__)
#include <malloc.h>
+#endif // !defined(__APPLE__)
+
namespace arm_compute
{
@@ -50,11 +53,11 @@ void *default_aligned_allocate(void *user_data, size_t size, size_t alignment)
{
ARM_COMPUTE_UNUSED(user_data);
void *ptr = nullptr;
-#if defined(BARE_METAL) || defined(__APPLE__)
+#if defined(BARE_METAL)
size_t rem = size % alignment;
size_t real_size = (rem) ? (size + alignment - rem) : size;
ptr = memalign(alignment, real_size);
-#else /* defined(BARE_METAL) || defined(__APPLE__) */
+#else /* defined(BARE_METAL) */
if(posix_memalign(&ptr, alignment, size) != 0)
{
// posix_memalign returns non-zero on failures, the return values will be
@@ -62,7 +65,7 @@ void *default_aligned_allocate(void *user_data, size_t size, size_t alignment)
// - ENOMEM: insufficient memory
ARM_COMPUTE_LOG_ERROR_ACL("posix_memalign failed, the returned pointer will be invalid");
}
-#endif /* defined(BARE_METAL) || defined(__APPLE__) */
+#endif /* defined(BARE_METAL) */
return ptr;
}
void default_aligned_free(void *user_data, void *ptr)