Skip to content

Build issues with pcsc-lite 2.2.x #404

@Jakuje

Description

@Jakuje

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions