Cannot build TensorRT OSS 7.2 zlib not found

Description

Cmake step of tensorRT compile fails because zlib cannot be found.

Environment

TensorRT Version: -
Hardware: Jetson Xavier
Jetpack: 4.4
CUDA Version: 10.2
CUDNN Version: 8.0
Baremetal or Container (if container which image + tag): Using custom container using nvidia l4t repo

Relevant Files

CMakeError.log: CMakeError.log (3.0 KB)

Console output:

/workspace/cmake-3.24.0-rc4-linux-aarch64/bin/cmake .. -DTRT_LIB_DIR=$TRT_RELEASE/lib -DTRT_OUT_DIR=`pwd`/out -DTRT_INC_DIR=$TRT_RELEASE/include  -DTRT_PLATFORM_ID=aarch64 -DCUDA_VERSION=10.2 -DBUILD_SAMPLES=OFF -DZLIB_LIBRARY=/u
sr/lib/x86_64-linux-gnu/libz.so                                                                                                                                                                                                                                                   
Building for TensorRT version: 7.2.1, library version: 7                                                                                                                                                                                                                          
-- The CXX compiler identification is GNU 7.5.0                                                                                                                                                                                                                                   
-- The CUDA compiler identification is NVIDIA 10.2.89                                                                                                                                                                                                                             
-- Detecting CXX compiler ABI info                                                                                                                                                                                                                                                
-- Detecting CXX compiler ABI info - done                                                                                                                                                                                                                                         
-- Check for working CXX compiler: /usr/bin/g++ - skipped                                                                                                                                                                                                                         
-- Detecting CXX compile features                                                                                                                                                                                                                                                 
-- Detecting CXX compile features - done                                                                                                                                                                                                                                          
-- Detecting CUDA compiler ABI info                                                                                                                                                                                                                                               
-- Detecting CUDA compiler ABI info - done                                                                                                                                                                                                                                        
-- Check for working CUDA compiler: /usr/local/cuda-10.2/bin/nvcc - skipped                                                                                                                                                                                                       
-- Detecting CUDA compile features                                                                                                                                                                                                                                                
-- Detecting CUDA compile features - done                                                                                                                                                                                                                                         
-- Targeting TRT Platform: aarch64                                                                                                                                                                                                                                                
-- CUDA version set to 10.2                                                                                                                                                                                                                                                       
-- cuDNN version set to 8.0                                                                                                                                                                                                                                                       
-- Protobuf version set to 3.0.0                                                                                                                                                                                                                                                  
-- Checking for one of the modules 'zlib'                                                                                                                                                                                                                                         
CMake Error at /workspace/cmake-3.24.0-rc4-linux-aarch64/share/cmake-3.24/Modules/FindPkgConfig.cmake:894 (message):                                                                                                                                                              
  None of the required 'zlib' found                                                                                                                                                                                                                                               
Call Stack (most recent call first):                                                                                                                                                                                                                                              
  third_party/zlib.cmake:18 (pkg_search_module)                                                                                                                                                                                                                                   
  CMakeLists.txt:98 (include)  

I have installed zlib using apt install zlib1g-dev and also pkg-config. Those install steps are not in the dockerfile(s) shared below.

Steps To Reproduce

git clone -b master https://github.com/nvidia/TensorRT TensorRT
cd TensorRT
git submodule update --init --recursive
export TRT_SOURCE=`pwd`

export TRT_RELEASE=`pwd`/TensorRT-7.2.1.6

cd $TRT_SOURCE
mkdir -p build && cd build
cmake .. -DTRT_LIB_DIR=$TRT_RELEASE/lib -DTRT_OUT_DIR=`pwd`/out -DTRT_PLATFORM_ID=aarch64 -DCUDA_VERSION=10.2
make -j$(nproc)

The above steps are done in a container.
base dockerfile: run make image after cloning nvidia l4t repo
TRT build docker: Dockerfile_ubuntu20_l4t_infer_trt_7_jp44 (3.3 KB)

Hi,

Could you try if the following command helps?

$ sudo apt-get install zlib1g-dev

Thanks.

I already tried that and reported it in the question. But somehow CMAKE is not able to find it looks like.

make sure to run apt install pkg-config rather than building from source. That way there is no need to explicitly install zlib.