GitLab runner fails to build OpenCV unable to find contrib modules but locally same CMakeLists.txt manages to do that

I have set up a runner (shell executor) on a Windows server with a lot more power than my own computer. The runner has been successfully registered with an on-premise hosted latest GitLab instance. Both computers have CUDA 12.2 and cuDNN 8.9.5.30 for CUDA 12.2 in place (the cuDNN are copied in the directory of CUDA) incl. PATH and CUDA_PATH set accordingly.

My project consists of multiple dependencies which I don’t want to build locally and would like to use CMake and/or Git to download and use. So I have split it into 2 repos – one for my application and one for the dependencies. My ultimate goal is to add automated download of artifacts from the repo with the dependencies in the CMake project of my main application.

One of the dependencies is OpenCV with GPU support. The structure of the Dependencies repo is following:

*
|
+-- REAMDE.md
|
+-- .gitmodules
|
+-- .gitignore
|
+-- .gitlab-ci.yml
|
+-- deps
     |
     +-- [submodule] opencv
     |
     +-- [submodule] opencv_contrib
     |
     +-- [submodules] other depenencies
     |
     +-- CMakeLists.txt

The .gitsubmodules looks like

[submodule "deps/opencv"]
    path = deps/opencv
    url = https://github.com/opencv/opencv.git
    branch="4.x"
[submodule "deps/opencv_contrib"]
    path = deps/opencv_contrib
    url = https://github.com/opencv/opencv_contrib.git
    branch="4.x"

The CMakeLists.txt is

cmake_minimum_required(VERSION 3.22)
project(Dependencies)

# Disable examples, tests and docs
set(BUILD_EXAMPLES OFF)
set(BUILD_TESTS OFF)
set(BUILD_DOCS OFF)
# Disable GUI
set(WITH_QT OFF)
set(WITH_GTK OFF)
set(WITH_WIN32UI OFF)
# Disable video
set(WITH_MSMF OFF)
set(WITH_FFMPEG OFF)
set(WITH_DSHOW OFF)
# Language support
set(BUILD_JAVA OFF)
set(BUILD_opencv_python2 OFF)
set(BUILD_opencv_python3 OFF)

if(BuildOpenCV_CPU_BASE)
    add_subdirectory(opencv)
elseif(BuildOpenCV_GPU)
    set(OPENCV_ENABLE_NONFREE OFF)
    set(WITH_CUDA ON)   # Currently using 11.8
    set(WITH_CUDNN ON)
    set(OPENCV_DNN_CUDA ON)
    set(CUDA_ARCH_BIN=6.1)
    set(WITH_NVCUVID OFF)
    set(WITH_NVCUVENC OFF)
    set(OPENCV_EXTRA_MODULES_PATH
        "${CMAKE_SOURCE_DIR}/opencv_contrib/modules/cudaarithm"
        "${CMAKE_SOURCE_DIR}/opencv_contrib/modules/cudabgsegm"
        "${CMAKE_SOURCE_DIR}/opencv_contrib/modules/cudacodec"
        "${CMAKE_SOURCE_DIR}/opencv_contrib/modules/cudafeatures2d"
        "${CMAKE_SOURCE_DIR}/opencv_contrib/modules/cudafilters"
        "${CMAKE_SOURCE_DIR}/opencv_contrib/modules/cudaimgproc"
        "${CMAKE_SOURCE_DIR}/opencv_contrib/modules/cudalegacy"
        "${CMAKE_SOURCE_DIR}/opencv_contrib/modules/cudaobjdetect"
        #"${CMAKE_SOURCE_DIR}/opencv_contrib/modules/cudaoptflow"
        "${CMAKE_SOURCE_DIR}/opencv_contrib/modules/cudastereo"
        "${CMAKE_SOURCE_DIR}/opencv_contrib/modules/cudawarping"
        "${CMAKE_SOURCE_DIR}/opencv_contrib/modules/cudev"
    )
    add_subdirectory(opencv)
endif()

while my .gitlab-ci.yml is

stages:
  - build

build-4.x-gpu-release:
  stage: build
  tags:
    - srv
  variables:
    GIT_SUBMODULE_STRATEGY: recursive
    GIT_SUBMODULE_PATHS: deps/*
  artifacts:
    paths:
      - buildbinRelease*.dll
  script:
    - echo "build-4.x-gpu-release"
    - cd deps
    - cmake -Bbuild -G "Visual Studio 16 2019" -DBuildOpenCV_GPU=ON
    - cmake.exe --build build --target ALL_BUILD --config Release

On my local computer, when I repeat the steps seen in the CI job’s script, I am able to configure the project and even compile it. On the server my runner reports (in the GitLab WebUI) that OpenCV GPU build requires enabled cudev module from the contrib modules. I have also tried specifying the source directory using the -S parameter of cmake so that I would perhaps prevent some confusion with changing the directory in my CI job.

I can see in the logs that both cuDNN and CUDA are detected correctly:

Found CUDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/lib/x64/cudnn.lib (found suitable version "8.9.5", minimum required is "7.5")
-- CUDA detected: 12.2

I can also see (through an extra debug message that prints out OPENCV_EXTRA_MODULES_PATH inside my own CMakeLists.txt that all modules I have selected are detected properly, in particular cudev can be found at

D:/GITLAB/builds/6LxqbndAy/5/gitlab-srv/user/srv/dependencies/deps/opencv_contrib/modules/cudev

where D:/GITLAB/build is the directory where the Windows runner (shell executor) is running all CI jobs.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật