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

Build issues with pcsc-lite 2.2.x #404

Open
Jakuje opened this issue May 28, 2024 · 0 comments · May be fixed by #411
Open

Build issues with pcsc-lite 2.2.x #404

Jakuje opened this issue May 28, 2024 · 0 comments · May be fixed by #411

Comments

@Jakuje
Copy link
Contributor

Jakuje commented May 28, 2024

The pcsc-lite 2.2.x branch switched from autotools to meson and reworked the pkg-config file to be more standard, which involves some difference from the previous versions that cause the yubihsm-shell fail to build:

-includedir=/usr/include/PCSC
+includedir=${prefix}/include
[...]
-Cflags: -I${includedir} -pthread
+Cflags: -I${includedir}/PCSC

From my reading this change is ok according to the pkg-config specification as the users should make use of the provided CFLAGS to get the right include directories, instead of making the #include <PCSC/winscard.h> as done here.

I think the right solution for this is to add LIBPCSC_CFLAGS (which should come from pkg_check_modules(LIBPCSC REQUIRED libpcsclite). Not sure what would be best for Windows/OSX though so filling only an issue.

I am not a CMake expert so I tried the following change:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index acbb392..07aacc5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -194,6 +194,7 @@ if(NOT BUILD_ONLY_LIB)
 
   if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
     pkg_search_module (LIBPCSC REQUIRED libpcsclite)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBPCSC_CFLAGS}")
   elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
     set (LIBPCSC_LDFLAGS "winscard.lib")
   elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

but it does not work as the LIBPCSC_CFLAGS pushes here the stray semicolon ; causing the build fail at Fedora 39:

┆ LIBPCSC_CFLAGS:INTERNAL=-I/usr/include/PCSC;-pthread                                                                                                        
┆ LIBPCSC_CFLAGS_I:INTERNAL=
┆ LIBPCSC_CFLAGS_OTHER:INTERNAL=-pthread

so it might need some more clever fix to work correctly.

Jakuje added a commit to Jakuje/yubihsm-shell that referenced this issue Jul 30, 2024
The pcsc-lite 2.2.0 switched from autotools to meson and reworked the
pkgconfig files. The new pkg config provides CFLAGS that work ok, but
the yubihsm-shell ignores them and hopes that all included files are in
the default include directory (with the PCSC prefix).

Note, the value ${LIBPCSC_CFLAGS} is not in quotes because it is a
semicolon separated list which we need to split to separate items here.

This solution works with both old and new versions.

Fixes: Yubico#404

Signed-off-by: Jakub Jelen <[email protected]>
@Jakuje Jakuje linked a pull request Jul 30, 2024 that will close this issue
Jakuje added a commit to Jakuje/yubihsm-shell that referenced this issue Jul 30, 2024
The pcsc-lite 2.2.0 switched from autotools to meson and reworked the
pkgconfig files. The new pkg config provides CFLAGS that work ok, but
the yubihsm-shell ignores them and hopes that all included files are in
the default include directory (with the PCSC prefix).

Note, the value ${LIBPCSC_CFLAGS} is a semicolon separated list which
we need to split to separate items here.

This solution works with both old and new versions.

Fixes: Yubico#404

Signed-off-by: Jakub Jelen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant