Building SWI-Prolog on Windows using CMake with MSVC which builds and runs all ctest without error.
When running
cpack -C Release
error occurs
CPack: CMake Error at C:/dev/swipl-devel/build/cmake_install.cmake:1213 (file):
file Could not resolve runtime dependencies:
jvm.dll
Modifying cmake\RuntimeDependencies.cmake as noted below resolves the error. Not sure if this is a correct change to make.
@jan Thoughts?
Posting this as a forum post so that @mgondan1 and others can see the details instead of trying to find them in a PR or issue.
Details if needed
JVM downloaded from https://learn.microsoft.com/en-us/java/openjdk/download
C:\>dir /s /b jvm.dll
C:\Program Files\Microsoft\jdk-25.0.2.10-hotspot\bin\server\jvm.dll
C:\dev\swipl-devel\build>echo %JAVA_HOME%
C:\Program Files\Microsoft\jdk-25.0.2.10-hotspot
cmake .. -G "Visual Studio 18 2026" -A x64 -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -
DBDB_LIBRARY=C:/vcpkg/installed/x64-windows/lib/libdb48.lib
ERRORLEVEL is 0
cmake --build . --config Release --verbose
ERRORLEVEL is 0
ctest -C Release --output-on-failure --timeout 300 --verbose
100% tests passed, 0 tests failed out of 88
ERRORLEVEL is 0
***************************************************************************
** Visual Studio 2026 Developer Command Prompt v18.3.1
** Copyright (c) 2025 Microsoft Corporation
***************************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\cd C:\dev\swipl-devel\build
C:\dev\swipl-devel\build>cpack -C Release
CPack: Create package using NSIS64
CPack: Install projects
CPack: - Install project: SWI-Prolog [Release]
CPack: - Install component: Archive_interface
CPack: - Install component: BerkeleyDB_interface
CPack: - Install component: Commandline_editors
CPack: - Install component: Core_packages
CPack: - Install component: Core_system
CPack: - Install component: Documentation
CPack: - Install component: Examples
CPack: - Install component: JSON_support
CPack: - Install component: Java_interface
CPack: CMake Error at C:/dev/swipl-devel/build/cmake_install.cmake:1213 (file):
file Could not resolve runtime dependencies:
jvm.dll
CPack Error: Error when generating package: swipl
The following check_installation is without the noted change to cmake\RuntimeDependencies.cmake
C:\dev\swipl-devel\build>.\src\Release\swipl.exe
Welcome to SWI-Prolog (threaded, 64 bits, version 10.1.3)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
CMake built from "C:/dev/swipl-devel/build" (Release)
For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
1 ?- check_installation.
% Checking your SWI-Prolog kit for common issues ...
%
% Version: ............ 10.1.3
% Address bits: ........ 64
% Architecture: ........ x64-win64
% Installed at: ........ c:/dev/swipl-devel/build/home
% Cores: ............... 4
%
% Checking gmp ........................................ ok
% Loading library(archive) ............................ ok
% Supported filters: bzip2, compress, gzip, gzip_rsplit, lrzip, lzip, lzma, lzop, none, rpm, uu, xz
% Supported formats: 7zip, ar, cab, cpio, empty, gnutar, iso9660, lha, mtree, rar, raw, tar, xar, zip
% Loading library(cgi) ................................ ok
% Loading library(crypt) .............................. ok
% Loading library(bdb) ................................ ok
% Loading library(double_metaphone) ................ ok
% Loading library(editline) ........................... ok
% Loading library(filesex) ............................ ok
% Loading library(http/http_stream) .................. ok
% Loading library(json) ............................... ok
% Loading library(http/jquery) ........................ ok
jQuery from c:/dev/swipl-devel/build/home/library/http/web/js/jquery-3.6.0.min.js
% Loading library(isub) .............................. ok
% Loading library(janus) ............................ ok
% Interactive session: added '.' to Python 'sys.path'
% Python version 3.12.9 (main, Feb 20 2026, 13:42:20) [MSC v.1950 64 bit (AMD64)]
% Loading library(jpl) .............................. ok
% Extended DLL search path with
% 'C:\\Program Files\\Microsoft\\jdk-25.0.2.10-hotspot\\bin\\server'
............................................... ok
% Loading library(memfile) .......................... ok
% Loading library(odbc) ............................. ok
% Loading library(pce) .............................. ok
% Loading library(pcre) ............................. ok
% Loading library(pdt_console) ...................... ok
% Loading library(porter_stem) ..................... ok
% Loading library(process) .......................... ok
% Loading library(protobufs) ........................ ok
% Loading library(readutil) ......................... ok
% Loading library(semmeb/rdf_db) ................... ok
% Loading library(semmeb/rdf_ntriples) ............ ok
% Loading library(semmeb/turtle) ................... ok
% Loading library(sgml) ............................. ok
% Loading library(sha) .............................. ok
% Loading library(snowball) ......................... ok
% Loading library(socket) ........................... ok
% Loading library(ssl) .............................. ok
% Using OpenSSL 3.6.1 27 Jan 2026
% Loading library(sweep_link) ....................... ok
% GNU-Emacs plugin loads
% M c:/dev/swipl-devel/build/src/Release/sweep-module.dll
% Loading library(crypto) ........................... ok
% Loading library(table) ............................ ok
% Loading library(time) ............................. ok
% Loading library(unicode) .......................... ok
% Loading library(uri) .............................. ok
% Loading library(uuid) ............................. ok
% Loading library(yaml) ............................. ok
% Loading library(zlib) ............................. ok
%
% Congratulations, your kit seems sound and complete!
If this change is made before the CMake build step
File: cmake\RuntimeDependencies.cmake
-
Find the PRE_EXCLUDE_REGEXES section (around line 42-44):
PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-" "python[0-9]*\.dll" -
Add the Java DLL exclusion by adding a new line:
PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-" "python[0-9]*\.dll" "jvm\.dll"
the error does not occur.