From 195ace04b81df05723717292c3c943a00a138c33 Mon Sep 17 00:00:00 2001 From: Jacob Su Date: Fri, 19 Apr 2024 10:28:37 +0800 Subject: [PATCH] fix compile errors on macOS 14.4 m2 chip. --- contrib/CMakeLists.txt | 2 ++ include/os/osString.h | 7 ++++++- source/client/CMakeLists.txt | 12 +++++------- source/dnode/mgmt/mgmt_snode/CMakeLists.txt | 5 ++++- source/dnode/mgmt/mgmt_vnode/CMakeLists.txt | 5 ++++- source/dnode/vnode/CMakeLists.txt | 3 +++ source/libs/executor/CMakeLists.txt | 2 ++ source/libs/function/CMakeLists.txt | 3 +++ source/libs/monitorfw/CMakeLists.txt | 2 +- source/libs/sync/CMakeLists.txt | 1 + source/os/src/osString.c | 4 ---- tools/shell/src/shellEngine.c | 2 +- 12 files changed, 32 insertions(+), 16 deletions(-) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index ccd60df19a..4cdafe539f 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -251,11 +251,13 @@ target_include_directories( # zlib set(CMAKE_PROJECT_INCLUDE_BEFORE "${TD_SUPPORT_DIR}/EnableCMP0048.txt.in") add_subdirectory(zlib EXCLUDE_FROM_ALL) +target_compile_options(zlibstatic PRIVATE -Wno-error=deprecated-non-prototype) target_include_directories( zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/zlib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/zlib ) +target_compile_options(zlib PRIVATE -Wno-error=deprecated-non-prototype) target_include_directories( zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/zlib diff --git a/include/os/osString.h b/include/os/osString.h index 1aca119293..fd8e34f539 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -22,7 +22,12 @@ extern "C" { typedef wchar_t TdWchar; typedef int32_t TdUcs4; -typedef void *iconv_t; +#ifndef DISALLOW_NCHAR_WITHOUT_ICONV +#include "iconv.h" +#else + typedef void *iconv_t; +#endif + typedef enum { M2C = 0, C2M } ConvType; // If the error is in a third-party library, place this header file under the third-party library header file. diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt index a17c27c297..293251f35d 100644 --- a/source/client/CMakeLists.txt +++ b/source/client/CMakeLists.txt @@ -10,6 +10,8 @@ else() add_library(taos SHARED ${CLIENT_SRC}) endif() +target_compile_options(taos PRIVATE -Wno-error=deprecated-non-prototype) + INCLUDE_DIRECTORIES(jni) target_include_directories( @@ -23,13 +25,6 @@ target_link_libraries( PRIVATE os util common transport monitor nodes parser command planner catalog scheduler function qcom geometry ) -if(TD_DARWIN_ARM64) - target_link_libraries( - taos - PRIVATE "-arch x86_64" - ) -endif() - if(TD_WINDOWS) INCLUDE_DIRECTORIES(jni/windows) INCLUDE_DIRECTORIES(jni/windows/win32) @@ -53,6 +48,9 @@ set_target_properties( ) add_library(taos_static STATIC ${CLIENT_SRC}) + +target_compile_options(taos_static PRIVATE -Wno-error=deprecated-non-prototype) + target_include_directories( taos_static PUBLIC "${TD_SOURCE_DIR}/include/client" diff --git a/source/dnode/mgmt/mgmt_snode/CMakeLists.txt b/source/dnode/mgmt/mgmt_snode/CMakeLists.txt index 62dc41a0ae..59ea95631a 100644 --- a/source/dnode/mgmt/mgmt_snode/CMakeLists.txt +++ b/source/dnode/mgmt/mgmt_snode/CMakeLists.txt @@ -1,9 +1,12 @@ aux_source_directory(src MGMT_SNODE) add_library(mgmt_snode STATIC ${MGMT_SNODE}) + +target_compile_options(mgmt_snode PRIVATE -Wno-error=deprecated-non-prototype) + target_include_directories( mgmt_snode PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( mgmt_snode node_util -) \ No newline at end of file +) diff --git a/source/dnode/mgmt/mgmt_vnode/CMakeLists.txt b/source/dnode/mgmt/mgmt_vnode/CMakeLists.txt index 15b822ad92..0cfd1da1e1 100644 --- a/source/dnode/mgmt/mgmt_vnode/CMakeLists.txt +++ b/source/dnode/mgmt/mgmt_vnode/CMakeLists.txt @@ -1,9 +1,12 @@ aux_source_directory(src MGMT_VNODE) add_library(mgmt_vnode STATIC ${MGMT_VNODE}) + +target_compile_options(mgmt_vnode PRIVATE -Wno-error=deprecated-non-prototype) + target_include_directories( mgmt_vnode PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( mgmt_vnode node_util -) \ No newline at end of file +) diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 43e680c382..886bbf4855 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -1,6 +1,9 @@ # vnode add_subdirectory(src/tqCommon) add_library(vnode STATIC "") + +target_compile_options(vnode PRIVATE -Wno-error=single-bit-bitfield-constant-conversion) + set( VNODE_SOURCE_FILES "src/vnd/vnodeOpen.c" diff --git a/source/libs/executor/CMakeLists.txt b/source/libs/executor/CMakeLists.txt index 838233346e..be94f3145f 100644 --- a/source/libs/executor/CMakeLists.txt +++ b/source/libs/executor/CMakeLists.txt @@ -2,6 +2,8 @@ aux_source_directory(src EXECUTOR_SRC) add_library(executor STATIC ${EXECUTOR_SRC}) +target_compile_options(executor PRIVATE -Wno-error=deprecated-non-prototype) + target_link_libraries(executor PRIVATE os util common function parser planner qcom scalar nodes index wal tdb geometry ) diff --git a/source/libs/function/CMakeLists.txt b/source/libs/function/CMakeLists.txt index 3a68648d49..305fd29832 100644 --- a/source/libs/function/CMakeLists.txt +++ b/source/libs/function/CMakeLists.txt @@ -141,6 +141,9 @@ target_link_libraries( #SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/build/bin) add_executable(udfd src/udfd.c) + +target_compile_options(udfd PRIVATE -Wno-error=deprecated-non-prototype) + target_include_directories( udfd PUBLIC diff --git a/source/libs/monitorfw/CMakeLists.txt b/source/libs/monitorfw/CMakeLists.txt index 610cd63985..cd00c2e2a1 100644 --- a/source/libs/monitorfw/CMakeLists.txt +++ b/source/libs/monitorfw/CMakeLists.txt @@ -5,5 +5,5 @@ target_include_directories( PUBLIC "${TD_SOURCE_DIR}/include/libs/monitorfw" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) - +target_compile_options(monitorfw PRIVATE -Wno-error=deprecated-pragma) target_link_libraries(monitorfw os util common transport) diff --git a/source/libs/sync/CMakeLists.txt b/source/libs/sync/CMakeLists.txt index 6025070cb7..d3344ea6fa 100644 --- a/source/libs/sync/CMakeLists.txt +++ b/source/libs/sync/CMakeLists.txt @@ -1,6 +1,7 @@ aux_source_directory(src SYNC_SRC) add_library(sync STATIC ${SYNC_SRC}) +target_compile_options(sync PRIVATE -Wno-error=deprecated-non-prototype) target_link_libraries( sync PUBLIC common diff --git a/source/os/src/osString.c b/source/os/src/osString.c index 768bbe5cd1..a4440ee5e8 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -17,10 +17,6 @@ #define _DEFAULT_SOURCE #include "os.h" -#ifndef DISALLOW_NCHAR_WITHOUT_ICONV -#include "iconv.h" -#endif - extern int wcwidth(wchar_t c); extern int wcswidth(const wchar_t *s, size_t n); diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 57ed675303..1d1050c1ec 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -56,7 +56,7 @@ static void shellWriteHistory(); static void shellPrintError(TAOS_RES *tres, int64_t st); static bool shellIsCommentLine(char *line); static void shellSourceFile(const char *file); -static bool shellGetGrantInfo(); +static bool shellGetGrantInfo(char* buf); static void shellCleanup(void *arg); static void *shellCancelHandler(void *arg);