Skip to content

CMake: Fix Windows build issue w/ conflicting libraries#1453

Merged
val-ms merged 1 commit intoCisco-Talos:mainfrom
val-ms:windows-install-openssl-conflict
Feb 14, 2025
Merged

CMake: Fix Windows build issue w/ conflicting libraries#1453
val-ms merged 1 commit intoCisco-Talos:mainfrom
val-ms:windows-install-openssl-conflict

Conversation

@val-ms
Copy link
Contributor

@val-ms val-ms commented Feb 14, 2025

At install, the CMake build may fail if it detects the same library dependency in two locations. This happened for us with the following error:

  CMake Error at libfreshclam/cmake_install.cmake:157 (file):
    file Multiple conflicting paths found for libcrypto-3-x64.dll:

      C:/Users/clamav_jenkins_svc.TALOS/clam_dependencies/x64/lib/libcrypto-3-x64.dll
      C:/WINDOWS/system32/libcrypto-3-x64.dll
      C:\WINDOWS\system32/libcrypto-3-x64.dll
  Call Stack (most recent call first):
    cmake_install.cmake:96 (include)

This happens when system provided DLL names match exactly with the ones we provide. ClamAV woudld't prefer that DLL at load time, because it looks in the EXE directory first. But it does confuse the file() command used to locate build dependencies.

The fix in this commit uses a regex to exclude all libraries found under C:\Windows

At install, the CMake build may fail if it detects the same library
dependency in two locations. This happened for us with the following
error:

  CMake Error at libfreshclam/cmake_install.cmake:157 (file):
    file Multiple conflicting paths found for libcrypto-3-x64.dll:

      C:/Users/clamav_jenkins_svc.TALOS/clam_dependencies/x64/lib/libcrypto-3-x64.dll
      C:/WINDOWS/system32/libcrypto-3-x64.dll
      C:\WINDOWS\system32/libcrypto-3-x64.dll
  Call Stack (most recent call first):
    cmake_install.cmake:96 (include)

This happens when system provided DLL names match exactly with the ones
we provide. ClamAV woudld't prefer that DLL at load time, because it
looks in the EXE directory first. But it does confuse the `file()`
command used to locate build dependencies.

The fix in this commit uses a regex to exclude all libraries found under
C:\Windows
@val-ms val-ms merged commit 72805c5 into Cisco-Talos:main Feb 14, 2025
23 of 24 checks passed
@val-ms val-ms deleted the windows-install-openssl-conflict branch February 14, 2025 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants