PaddlePaddle / Serving

A flexible, high-performance carrier for machine learning models(『飞桨』服务化部署框架)
Apache License 2.0
899 stars 251 forks source link

开启 opencv 选项时编译失败 #1904

Closed thep0y closed 1 year ago

thep0y commented 1 year ago

使用的 cmake 命令:

cmake -DPYTHON_INCLUDE_DIR=$PYTHON_INCLUDE_DIR \
                                                -DPYTHON_LIBRARIES=$PYTHON_LIBRARIES \
                                                -DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
                                                -DCUDA_TOOLKIT_ROOT_DIR=$CUDA_PATH \
                                                -DCUDNN_LIBRARY=$CUDNN_LIBRARY \
                                                -DCUDA_CUDART_LIBRARY=$CUDA_CUDART_LIBRARY \
                                                -DTENSORRT_ROOT=$TENSORRT_LIBRARY_PATH \
                                                -DSERVER=ON \
                                                -DOPENCV_DIR=$OPENCV_DIR \
                                                -DWITH_OPENCV=ON \
                                                -DWITH_GPU=ON ..

日志:

展开查看

-- Found Paddle host system: ubuntu, version: 20.04.5
-- Found Paddle host system's CPU: 32 cores
-- CXX compiler: /usr/bin/c++, version: GNU 9.4.0
-- C compiler: /usr/bin/cc, version: GNU 9.4.0
-- Compile Version Tag for wheel: 0.0.0
-- Use PADDLE_ON_INFERENCE
-- Do not have AVX2 intrinsics and disabled MKL-DNN
CMake Error at cmake/external/zlib.cmake:61 (SET_PROPERTY):
  SET_PROPERTY could not find TARGET zlib.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:104 (include)

CMake Error at cmake/external/zlib.cmake:62 (ADD_DEPENDENCIES):
  Cannot add target-level dependencies to non-existent target "zlib".

  The add_dependencies works for top-level logical targets created by the
  add_executable, add_library, or add_custom_target commands.  If you want to
  add file-level dependencies see the DEPENDS option of the add_custom_target
  and add_custom_command commands.
Call Stack (most recent call first):
  CMakeLists.txt:104 (include)

-- BOOST_TAR: boost_1_74_0, BOOST_URL: http://paddlepaddledeps.bj.bcebos.com/boost_1_74_0.tar.gz
CMake Warning at /usr/share/cmake-3.16/Modules/FindProtobuf.cmake:499 (message):
  Protobuf compiler version doesn't match library version 3.6.1
Call Stack (most recent call first):
  cmake/external/protobuf.cmake:18 (FIND_PACKAGE)
  CMakeLists.txt:106 (include)

CMake Error at /usr/share/cmake-3.16/Modules/ExternalProject.cmake:2962 (get_property):
  get_property could not find TARGET zlib.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/ExternalProject.cmake:3239 (_ep_add_configure_command)
  cmake/external/protobuf.cmake:272 (ExternalProject_Add)
  cmake/external/protobuf.cmake:301 (build_protobuf)
  CMakeLists.txt:106 (include)

-- Protobuf protoc executable: /home/ocr/Serving/build_server/third_party/install/protobuf/bin/protoc
-- Protobuf-lite library: /home/ocr/Serving/build_server/third_party/install/protobuf/lib/libprotobuf-lite.a
-- Protobuf library: /home/ocr/Serving/build_server/third_party/install/protobuf/lib/libprotobuf.a
-- Protoc library: /home/ocr/Serving/build_server/third_party/install/protobuf/lib/libprotoc.a
-- Protobuf version: 3.1
-- ssl:/usr/lib/x86_64-linux-gnu/libssl.so
-- crypto:/usr/lib/x86_64-linux-gnu/libcrypto.so
-- Current cuDNN header is /usr/include/cudnn.h. Current cuDNN version is v8.1. 
paddle install dir: /home/ocr/Serving/build_server/third_party/install/Paddle/
WITH_GPU = ON
CUDA: 11.2, CUDNN_MAJOR_VERSION: 8
-- PADDLE_LIB_PATH=http://paddle-inference-lib.bj.bcebos.com/2.3.0-rc0/cxx_c/Linux/GPU/x86-64_gcc8.2_avx_mkl_cuda11.2_cudnn8.2.1_trt8.0.3.4/paddle_inference.tgz
paddle serving source dir: /home/ocr/Serving
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/__init__.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/analyse.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/channel.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/dag.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/error_catch.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/__init__.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/gateway.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf/any.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf/api.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf/compiler
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf/compiler/plugin.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf/descriptor.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf/duration.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf/empty.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf/field_mask.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf/source_context.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf/struct.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf/timestamp.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf/type.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proto/include/google/protobuf/wrappers.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/gateway/proxy_server.go
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/local_service_handler.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/logger.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/operator.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/pipeline_client.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/pipeline_server.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/profiler.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/prometheus_metrics.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/proto/__init__.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/proto/pipeline_service.proto
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/proto/run_codegen.py
-- Up-to-date: /home/ocr/Serving/build_server/python/paddle_serving_server/pipeline/util.py
python env: 
-- Configuring incomplete, errors occurred!

错误日志:

展开查看

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/ocr/Serving/build_server/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_c22ef/fast && /usr/bin/make -f CMakeFiles/cmTC_c22ef.dir/build.make CMakeFiles/cmTC_c22ef.dir/build
make[1]: Entering directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_c22ef.dir/src.c.o
/usr/bin/cc   -DCMAKE_HAVE_LIBC_PTHREAD   -o CMakeFiles/cmTC_c22ef.dir/src.c.o   -c /home/ocr/Serving/build_server/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_c22ef
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c22ef.dir/link.txt --verbose=1
/usr/bin/cc  -DCMAKE_HAVE_LIBC_PTHREAD    -rdynamic CMakeFiles/cmTC_c22ef.dir/src.c.o  -o cmTC_c22ef 
/usr/bin/ld: CMakeFiles/cmTC_c22ef.dir/src.c.o: in function `main':
src.c:(.text+0x46): undefined reference to `pthread_create'
/usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach'
/usr/bin/ld: src.c:(.text+0x63): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_c22ef.dir/build.make:87: cmTC_c22ef] Error 1
make[1]: Leaving directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_c22ef/fast] Error 2

Source file was:
#include 

void* test_func(void* data)
{
  return data;
}

int main(void)
{
  pthread_t thread;
  pthread_create(&thread, NULL, test_func, NULL);
  pthread_detach(thread);
  pthread_join(thread, NULL);
  pthread_atfork(NULL, NULL, NULL);
  pthread_exit(NULL);

  return 0;
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/ocr/Serving/build_server/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_b0981/fast && /usr/bin/make -f CMakeFiles/cmTC_b0981.dir/build.make CMakeFiles/cmTC_b0981.dir/build
make[1]: Entering directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_b0981.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_b0981.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c
Linking C executable cmTC_b0981
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b0981.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_b0981.dir/CheckFunctionExists.c.o  -o cmTC_b0981  -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_b0981.dir/build.make:87: cmTC_b0981] Error 1
make[1]: Leaving directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_b0981/fast] Error 2

Performing C++ SOURCE FILE Test AVX512F_FOUND failed with the following output:
Change Dir: /home/ocr/Serving/build_server/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_0051d/fast && /usr/bin/make -f CMakeFiles/cmTC_0051d.dir/build.make CMakeFiles/cmTC_0051d.dir/build
make[1]: Entering directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_0051d.dir/src.cxx.o
/usr/bin/c++    -DAVX512F_FOUND -mavx512f   -o CMakeFiles/cmTC_0051d.dir/src.cxx.o -c /home/ocr/Serving/build_server/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTC_0051d
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0051d.dir/link.txt --verbose=1
/usr/bin/c++   -DAVX512F_FOUND -mavx512f    -rdynamic CMakeFiles/cmTC_0051d.dir/src.cxx.o  -o cmTC_0051d 
make[1]: Leaving directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'

...and run output:
Illegal instruction
Return value: FAILED_TO_RUN
Source file was:

#include 
int main()
{
    __m512i a = _mm512_set_epi32 (-1, 2, -3, 4, -1, 2, -3, 4,
                                  13, -5, 6, -7, 9, 2, -6, 3);
    __m512i result = _mm512_abs_epi32 (a);
    return 0;
}
Performing C SOURCE FILE Test C_COMPILER_SUPPORT_FLAG__Wnon_virtual_dtor failed with the following output:
Change Dir: /home/ocr/Serving/build_server/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_cefd7/fast && /usr/bin/make -f CMakeFiles/cmTC_cefd7.dir/build.make CMakeFiles/cmTC_cefd7.dir/build
make[1]: Entering directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_cefd7.dir/src.c.o
/usr/bin/cc   -D__const__= -DUSE_PTHREAD -fPIC -fno-omit-frame-pointer -Wall -Wextra -DC_COMPILER_SUPPORT_FLAG__Wnon_virtual_dtor   -Wnon-virtual-dtor -o CMakeFiles/cmTC_cefd7.dir/src.c.o   -c /home/ocr/Serving/build_server/CMakeFiles/CMakeTmp/src.c
cc1: warning: command line option '-Wnon-virtual-dtor' is valid for C++/ObjC++ but not for C
Linking C executable cmTC_cefd7
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_cefd7.dir/link.txt --verbose=1
/usr/bin/cc  -D__const__= -DUSE_PTHREAD -fPIC -fno-omit-frame-pointer -Wall -Wextra -DC_COMPILER_SUPPORT_FLAG__Wnon_virtual_dtor    -rdynamic CMakeFiles/cmTC_cefd7.dir/src.c.o  -o cmTC_cefd7 
make[1]: Leaving directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'

Source file was:
int main(void) { return 0; }
Performing C SOURCE FILE Test C_COMPILER_SUPPORT_FLAG__Wdelete_non_virtual_dtor failed with the following output:
Change Dir: /home/ocr/Serving/build_server/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_2f405/fast && /usr/bin/make -f CMakeFiles/cmTC_2f405.dir/build.make CMakeFiles/cmTC_2f405.dir/build
make[1]: Entering directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_2f405.dir/src.c.o
/usr/bin/cc   -D__const__= -DUSE_PTHREAD -fPIC -fno-omit-frame-pointer -Wall -Wextra -DC_COMPILER_SUPPORT_FLAG__Wdelete_non_virtual_dtor   -Wdelete-non-virtual-dtor -o CMakeFiles/cmTC_2f405.dir/src.c.o   -c /home/ocr/Serving/build_server/CMakeFiles/CMakeTmp/src.c
cc1: warning: command line option '-Wdelete-non-virtual-dtor' is valid for C++/ObjC++ but not for C
Linking C executable cmTC_2f405
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_2f405.dir/link.txt --verbose=1
/usr/bin/cc  -D__const__= -DUSE_PTHREAD -fPIC -fno-omit-frame-pointer -Wall -Wextra -DC_COMPILER_SUPPORT_FLAG__Wdelete_non_virtual_dtor    -rdynamic CMakeFiles/cmTC_2f405.dir/src.c.o  -o cmTC_2f405 
make[1]: Leaving directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'

Source file was:
int main(void) { return 0; }
Performing C SOURCE FILE Test C_COMPILER_SUPPORT_FLAG__Wno_error_parentheses_equality failed with the following output:
Change Dir: /home/ocr/Serving/build_server/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_3e149/fast && /usr/bin/make -f CMakeFiles/cmTC_3e149.dir/build.make CMakeFiles/cmTC_3e149.dir/build
make[1]: Entering directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_3e149.dir/src.c.o
/usr/bin/cc   -D__const__= -DUSE_PTHREAD -fPIC -fno-omit-frame-pointer -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-error=literal-suffix -Wno-error=sign-compare -Wno-error=unused-local-typedefs -DC_COMPILER_SUPPORT_FLAG__Wno_error_parentheses_equality   -Wno-error=parentheses-equality -o CMakeFiles/cmTC_3e149.dir/src.c.o   -c /home/ocr/Serving/build_server/CMakeFiles/CMakeTmp/src.c
cc1: error: '-Werror=parentheses-equality': no option -Wparentheses-equality
make[1]: *** [CMakeFiles/cmTC_3e149.dir/build.make:66: CMakeFiles/cmTC_3e149.dir/src.c.o] Error 1
make[1]: Leaving directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_3e149/fast] Error 2

Source file was:
int main(void) { return 0; }
Performing C++ SOURCE FILE Test CXX_COMPILER_SUPPORT_FLAG__Wno_error_parentheses_equality failed with the following output:
Change Dir: /home/ocr/Serving/build_server/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_ffe96/fast && /usr/bin/make -f CMakeFiles/cmTC_ffe96.dir/build.make CMakeFiles/cmTC_ffe96.dir/build
make[1]: Entering directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_ffe96.dir/src.cxx.o
/usr/bin/c++    -std=c++11 -D__const__= -DUSE_PTHREAD -fPIC -fno-omit-frame-pointer -Wall -Wextra -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wno-unused-parameter -Wno-unused-function -Wno-error=literal-suffix -Wno-error=sign-compare -Wno-error=unused-local-typedefs -DCXX_COMPILER_SUPPORT_FLAG__Wno_error_parentheses_equality   -Wno-error=parentheses-equality -o CMakeFiles/cmTC_ffe96.dir/src.cxx.o -c /home/ocr/Serving/build_server/CMakeFiles/CMakeTmp/src.cxx
cc1plus: error: '-Werror=parentheses-equality': no option -Wparentheses-equality
make[1]: *** [CMakeFiles/cmTC_ffe96.dir/build.make:66: CMakeFiles/cmTC_ffe96.dir/src.cxx.o] Error 1
make[1]: Leaving directory '/home/ocr/Serving/build_server/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_ffe96/fast] Error 2

Source file was:
int main() { return 0; }
thep0y commented 1 year ago

换了 opencv3 后顺利编译