Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a build error related to PCSC on Windows #11317

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

blessio
Copy link
Contributor

@blessio blessio commented Oct 4, 2024

The change was needed to be able to build on Windows, in VSCode.
The PCSC Lib and its header were not found. The has zero impact on environments that can already built as the HINTs paths for both include and lib are at the end of the path-chain.

Type of change

✅ Bug fix (non-breaking change that fixes a build issue on some environments)

Testing Strategy

Built and smoke-tested for regressions on Windows and Linux.

@droidmonkey
Copy link
Member

This is absolutely not needed to build on windows. Please explain why this would be the case.

@blessio
Copy link
Contributor Author

blessio commented Oct 4, 2024

Unfortunately, the cmake fails without this modification on my windows 11 installation.
Here is the complete command sequence and output. With the suggested changes in the cmake file the build is successfull.

I modified only the name of the folder to "c:\Users\bleo\"

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\Users\bleo\_prj\keepassxc-B> cd ..
PS C:\Users\bleo\_prj> git clone git@github.com:keepassxreboot/keepassxc.git
Cloning into 'keepassxc'...
remote: Enumerating objects: 45558, done.
remote: Counting objects: 100% (10850/10850), done.
remote: Compressing objects: 100% (1530/1530), done.
remote: Total 45558 (delta 10161), reused 9536 (delta 9316), pack-reused 34708 (from 1)
Receiving objects: 100% (45558/45558), 67.24 MiB | 11.14 MiB/s, done.
Resolving deltas: 100% (35508/35508), done.
PS C:\Users\bleo\_prj> cd .\keepassxc\
PS C:\Users\bleo\_prj\keepassxc> mkdir build


    Directory: C:\Users\bleo\_prj\keepassxc


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        2024-10-05     01:36                build


PS C:\Users\bleo\_prj\keepassxc> cd .\build\
PS C:\Users\bleo\_prj\keepassxc\build> cmake -DWITH_XC_ALL=ON -DCMAKE_TOOLCHAIN_FILE="$ENV:VCPKG_ROOT"\scripts\buildsystems\vcpkg.cmake ..
-- Building for: Visual Studio 17 2022
-- Running vcpkg install
Detecting compiler hash for triplet x64-windows...
Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe
The following packages will be built and installed:
    argon2:x64-windows@20190702#1 -- C:\vcpkg\buildtrees\versioning_\versions\argon2\08a4ee53f1f5330c8f911dff530810c762551675
    botan:x64-windows@3.1.1#1 -- C:\vcpkg\buildtrees\versioning_\versions\botan\c031a70866fae7751496d7edfd01caad2773dd08
  * brotli:x64-windows@1.1.0#1 -- C:\vcpkg\buildtrees\versioning_\versions\brotli\4e5b5ae1ad26c80535c893cc0307121f0398549e
  * bzip2[core,tool]:x64-windows@1.0.8#5 -- C:\vcpkg\buildtrees\versioning_\versions\bzip2\92e9a8bbf1abbd89872b48ad82fcf75852de1006
  * double-conversion:x64-windows@3.3.0 -- C:\vcpkg\buildtrees\versioning_\versions\double-conversion\63037e8b38231f15de1dddb0593eebfb0bf32496
  * egl-registry:x64-windows@2022-09-20 -- C:\vcpkg\buildtrees\versioning_\versions\egl-registry\e596b6c29ad16da764aab6f2fef830a3a884f14b
  * freetype[brotli,bzip2,core,png,zlib]:x64-windows@2.12.1#4 -- C:\vcpkg\buildtrees\versioning_\versions\freetype\4e52babe5d382c3f9cdb1b8037874d78eceb3512
  * harfbuzz:x64-windows@8.2.1#3 -- C:\vcpkg\buildtrees\versioning_\versions\harfbuzz\5baafcf92a1de9e3b94fba26f36f4287dad722fb
  * libiconv:x64-windows@1.17#1 -- C:\vcpkg\buildtrees\versioning_\versions\libiconv\4226589d5d658f4d96df83f8539de54dc57a5996
  * libjpeg-turbo:x64-windows@3.0.1 -- C:\vcpkg\buildtrees\versioning_\versions\libjpeg-turbo\481b08127d4002ba7441f144df259e03271e7592
  * liblzma:x64-windows@5.4.4 -- C:\vcpkg\buildtrees\versioning_\versions\liblzma\f285b7c4ffa2cc065c7c6fec4b61006f7fa2714e
  * libpng:x64-windows@1.6.40 -- C:\vcpkg\buildtrees\versioning_\versions\libpng\1a2a7f489e57c9e55e049b7c5f0a28c8ff4464ed
    libqrencode:x64-windows@4.1.1#2 -- C:\vcpkg\buildtrees\versioning_\versions\libqrencode\95a96c8314e54441e3ee64dd92d3c7b9d9f409f1
  * libwebp[core,libwebpmux,nearlossless,simd,unicode]:x64-windows@1.3.2 -- C:\vcpkg\buildtrees\versioning_\versions\libwebp\0b981028589375097039d5e39e7d87659cdfa824
    minizip:x64-windows@1.3#1 -- C:\vcpkg\buildtrees\versioning_\versions\minizip\91fe1aaa8a5d696bda657a3d2b687fecfa92a7c3
  * openssl:x64-windows@3.1.4#1 -- C:\vcpkg\buildtrees\versioning_\versions\openssl\5ee74387a1dd212dc9754c614809ff86bd0638fa
  * pcre2[core,jit,platform-default-features]:x64-windows@10.42#1 -- C:\vcpkg\buildtrees\versioning_\versions\pcre2\678c2336c4102c5a8868570c60140fdc2a8d1dcf
  * pkgconf:x64-windows@2.1.0 -- C:\vcpkg\buildtrees\versioning_\versions\pkgconf\ea46d2e90c7d74f952d99b6640a88cb9bef6438f
    qt5[activeqt,core,declarative,essentials,imageformats,multimedia,networkauth,quickcontrols,quickcontrols2,svg,tools,translations,websockets]:x64-windows@5.15.11 -- C:\vcpkg\buildtrees\versioning_\versions\qt5\83c7937d7b60d45f3f9e5006fa6cbcdead8b62e0
  * qt5-activeqt:x64-windows@5.15.11 -- C:\vcpkg\buildtrees\versioning_\versions\qt5-activeqt\45de7184a24f527bbccf33013f1c6667d5e6f668
  * qt5-base:x64-windows@5.15.11#1 -- C:\vcpkg\buildtrees\versioning_\versions\qt5-base\c09b409166a1cb3e4881ee5b0081069227a7ae45
  * qt5-declarative[core,d3d12,platform-default-features]:x64-windows@5.15.11 -- C:\vcpkg\buildtrees\versioning_\versions\qt5-declarative\880d2e0ae6f6042a0cb4baae85bc7bc7c950b746
  * qt5-graphicaleffects:x64-windows@5.15.11 -- C:\vcpkg\buildtrees\versioning_\versions\qt5-graphicaleffects\209e1c20fbc69e0bd69bf50aad1a5b049f7cf5fd
    qt5-imageformats[core,tiff,webp]:x64-windows@5.15.11 -- C:\vcpkg\buildtrees\versioning_\versions\qt5-imageformats\ea581d5a2583209a4b276fd9a20f8c04194e29c0
  * qt5-multimedia:x64-windows@5.15.11#1 -- C:\vcpkg\buildtrees\versioning_\versions\qt5-multimedia\e4c6f73398cdab1711339020a1dfe0630e0f89c4
  * qt5-networkauth:x64-windows@5.15.11 -- C:\vcpkg\buildtrees\versioning_\versions\qt5-networkauth\2245d4d7c2e1064fd19a893f34ee247bdb07322b
  * qt5-quickcontrols:x64-windows@5.15.11 -- C:\vcpkg\buildtrees\versioning_\versions\qt5-quickcontrols\9e63a158c8c9551554c2986dab6d771efabd38c7
  * qt5-quickcontrols2:x64-windows@5.15.11 -- C:\vcpkg\buildtrees\versioning_\versions\qt5-quickcontrols2\e1d335409f6c5c9af37eb6721b5d68d78a8dbdb1
    qt5-svg:x64-windows@5.15.11 -- C:\vcpkg\buildtrees\versioning_\versions\qt5-svg\c938a0870f30cebe24c31abefa8ac8a8dc60722a
    qt5-tools:x64-windows@5.15.11 -- C:\vcpkg\buildtrees\versioning_\versions\qt5-tools\5b41d2e4f17b9cbcb85f1fe67b9e1adfaa70a0cb
    qt5-translations:x64-windows@5.15.11 -- C:\vcpkg\buildtrees\versioning_\versions\qt5-translations\0d49653566c4a0eae04e6b56cb9b3904b7c826af
  * qt5-websockets:x64-windows@5.15.11 -- C:\vcpkg\buildtrees\versioning_\versions\qt5-websockets\b8589b41f61533965537f8a6701d2f8ea015f1f2
    readline:x64-windows@0#5 -- C:\vcpkg\buildtrees\versioning_\versions\readline\f4d85b7efb4b5a01e60852a81a351971c8c5dd78
  * readline-win32:x64-windows@5.0#8 -- C:\vcpkg\buildtrees\versioning_\versions\readline-win32\9c7dd189ed4434c993da75506f0b6d4e94b7f952
  * sqlite3[core,json1]:x64-windows@3.43.2 -- C:\vcpkg\buildtrees\versioning_\versions\sqlite3\45ea1b638c4911a25f145365f06a11802b12c81e
  * tiff[core,jpeg,lzma,zip]:x64-windows@4.6.0#1 -- C:\vcpkg\buildtrees\versioning_\versions\tiff\1c0fc716f916833234f0fb5e7061d52e9063e7c6
  * vcpkg-cmake:x64-windows@2023-05-04 -- C:\vcpkg\buildtrees\versioning_\versions\vcpkg-cmake\88a7058fc7fa73a9c4c99cfcae9d79e2abf87a5a
  * vcpkg-cmake-config:x64-windows@2022-02-06#1 -- C:\vcpkg\buildtrees\versioning_\versions\vcpkg-cmake-config\8d54cc4f487d51b655abec5f9c9c3f86ca83311f
  * vcpkg-cmake-get-vars:x64-windows@2023-03-02 -- C:\vcpkg\buildtrees\versioning_\versions\vcpkg-cmake-get-vars\2e624c2cf12a97a7a802e31ff1d28b9fa6ba9bde
  * vcpkg-pkgconfig-get-modules:x64-windows@2023-09-06 -- C:\vcpkg\buildtrees\versioning_\versions\vcpkg-pkgconfig-get-modules\365f7303c0f9fe13458a62e7e4998760e6d918a4
  * vcpkg-tool-meson:x64-windows@0.63 -- C:\vcpkg\buildtrees\versioning_\versions\vcpkg-tool-meson\bee0cb6c5edf45133ebc9643b86c9c775ab36cfe
    zlib:x64-windows@1.3 -- C:\vcpkg\buildtrees\versioning_\versions\zlib\5ac18c6e6e3e2bf5a9e3d0bc8a845f198e4c4e05
  * zstd:x64-windows@1.5.5#2 -- C:\vcpkg\buildtrees\versioning_\versions\zstd\259dc461801ecb946995e13fd3d94b1381d02441
Additional packages (*) will be modified to complete this operation.
Restored 43 package(s) from C:\Users\bleo\AppData\Local\vcpkg\archives in 21 s. Use --debug to see more details.
Installing 1/43 vcpkg-cmake-config:x64-windows@2022-02-06#1...
Elapsed time to handle vcpkg-cmake-config:x64-windows: 7.31 ms
vcpkg-cmake-config:x64-windows package ABI: ed08853ea82d4b8d5ba42d0cff7d17a66747623f0dc25ab043a48103fb4076e5
Installing 2/43 vcpkg-cmake:x64-windows@2023-05-04...
Elapsed time to handle vcpkg-cmake:x64-windows: 8.66 ms
vcpkg-cmake:x64-windows package ABI: 725a867c437635518b4a653aaa8062feb6655085a6eb86b352a20de53822fee2
Installing 3/43 argon2:x64-windows@20190702#1...
Elapsed time to handle argon2:x64-windows: 18.9 ms
argon2:x64-windows package ABI: 652c86c9bbeb1cb8220c7bf32b988bfe89a3e8fb38910d2675e5193279d79be6
Installing 4/43 vcpkg-cmake-get-vars:x64-windows@2023-03-02...
Elapsed time to handle vcpkg-cmake-get-vars:x64-windows: 11.9 ms
vcpkg-cmake-get-vars:x64-windows package ABI: 547a8fb7e7cade26ee3ec1553e45d9742625e1da73672b49899d5211f3e47611
Installing 5/43 botan:x64-windows@3.1.1#1...
Elapsed time to handle botan:x64-windows: 44.3 ms
botan:x64-windows package ABI: d93d901934a4b0facb52f820e92f4ba3615fcd0f1b3d6d56022cb1063ca4b2b3
Installing 6/43 zlib:x64-windows@1.3...
Elapsed time to handle zlib:x64-windows: 20.7 ms
zlib:x64-windows package ABI: 647a3089131eb0a2e7fe286519e93e0aa203ae4928ca385fb8dcf675014fab5e
Installing 7/43 libpng:x64-windows@1.6.40...
Elapsed time to handle libpng:x64-windows: 25 ms
libpng:x64-windows package ABI: 6668cdf34c2d62acc249b77f56c7508e19b77bf6bc80b43e116078422422d4cd
Installing 8/43 libiconv:x64-windows@1.17#1...
Elapsed time to handle libiconv:x64-windows: 27 ms
libiconv:x64-windows package ABI: 8407514544a3dd960e210c2208baf9a4825db560f20b7e0784e03bd89a22a388
Installing 9/43 libqrencode:x64-windows@4.1.1#2...
Elapsed time to handle libqrencode:x64-windows: 21.1 ms
libqrencode:x64-windows package ABI: cd7013218ffe73c77b7aea94bc3c66d1a2a40f33ac6921a87597514138ab7064
Installing 10/43 minizip:x64-windows@1.3#1...
Elapsed time to handle minizip:x64-windows: 23.1 ms
minizip:x64-windows package ABI: 6eac1889628ec99c6d0b2946f80f2c55e0cdfb2f5d316a7b45f543740b496527
Installing 11/43 zstd:x64-windows@1.5.5#2...
Elapsed time to handle zstd:x64-windows: 43.5 ms
zstd:x64-windows package ABI: b0f0e756796bf7538c98a5b14a8e88a0dbf860b3d4101c5740d204bbdbc48894
Installing 12/43 vcpkg-tool-meson:x64-windows@0.63...
Elapsed time to handle vcpkg-tool-meson:x64-windows: 273 ms
vcpkg-tool-meson:x64-windows package ABI: c6d782984dcdaaaed9ce3657de8eaf9b7413b85ab0853cc7a720b844acb28900
Installing 13/43 pkgconf:x64-windows@2.1.0...
Elapsed time to handle pkgconf:x64-windows: 20.1 ms
pkgconf:x64-windows package ABI: 6e910b7f9f6ad69eaf07d800623820ac7ed4e83bb4aa4ffcd0c27e80ad92c801
Installing 14/43 vcpkg-pkgconfig-get-modules:x64-windows@2023-09-06...
Elapsed time to handle vcpkg-pkgconfig-get-modules:x64-windows: 15.7 ms
vcpkg-pkgconfig-get-modules:x64-windows package ABI: 7cd7600a952a294c5d2bd1a735e3e8b317a92ed8a54bfed5256667cc93f6847e
Installing 15/43 sqlite3[core,json1]:x64-windows@3.43.2...
Elapsed time to handle sqlite3:x64-windows: 14.9 ms
sqlite3:x64-windows package ABI: e0b7abce96edc79b2fc563bb5b6c1877d1139c91aa68113315c89d24d0472011
Installing 16/43 pcre2[core,jit,platform-default-features]:x64-windows@10.42#1...
Elapsed time to handle pcre2:x64-windows: 19.7 ms
pcre2:x64-windows package ABI: 8307033ae1ea9800fa699091a69bd1bce7241189a3b67eaf5050c9537b66c896
Installing 17/43 openssl:x64-windows@3.1.4#1...
Elapsed time to handle openssl:x64-windows: 39.7 ms
openssl:x64-windows package ABI: 7f8160c3cab71fe2a2eccf6b48d4f21c9635dd4361af16c6fa4bc915dca529f4
Installing 18/43 libjpeg-turbo:x64-windows@3.0.1...
Elapsed time to handle libjpeg-turbo:x64-windows: 22.9 ms
libjpeg-turbo:x64-windows package ABI: c4cd90000facc1567361ceca490d1b01f08a5abe74299ecf94525b2ed7be64bc
Installing 19/43 bzip2[core,tool]:x64-windows@1.0.8#5...
Elapsed time to handle bzip2:x64-windows: 17.4 ms
bzip2:x64-windows package ABI: a2da49e43418937ea0c1f4c11ae085504daf394193910a922c8232e74d431aa0
Installing 20/43 brotli:x64-windows@1.1.0#1...
Elapsed time to handle brotli:x64-windows: 22 ms
brotli:x64-windows package ABI: e384c966c11eb7af722d29bc54b35608ffa6d83a1572f1fb59d3952861e55658
Installing 21/43 freetype[brotli,bzip2,core,png,zlib]:x64-windows@2.12.1#4...
Elapsed time to handle freetype:x64-windows: 37.5 ms
freetype:x64-windows package ABI: 91312078de1184a7af40901ef7b259c9e86a3d19566c716df7d0222c74af6098
Installing 22/43 harfbuzz:x64-windows@8.2.1#3...
Elapsed time to handle harfbuzz:x64-windows: 26.9 ms
harfbuzz:x64-windows package ABI: a05800979b6d1fbdecade2272c5a5c5a0105c28ac326ecc251cf45baa84c045f
Installing 23/43 egl-registry:x64-windows@2022-09-20...
Elapsed time to handle egl-registry:x64-windows: 15 ms
egl-registry:x64-windows package ABI: 27b69b609e720da629f773f0e90965410a0718e94ec8380765fc721153ee1e5b
Installing 24/43 double-conversion:x64-windows@3.3.0...
Elapsed time to handle double-conversion:x64-windows: 15.6 ms
double-conversion:x64-windows package ABI: cc406d6efee4d74549acb754c240d6760926224915d390487414b74d88f420be
Installing 25/43 qt5-base:x64-windows@5.15.11#1...
Elapsed time to handle qt5-base:x64-windows: 593 ms
qt5-base:x64-windows package ABI: 4df0daf5cc7c743267a3d60a464efcb57bace744d8ddd9d7d366f2ed23a9a4ea
Installing 26/43 qt5-svg:x64-windows@5.15.11...
Elapsed time to handle qt5-svg:x64-windows: 28.5 ms
qt5-svg:x64-windows package ABI: a7d76b3719b1c0b8fec75bcb41a3ef4b9e1f2ccabc9dc3d05994613b8b423110
Installing 27/43 libwebp[core,libwebpmux,nearlossless,simd,unicode]:x64-windows@1.3.2...
Elapsed time to handle libwebp:x64-windows: 35.7 ms
libwebp:x64-windows package ABI: f05ff26d0656803771fa4f44a5c3c76643871bca3aa2b604dabac9e6b41a98ac
Installing 28/43 liblzma:x64-windows@5.4.4...
Elapsed time to handle liblzma:x64-windows: 22.4 ms
liblzma:x64-windows package ABI: 8c3af840509a737f8319b617621b3290a7f721062c6edf4f13a4a1709d869f2e
Installing 29/43 tiff[core,jpeg,lzma,zip]:x64-windows@4.6.0#1...
Elapsed time to handle tiff:x64-windows: 19.4 ms
tiff:x64-windows package ABI: cf8079d1b416c7250f5a2bc92282e152c88defe5fbe6175e97da39c118dfb2b3
Installing 30/43 qt5-imageformats[core,tiff,webp]:x64-windows@5.15.11...
Elapsed time to handle qt5-imageformats:x64-windows: 24.5 ms
qt5-imageformats:x64-windows package ABI: 729480bbe2c98f1d6bc78a961b58a9f395e3a727ee1a43adfa14c85676f539a5
Installing 31/43 qt5-declarative[core,d3d12,platform-default-features]:x64-windows@5.15.11...
Elapsed time to handle qt5-declarative:x64-windows: 203 ms
qt5-declarative:x64-windows package ABI: da27cac8d91616351f1c13d0b0f8bb1b040e396c10d2d6b78371e17107e23e29
Installing 32/43 qt5-websockets:x64-windows@5.15.11...
Elapsed time to handle qt5-websockets:x64-windows: 30.6 ms
qt5-websockets:x64-windows package ABI: 10f5cf76e60277f891af17c3d46f044e965312216e99f6f66720dd290be4c44a
Installing 33/43 qt5-activeqt:x64-windows@5.15.11...
Elapsed time to handle qt5-activeqt:x64-windows: 41.8 ms
qt5-activeqt:x64-windows package ABI: 76a4fba16bf779b116938fca9747c2e241d68d5e05beee9a98a4851520d5a09c
Installing 34/43 qt5-tools:x64-windows@5.15.11...
Elapsed time to handle qt5-tools:x64-windows: 117 ms
qt5-tools:x64-windows package ABI: d5dc6c942770a4e246ff9637e7fe1763cdfbbe5b8790e9a42c395d945d30006f
Installing 35/43 qt5-translations:x64-windows@5.15.11...
Elapsed time to handle qt5-translations:x64-windows: 108 ms
qt5-translations:x64-windows package ABI: 0e0818bb33cf878c6b4672e97c807144ae315f6cbd55a7d3bf7b11bec680c795
Installing 36/43 qt5-quickcontrols2:x64-windows@5.15.11...
Elapsed time to handle qt5-quickcontrols2:x64-windows: 161 ms
qt5-quickcontrols2:x64-windows package ABI: 3e0b5e95b433aca1e542f30dfaae36a5b52026d0e347c8e5dcfbd718a121421d
Installing 37/43 qt5-graphicaleffects:x64-windows@5.15.11...
Elapsed time to handle qt5-graphicaleffects:x64-windows: 35.8 ms
qt5-graphicaleffects:x64-windows package ABI: 7f6213d14ba98beec9e2d5fa20606f10099d0fbae6f1228140a6619d188041d5
Installing 38/43 qt5-quickcontrols:x64-windows@5.15.11...
Elapsed time to handle qt5-quickcontrols:x64-windows: 132 ms
qt5-quickcontrols:x64-windows package ABI: f383cd377fcd62ced9ba6395f78f2eb989c23697896c91f4f77fa95688eb73df
Installing 39/43 qt5-networkauth:x64-windows@5.15.11...
Elapsed time to handle qt5-networkauth:x64-windows: 29 ms
qt5-networkauth:x64-windows package ABI: c8c836c94e08d950e33f2ed4dd2f0d17d86d7b084ea618d03601b4c12decec29
Installing 40/43 qt5-multimedia:x64-windows@5.15.11#1...
Elapsed time to handle qt5-multimedia:x64-windows: 72.1 ms
qt5-multimedia:x64-windows package ABI: 186c620d9fec2d81aaf152e8ada53c7b0de2b9cdb81b39012c67d0bf2918ce5d
Installing 41/43 qt5[activeqt,core,declarative,essentials,imageformats,multimedia,networkauth,quickcontrols,quickcontrols2,svg,tools,translations,websockets]:x64-windows@5.15.11...
Elapsed time to handle qt5:x64-windows: 32.3 ms
qt5:x64-windows package ABI: bfa75343b770891e94e667a480f0ce053f99eaaffd40e5912c6fda892ffdf42b
Installing 42/43 readline-win32:x64-windows@5.0#8...
Elapsed time to handle readline-win32:x64-windows: 33.8 ms
readline-win32:x64-windows package ABI: 43d92eb6f2ecd49fed3271f295cf8b8bb3c02d54d212cd455c06a4603f52914e
Installing 43/43 readline:x64-windows@0#5...
Elapsed time to handle readline:x64-windows: 19.9 ms
readline:x64-windows package ABI: d015eb6f15ac5486e22f2680d5ad114a5848c798f68a7a958999c014430b0d21
Total install time: 2.5 s
argon2 provides CMake targets:

    find_package(unofficial-argon2 CONFIG REQUIRED)
    target_link_libraries(main PRIVATE unofficial::argon2::libargon2)

botan provides pkg-config modules:

  # Crypto and TLS for Modern C++
  botan-3

The package zlib is compatible with built-in CMake targets:

    find_package(ZLIB REQUIRED)
    target_link_libraries(main PRIVATE ZLIB::ZLIB)

To use libqrencode library in CMakeLists.txt:

    find_path(QRENCODE_INCLUDE_DIR NAMES qrencode.h)
    find_library(QRENCODE_LIBRARY_RELEASE qrencode)
    find_library(QRENCODE_LIBRARY_DEBUG qrencoded)
    set(QRENCODE_LIBRARIES optimized ${QRENCODE_LIBRARY_RELEASE} debug ${QRENCODE_LIBRARY_DEBUG})

    add_executable(main main.cpp)
    target_include_directories(main PRIVATE ${QRENCODE_INCLUDE_DIR})
    target_link_libraries(main PRIVATE ${QRENCODE_LIBRARIES})

minizip provides CMake targets:

    find_package(unofficial-minizip CONFIG REQUIRED)
    target_link_libraries(main PRIVATE unofficial::minizip::minizip)

the package readline can be used under windows via:

    find_package(unofficial-readline-win32 CONFIG REQUIRED)
    target_link_libraries(main PRIVATE unofficial::readline-win32::readline)

The package readline can be imported via the CMake FindPkgConfig module:

    find_package(PkgConfig REQUIRED)
    pkg_check_modules(readline REQUIRED IMPORTED_TARGET readline)
    target_link_libraries(main PRIVATE PkgConfig::readline)

-- Running vcpkg install - done
-- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.41.34120.0
-- The CXX compiler identification is MSVC 19.41.34120.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git HEAD Revision: ea2e36c

-- Setting up build for KeePassXC v2.8.0-snapshot

-- Found Botan: C:/Users/bleo/_prj/keepassxc/build/vcpkg_installed/x64-windows/debug/lib/botan-3.lib (found version "3.1.1")
-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP_CXX: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0")
-- Performing Test CC_HAS_Werror_format_security
-- Performing Test CC_HAS_Werror_format_security - Failed
-- Performing Test CXX_HAS_Werror_format_security
-- Performing Test CXX_HAS_Werror_format_security - Failed
-- Performing Test CC_HAS_Werror_implicit_function_declaration
-- Performing Test CC_HAS_Werror_implicit_function_declaration - Failed
-- Performing Test CC_HAS_Wcast_align
-- Performing Test CC_HAS_Wcast_align - Failed
-- Performing Test CXX_HAS_Wcast_align
-- Performing Test CXX_HAS_Wcast_align - Failed
-- Performing Test CXX_HAS_fsized_deallocation
-- Performing Test CXX_HAS_fsized_deallocation - Failed
-- Using windeployqt: C:/Users/bleo/_prj/keepassxc/build/vcpkg_installed/x64-windows/tools/qt5-tools/bin/windeployqt.exe
-- Found ZLIB: optimized;C:/Users/bleo/_prj/keepassxc/build/vcpkg_installed/x64-windows/lib/zlib.lib;debug;C:/Users/bleo/_prj/keepassxc/build/vcpkg_installed/x64-windows/debug/lib/zlibd.lib (found version "1.3.0")
-- Found Minizip: C:/Users/bleo/_prj/keepassxc/build/vcpkg_installed/x64-windows/debug/lib/minizip.lib
CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find PCSC (missing: PCSC_LIBRARIES PCSC_INCLUDE_DIRS)
Call Stack (most recent call first):
  C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindPCSC.cmake:37 (find_package_handle_standard_args)
  C:/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
  CMakeLists.txt:568 (find_package)


-- Configuring incomplete, errors occurred!
PS C:\Users\bleo\_prj\keepassxc\build>

@droidmonkey
Copy link
Member

droidmonkey commented Oct 5, 2024

You likely need to reinstall the windows sdk. Your change basically brute forces a path for the sdk. This should have been added to your environment already and findable by cmake. Alternatively you need to build from within a visual studio command prompt environment.

I'm ok merging your solution but it shouldn't be necessary in a properly configured build environment.

@blessio
Copy link
Contributor Author

blessio commented Oct 5, 2024

Thanks for agreeing to merge.

  • Please let me know if I should do something to facilitate this.

  • FYI 1: Before I made the changes, I reinstalled the Windows-SDK but it did not help.
    Indeed, it should not have because the way to make PCSC from the WinSDK found is to define implicit include and lib paths (CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES and CMAKE_C_IMPLICIT_LINK_DIRECTORIES), which is done by VS I believe - not by the installation of the sdk.
    As a second fact I noticed that these two implicit directories are not referred anywhere else in the project's cmake files, which ... I interpreted as "it is not recommended to use them" anyways :-)

  • FYI 2: I am still not sure how the TeamCity build succeeds -- Probably, it is PCSC-Light being installed or preloaded in the environment or SDK parameter directly given on cmake command-line ... (I have spent some time trying to understand by looking at the TeamCity successfull build but failed to understand it).

No need to answer the FYI paragraphs (as my issue is solved anyways) - I just share that it is not obvious how these implicit folders are resolved ...

@droidmonkey
Copy link
Member

droidmonkey commented Oct 5, 2024

@blessio I think you just need to properly invoke the VS command shell so your build can find the appropriate Windows SDK. This is what the CI does:

Import-Module "$Env:VSINSTALLDIR\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath "$Env:VSINSTALLDIR" -Arch amd64

You might need to define the VSINSTALLDIR environment variable, I have it set to: C:\Program Files\Microsoft Visual Studio\2022\Community\

@droidmonkey droidmonkey self-requested a review October 5, 2024 19:54
@keepassxreboot keepassxreboot deleted a comment from gburkhow Oct 7, 2024
@keepassxreboot keepassxreboot deleted a comment from gburkhow Oct 7, 2024
@keepassxreboot keepassxreboot deleted a comment from gburkhow Oct 7, 2024
@keepassxreboot keepassxreboot deleted a comment from gburkhow Oct 7, 2024
@keepassxreboot keepassxreboot deleted a comment from gburkhow Oct 7, 2024
@keepassxreboot keepassxreboot deleted a comment from gburkhow Oct 7, 2024
@blessio
Copy link
Contributor Author

blessio commented Oct 7, 2024

@blessio I think you just need to properly invoke the VS command shell so your build can find the appropriate Windows SDK. This is what the CI does:

Import-Module "$Env:VSINSTALLDIR\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath "$Env:VSINSTALLDIR" -Arch amd64

You might need to define the VSINSTALLDIR environment variable, I have it set to: C:\Program Files\Microsoft Visual Studio\2022\Community\

Thanks for the hint.

For now, I prefer to build without VS proper (and without any GUI, albeit in command-line mode).

Will let you know "if" and "when" I succeed and send you a link (and why not if you like it merge it later).

Improved the fix of PCS library find on windows
@blessio
Copy link
Contributor Author

blessio commented Oct 15, 2024

Probably a "side question": Please let me know if this is useful for you, and if "yes" would you like it in this PR or a separate PR?

Full GitHub Actions Build on Windows and Linux (MacOS pending):

FYI: Windows builds are terribly slow especially if run for first time (because of complete VCPKG not cached yet)

@droidmonkey
Copy link
Member

droidmonkey commented Oct 15, 2024

We already do a github actions build for Linux to do code quality checks. Our CI does Windows, Mac, and Linux builds.

@xboxones1
Copy link
Contributor

xboxones1 commented Oct 28, 2024

There are no errors during the build, use command promt for vs
cmd:
%comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"

@blessio
Copy link
Contributor Author

blessio commented Nov 3, 2024

There are no errors during the build, use command prompt for vs cmd: ...

Thanks for the hint, Droidmonkey explained this in the thread above :-)
I prefer to build with pure command-line tools.

My own comment from before:
Full GitHub Actions Build on Windows and Linux (MacOS pending):
now this is available

This is now available and MacOS is not pending:

On MacOS tests pass but not so much on Windows and Linux.
Windows example https://github.com/blessio/keepassxc-B/actions/runs/11652619461/job/32444033726#step:29:104

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants