From 6c0cf516c02486065eb873cfdfc4a25aded0efff Mon Sep 17 00:00:00 2001 From: Sebastien Date: Mon, 13 Apr 2020 11:41:50 -0400 Subject: [PATCH] fix compile issue on latest esp-idf v4 - release --- components/squeezelite/CMakeLists.txt | 1 + components/tools/CMakeLists.txt | 8 +++++++- components/tools/operator.cpp | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 components/tools/operator.cpp diff --git a/components/squeezelite/CMakeLists.txt b/components/squeezelite/CMakeLists.txt index ab0d8fb9..cd70f6cb 100644 --- a/components/squeezelite/CMakeLists.txt +++ b/components/squeezelite/CMakeLists.txt @@ -12,6 +12,7 @@ idf_component_register( SRC_DIRS . external a1s tas57xx services raop display + tools EMBED_FILES vu.data ) diff --git a/components/tools/CMakeLists.txt b/components/tools/CMakeLists.txt index 1adbb44c..07b3ba12 100644 --- a/components/tools/CMakeLists.txt +++ b/components/tools/CMakeLists.txt @@ -1,4 +1,10 @@ -idf_component_register(SRC_DIRS . +idf_component_register(SRCS operator.cpp utf8.c REQUIRES esp_common pthread INCLUDE_DIRS . ) + +#doing our own implementation of new operator for some pre-compiled binaries +target_link_libraries(${COMPONENT_LIB} INTERFACE "-u _ZdlPv") +target_link_libraries(${COMPONENT_LIB} INTERFACE "-u _Znwj") + + \ No newline at end of file diff --git a/components/tools/operator.cpp b/components/tools/operator.cpp new file mode 100644 index 00000000..47afbbd1 --- /dev/null +++ b/components/tools/operator.cpp @@ -0,0 +1,3 @@ +#include // for malloc and free +void* operator new(unsigned int size) { return malloc(size); } +void operator delete(void* ptr) { if (ptr) free(ptr); }