From f030af3aab688659576ed3f13c967e5830e55b66 Mon Sep 17 00:00:00 2001 From: t_max <1172915550@qq.com> Date: Sat, 11 May 2024 14:59:05 +0800 Subject: [PATCH] fix: build fails on macOS and Windows --- cmake/xz_CMakeLists.txt.in | 7 ++----- cmake/zlib_CMakeLists.txt.in | 2 -- contrib/CMakeLists.txt | 4 ++++ include/libs/executor/storageapi.h | 2 +- include/os/osString.h | 4 ++++ source/client/CMakeLists.txt | 7 ------- source/client/src/clientHb.c | 2 +- source/dnode/mgmt/mgmt_snode/src/smWorker.c | 4 ++-- source/dnode/mgmt/mgmt_vnode/src/vmWorker.c | 8 ++++---- source/dnode/vnode/CMakeLists.txt | 3 +++ source/libs/executor/CMakeLists.txt | 3 +++ source/libs/executor/src/aggregateoperator.c | 2 +- source/libs/executor/src/sysscanoperator.c | 2 +- source/libs/function/src/udfd.c | 2 +- source/libs/monitorfw/CMakeLists.txt | 4 +++- source/libs/sync/src/syncMain.c | 2 +- tools/shell/src/shellEngine.c | 2 +- 17 files changed, 32 insertions(+), 28 deletions(-) diff --git a/cmake/xz_CMakeLists.txt.in b/cmake/xz_CMakeLists.txt.in index dc79974fda..e704fcbbbf 100644 --- a/cmake/xz_CMakeLists.txt.in +++ b/cmake/xz_CMakeLists.txt.in @@ -1,7 +1,5 @@ -# xz - -if (${TD_LINUX}) +# xz ExternalProject_Add(xz GIT_REPOSITORY https://github.com/xz-mirror/xz.git GIT_TAG v5.4.4 @@ -13,5 +11,4 @@ ExternalProject_Add(xz BUILD_COMMAND "" INSTALL_COMMAND "" TEST_COMMAND "" -) -endif() \ No newline at end of file +) \ No newline at end of file diff --git a/cmake/zlib_CMakeLists.txt.in b/cmake/zlib_CMakeLists.txt.in index 8f45ecc497..87a17c7377 100644 --- a/cmake/zlib_CMakeLists.txt.in +++ b/cmake/zlib_CMakeLists.txt.in @@ -2,7 +2,6 @@ # zlib -if (${TD_LINUX}) ExternalProject_Add(zlib GIT_REPOSITORY https://github.com/taosdata-contrib/zlib.git GIT_TAG v1.2.11 @@ -14,4 +13,3 @@ ExternalProject_Add(zlib INSTALL_COMMAND "" TEST_COMMAND "" ) -endif() diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index ccd60df19a..796b690d01 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -250,6 +250,10 @@ target_include_directories( # zlib set(CMAKE_PROJECT_INCLUDE_BEFORE "${TD_SUPPORT_DIR}/EnableCMP0048.txt.in") +if(${TD_DARWIN}) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=deprecated-non-prototype") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-non-prototype") +endif(${TD_DARWIN}) add_subdirectory(zlib EXCLUDE_FROM_ALL) target_include_directories( zlibstatic diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h index ec92bd56dd..2d507ab6bb 100644 --- a/include/libs/executor/storageapi.h +++ b/include/libs/executor/storageapi.h @@ -270,7 +270,7 @@ typedef struct SStoreMeta { int32_t (*putCachedTableList)(void* pVnode, uint64_t suid, const void* pKey, int32_t keyLen, void* pPayload, int32_t payloadLen, double selectivityRatio); - void* (*storeGetIndexInfo)(); + void* (*storeGetIndexInfo)(void *pVnode); void* (*getInvertIndex)(void* pVnode); // support filter and non-filter cases. [vnodeGetCtbIdList & vnodeGetCtbIdListByFilter] int32_t (*getChildTableList)(void* pVnode, int64_t suid, SArray* list); diff --git a/include/os/osString.h b/include/os/osString.h index 1aca119293..ac7dd7eda8 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -22,7 +22,11 @@ extern "C" { typedef wchar_t TdWchar; typedef int32_t TdUcs4; +#if !defined(DISALLOW_NCHAR_WITHOUT_ICONV) && defined(DARWIN) +#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..84747860e9 100644 --- a/source/client/CMakeLists.txt +++ b/source/client/CMakeLists.txt @@ -23,13 +23,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) diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 78e8b04a13..7d30a19140 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -738,7 +738,7 @@ static int32_t hbGetUserAuthInfo(SClientHbKey *connKey, SHbParam *param, SClient _return: releaseTscObj(connKey->tscRid); if (code) { - tscError("hb got user auth info failed since %s", terrstr(code)); + tscError("hb got user auth info failed since %s", tstrerror(code)); } return code; diff --git a/source/dnode/mgmt/mgmt_snode/src/smWorker.c b/source/dnode/mgmt/mgmt_snode/src/smWorker.c index 9220d3395d..1c57685414 100644 --- a/source/dnode/mgmt/mgmt_snode/src/smWorker.c +++ b/source/dnode/mgmt/mgmt_snode/src/smWorker.c @@ -37,7 +37,7 @@ static void smProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO dTrace("msg:%p, get from snode-write queue", pMsg); int32_t code = sndProcessWriteMsg(pMgmt->pSnode, pMsg, NULL); if (code < 0) { - dGError("snd, msg:%p failed to process write since %s", pMsg, terrstr(code)); + dGError("snd, msg:%p failed to process write since %s", pMsg, tstrerror(code)); if (pMsg->info.handle != NULL) { tmsgSendRsp(pMsg); } @@ -58,7 +58,7 @@ static void smProcessStreamQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { dTrace("msg:%p, get from snode-stream queue", pMsg); int32_t code = sndProcessStreamMsg(pMgmt->pSnode, pMsg); if (code < 0) { - dGError("snd, msg:%p failed to process stream msg %s since %s", pMsg, TMSG_INFO(pMsg->msgType), terrstr(code)); + dGError("snd, msg:%p failed to process stream msg %s since %s", pMsg, TMSG_INFO(pMsg->msgType), tstrerror(code)); smSendRsp(pMsg, terrno); } diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index e4adfdb6b1..7b7c51bbc7 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -103,7 +103,7 @@ static void vmProcessStreamQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { if (code != 0) { if (terrno != 0) code = terrno; dGError("vgId:%d, msg:%p failed to process stream msg %s since %s", pVnode->vgId, pMsg, TMSG_INFO(pMsg->msgType), - terrstr(code)); + tstrerror(code)); vmSendRsp(pMsg, code); } @@ -201,7 +201,7 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp case QUERY_QUEUE: code = vnodePreprocessQueryMsg(pVnode->pImpl, pMsg); if (code) { - dError("vgId:%d, msg:%p preprocess query msg failed since %s", pVnode->vgId, pMsg, terrstr(code)); + dError("vgId:%d, msg:%p preprocess query msg failed since %s", pVnode->vgId, pMsg, tstrerror(code)); } else { dGTrace("vgId:%d, msg:%p put into vnode-query queue", pVnode->vgId, pMsg); taosWriteQitem(pVnode->pQueryQ, pMsg); @@ -219,13 +219,13 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp if (!vmDataSpaceSufficient(pVnode)) { terrno = TSDB_CODE_NO_ENOUGH_DISKSPACE; code = terrno; - dError("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr(code)); + dError("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, tstrerror(code)); break; } if (pMsg->msgType == TDMT_VND_SUBMIT && (grantCheck(TSDB_GRANT_STORAGE) != TSDB_CODE_SUCCESS)) { terrno = TSDB_CODE_VND_NO_WRITE_AUTH; code = terrno; - dDebug("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr(code)); + dDebug("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, tstrerror(code)); break; } if (pMsg->msgType != TDMT_VND_ALTER_CONFIRM && pVnode->disable) { diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 43e680c382..d776271131 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 "") +if(${TD_DARWIN}) + target_compile_options(vnode PRIVATE -Wno-error=single-bit-bitfield-constant-conversion) +endif(${TD_DARWIN}) set( VNODE_SOURCE_FILES "src/vnd/vnodeOpen.c" diff --git a/source/libs/executor/CMakeLists.txt b/source/libs/executor/CMakeLists.txt index 838233346e..8ba5f9a866 100644 --- a/source/libs/executor/CMakeLists.txt +++ b/source/libs/executor/CMakeLists.txt @@ -1,6 +1,9 @@ aux_source_directory(src EXECUTOR_SRC) add_library(executor STATIC ${EXECUTOR_SRC}) +if(${TD_DARWIN}) + target_compile_options(executor PRIVATE -Wno-error=deprecated-non-prototype) +endif(${TD_DARWIN}) target_link_libraries(executor PRIVATE os util common function parser planner qcom scalar nodes index wal tdb geometry diff --git a/source/libs/executor/src/aggregateoperator.c b/source/libs/executor/src/aggregateoperator.c index d0e1449188..b5a49831c5 100644 --- a/source/libs/executor/src/aggregateoperator.c +++ b/source/libs/executor/src/aggregateoperator.c @@ -484,7 +484,7 @@ int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t n if (!osTempSpaceAvailable()) { code = TSDB_CODE_NO_DISKSPACE; - qError("Init stream agg supporter failed since %s, key:%s, tempDir:%s", terrstr(code), pKey, tsTempDir); + qError("Init stream agg supporter failed since %s, key:%s, tempDir:%s", tstrerror(code), pKey, tsTempDir); return code; } diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 16b0474f9c..db83c46155 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -549,7 +549,7 @@ static SSDataBlock* sysTableScanUserCols(SOperatorInfo* pOperator) { if (!pInfo->pCur || !pInfo->pSchema) { terrno = TSDB_CODE_OUT_OF_MEMORY; - qError("sysTableScanUserCols failed since %s", terrstr(terrno)); + qError("sysTableScanUserCols failed since %s", terrstr()); blockDataDestroy(pDataBlock); pInfo->loadInfo.totalRows = 0; return NULL; diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index c8eb7580ed..2a5e594ba3 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -842,7 +842,7 @@ void udfdGetFuncBodyPath(const SUdf *udf, char *path) { int32_t udfdSaveFuncBodyToFile(SFuncInfo *pFuncInfo, SUdf *udf) { if (!osDataSpaceAvailable()) { terrno = TSDB_CODE_NO_DISKSPACE; - fnError("udfd create shared library failed since %s", terrstr(terrno)); + fnError("udfd create shared library failed since %s", terrstr()); return terrno; } diff --git a/source/libs/monitorfw/CMakeLists.txt b/source/libs/monitorfw/CMakeLists.txt index 610cd63985..f08b2d6c2b 100644 --- a/source/libs/monitorfw/CMakeLists.txt +++ b/source/libs/monitorfw/CMakeLists.txt @@ -5,5 +5,7 @@ target_include_directories( PUBLIC "${TD_SOURCE_DIR}/include/libs/monitorfw" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) - +if(${TD_DARWIN}) + target_compile_options(monitorfw PRIVATE -Wno-error=deprecated-pragma) +endif(${TD_DARWIN}) target_link_libraries(monitorfw os util common transport) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index fbdb5f4201..c7e654605b 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -463,7 +463,7 @@ _DEL_WAL: pSyncNode->snapshottingIndex, lastApplyIndex); } else { sNError(pSyncNode, "wal snapshot begin error since:%s, index:%" PRId64 ", last apply index:%" PRId64, - terrstr(terrno), pSyncNode->snapshottingIndex, lastApplyIndex); + terrstr(), pSyncNode->snapshottingIndex, lastApplyIndex); atomic_store_64(&pSyncNode->snapshottingIndex, SYNC_INDEX_INVALID); } 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);