From 89e52281e4ebdef21cd359257de4ae28f96cfa83 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Fri, 12 Mar 2021 18:22:11 +0800 Subject: [PATCH] fix(build/lite): fix lite rc4_encryptor build failed at new ld env when cuda enable: error log: nn-8.0.4-trt-7.2.2.3-libs/TensorRT-7.2.2.3/lib/libnvinfer_static.a(profile.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5' /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line ld version: GNU ld (GNU Binutils for Ubuntu) 2.34, example ubuntu20.04 error reason: at new ld, import flags with active zone libnvinfer_static.a depend dlclose@@GLIBC_2.2.5, which need -ldl ld -o rc4_encryptor xxx.o -ldl libnvinfer_static.a, which failed so we put a -ldl for CUDA_LIBS env, then will change to ld -o rc4_encryptor xxx.o libnvinfer_static.a -ldl GitOrigin-RevId: adda3acb2d5c0952013d59948717060747dd2f8f --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 753843d6..5a5da30f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -551,6 +551,10 @@ if(MGE_WITH_CUDA) endif() set(MGE_CUDA_LIBS "${MGE_CUDA_LIBS} -lrt") + if(UNIX) + set(MGE_CUDA_LIBS "${MGE_CUDA_LIBS} -ldl") + endif() + endif() if(MGE_WITH_CAMBRICON)