From 9783fb7221d528f0f425da31be195ce49e130d71 Mon Sep 17 00:00:00 2001 From: wkhappy1 <54095696+wkhappy1@users.noreply.github.com> Date: Tue, 31 Dec 2019 18:32:42 +0800 Subject: [PATCH] Fix: UDF version `GLIBCXX_3.4.21' not found (#2629) --- be/src/udf_samples/CMakeLists.txt | 8 ++++++++ .../cn/extending-doris/user-defined-function.md | 2 +- .../en/extending-doris/user-defined-function_EN.md | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/be/src/udf_samples/CMakeLists.txt b/be/src/udf_samples/CMakeLists.txt index 419dce1a13..552abbba3b 100644 --- a/be/src/udf_samples/CMakeLists.txt +++ b/be/src/udf_samples/CMakeLists.txt @@ -22,4 +22,12 @@ set(LIBRARY_OUTPUT_PATH "${BUILD_DIR}/src/udf_samples") set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/src/udf_samples") add_library(udfsample SHARED udf_sample.cpp) +target_link_libraries(udfsample + -static-libstdc++ + -static-libgcc +) add_library(udasample SHARED uda_sample.cpp) +target_link_libraries(udasample + -static-libstdc++ + -static-libgcc +) diff --git a/docs/documentation/cn/extending-doris/user-defined-function.md b/docs/documentation/cn/extending-doris/user-defined-function.md index 654f716df4..eb489dda31 100644 --- a/docs/documentation/cn/extending-doris/user-defined-function.md +++ b/docs/documentation/cn/extending-doris/user-defined-function.md @@ -75,7 +75,7 @@ under the License. ### 编写CMakeLists.txt -基于上一步生成的`headers|libs`,用户可以使用`CMakeLists`等工具引入该依赖;在`CMakeLists`中,可以通过向`CMAKE_CXX_FLAGS`添加`-I|L`分别指定`headers|libs`路径;然后使用`add_library`添加动态库。例如,在`be/src/udf_samples/CMakeLists.txt`中,使用`add_library(udfsample SHARED udf_sample.cpp)`增加了一个`udfsample`动态库。后面需要写上涉及的所有源文件(不包含头文件)。 +基于上一步生成的`headers|libs`,用户可以使用`CMakeLists`等工具引入该依赖;在`CMakeLists`中,可以通过向`CMAKE_CXX_FLAGS`添加`-I|L`分别指定`headers|libs`路径;然后使用`add_library`添加动态库。例如,在`be/src/udf_samples/CMakeLists.txt`中,使用`add_library(udfsample SHARED udf_sample.cpp)` `target_link_libraries`(udfsample -static-libstdc++ -static-libgcc)增加了一个`udfsample`动态库。后面需要写上涉及的所有源文件(不包含头文件)。 ### 执行编译 diff --git a/docs/documentation/en/extending-doris/user-defined-function_EN.md b/docs/documentation/en/extending-doris/user-defined-function_EN.md index e60b8f5b74..82f8fe8974 100644 --- a/docs/documentation/en/extending-doris/user-defined-function_EN.md +++ b/docs/documentation/en/extending-doris/user-defined-function_EN.md @@ -75,7 +75,7 @@ Executing `sh build.sh` in the Doris root directory generates the corresponding ### Edit CMakeLists.txt -Based on the `headers | libs` generated in the previous step, users can introduce the dependency using tools such as `CMakeLists`; in `CMakeLists`, dynamic libraries can be added by adding `-I|L` to `CMAKE_CXX_FLAGS`, respectively. For example, in `be/src/udf_samples/CMakeLists.txt`, a `udf sample` dynamic library is added using `add_library` (udfsample SHARED udf_sample.cpp). You need to write down all the source files involved later (no header files included). +Based on the `headers | libs` generated in the previous step, users can introduce the dependency using tools such as `CMakeLists`; in `CMakeLists`, dynamic libraries can be added by adding `-I|L` to `CMAKE_CXX_FLAGS`, respectively. For example, in `be/src/udf_samples/CMakeLists.txt`, a `udf sample` dynamic library is added using `add_library` (udfsample SHARED udf_sample.cpp) `target_link_libraries`(udfsample -static-libstdc++ -static-libgcc). You need to write down all the source files involved later (no header files included). ### Execute compilation