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

Configure fails on Mac OS X 10.15.7 (Catalina) #210

Closed
smanet80 opened this issue Nov 26, 2021 · 12 comments
Closed

Configure fails on Mac OS X 10.15.7 (Catalina) #210

smanet80 opened this issue Nov 26, 2021 · 12 comments

Comments

@smanet80
Copy link

Expected behaviour

Configure should be able to use the provided PCSC library installed from Brew on Mac OS X 10.15.7
echo $PCSC_CFLAGS
/usr/local/Cellar/pcsc-lite/1.9.4/include/PCSC/

Actual behaviour

Configure fails with the following error:

configure: WARNING: libpcsclite not found by pkg-config
checking for ifdhandler.h... no
configure: error: ifdhandler.h not found, install libpcsclite or use ./configure PCSC_CFLAGS=...
Based on output of config.log, it seems that the PCSC_CFLAGS is ignored. More in the Logs section.

Files in the location:

$ ls -lha $PCSC_CFLAGS
total 168
drwxr-xr-x 8 user wheel 256B 1 Oct 17:01 .
drwxr-xr-x 3 user wheel 96B 1 Oct 17:01 ..
-rw-r--r-- 1 user wheel 4.8K 1 Oct 17:01 debuglog.h
-rw-r--r-- 1 user wheel 30K 1 Oct 17:01 ifdhandler.h
-rw-r--r-- 1 user wheel 15K 1 Oct 17:01 pcsclite.h
-rw-r--r-- 1 user wheel 15K 1 Oct 17:01 reader.h
-rw-r--r-- 1 user wheel 4.1K 1 Oct 17:01 winscard.h
-rw-r--r-- 1
config.log
user wheel 3.0K 1 Oct 17:01 wintypes.h

Steps to reproduce

  1. Download latest tar.gz version from here
  2. Install pcsc-lite from brew
  3. Export the library location via PCSC_CFLAGS (e.g. export PCSC_CFLAGS=[path]
  4. Try the "configure" command on Mac OS X 10.15.7, which will fail with the above error

Logs

$ grep 'PCSC_CFLAGS' config.log
configure:18159: error: ifdhandler.h not found, install libpcsclite or use ./configure PCSC_CFLAGS=...
ac_cv_env_PCSC_CFLAGS_set=set
ac_cv_env_PCSC_CFLAGS_value=/usr/local/Cellar/pcsc-lite/1.9.4/include/PCSC
PCSC_CFLAGS='-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/PCSC.framework/Versions/Current/Headers -DRESPONSECODE_DEFINED_IN_WINTYPES_H -I/Users/user/Downloads/virtualsmartcard-0.8//MacOSX'

@frankmorgner
Copy link
Owner

macOS has a standalone implementation for PC/SC, which is not PCSC-Lite from brew. I think, the default to use should be the former.

Anyway, the compiler flags for macOS are not trivial. I've included a script in the Makefile to do that. Please try

./configure
make osx

If that doesn't work out of the box (anymore), please adapt the single steps to your need:

OSX_TOOLS_DIR = "$(shell xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs"
OSX_TOOL_DIR ?= "$(OSX_TOOLS_DIR)/$(shell ls -1 $(OSX_TOOLS_DIR) | sort -n -k2 -t. -r | head -1)/usr"
OSX_TARGETDIR = $(abs_top_builddir)/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)_osx
osx: $(OPENPACE_MAKEFILE)
@echo Compiling OpenPACE
$(MAKE) -C $(OPENPACE) osx
rm -rf $(OSX_TARGETDIR) dmg $(top_builddir)/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)_osx.dmg
@echo Configuring virtualsmartcard for IFD bundle
cd $(top_builddir) && ./configure --enable-infoplist --prefix=/Library/VirtualSmartCard \
CFLAGS="-arch x86_64" \
--enable-serialdropdir=/usr$(OSX_SERIAL_LOCAL_PREFIX)/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS \
--enable-serialconfdir=/usr$(OSX_SERIAL_LOCAL_PREFIX)/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents
@echo Compiling virtualsmartcard
make -C $(top_builddir) clean install DESTDIR=$(OSX_TARGETDIR)
@echo Configuring virtualsmartcard for builtin libpcsclite
cd $(top_builddir) && ./configure --enable-infoplist --prefix=/Library/VirtualSmartCard \
CFLAGS="-arch x86_64" \
--enable-serialdropdir=/usr$(OSX_SERIAL_LOCAL_PREFIX)/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents/MacOS \
--enable-serialconfdir=/usr$(OSX_SERIAL_LOCAL_PREFIX)/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Contents \
--enable-libpcsclite
@echo Compiling virtualsmartcard
make -C $(top_builddir) clean install DESTDIR=$(OSX_TARGETDIR)
mv $(OSX_TARGETDIR)/usr $(OSX_TARGETDIR)/Library/VirtualSmartCard/usr
pkgbuild --root $(OSX_TARGETDIR) --scripts MacOSX_install --identifier com.vsmartcard.virtualsmartcard.mac --version $(PACKAGE_VERSION) --install-location / VirtualSmartCard-$(PACKAGE_VERSION)_install.pkg
pkgbuild --nopayload --identifier com.vsmartcard.virtualsmartcard.mac.uninstall --scripts MacOSX_uninstall Uninstall_VirtualSmartCard.pkg
mkdir -p dmg
cp *.pkg dmg
cp $(OPENPACE)/cross/*.pkg dmg
hdiutil create -srcfolder dmg -volname "$(PACKAGE_STRING) for Mac OS X" $(top_builddir)/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)_osx.dmg

@smanet80
Copy link
Author

smanet80 commented Dec 3, 2021

Hi Frank,

It seems that the issue with the configure itself. Even without parameters, it cannot find ifdhandler.h (that's the reason why I have tried with brew to get the PCSC library):

configure: WARNING: libpcsclite not found by pkg-config
checking for ifdhandler.h... no
configure: error: ifdhandler.h not found, install libpcsclite or use ./configure PCSC_CFLAGS=...

I did run a find on whole system and I can't find that file anywhere outside in the brew location.

@frankmorgner
Copy link
Owner

What version of XCode do you have installed?

@smanet80
Copy link
Author

smanet80 commented Dec 8, 2021

Version 12.4 (12D4e)

@frankmorgner
Copy link
Owner

maybe your support files are missing, have you tried xcode-select --install?

@smanet80
Copy link
Author

smanet80 commented Dec 8, 2021

I have looked into that before but it seems that xcode is up to date:

$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

The only update I have is to upgrade to Monterey at the moment.

I was reading this blog here: https://ludovicrousseau.blogspot.com/2014/03/evolution-of-apple-pcsc-lite-from.html and it made me wonder if Catalina doesn't come anymore with those libraries/heaaders?

@smanet80
Copy link
Author

smanet80 commented Dec 8, 2021

Ok this is pretty interesting.

If I download and try to configure the pre-packaged version 0.8, it fails with the error above.
I have installed autoconf, automake, libtool via brew and cloned the git repository.

Followed the steps for Unix/Linux compilation and the configure doesn't fail in the same way.

autoreconf --verbose --install
autoupdate
./configure --enable-infoplist

I am not sure what is the difference here.
I have tried to run autoreconf on the pre-package bundle but that still doesn't work for me.

@frankmorgner
Copy link
Owner

I was able to reproduce the problem, but I have no idea what causes it...

@smanet80
Copy link
Author

smanet80 commented Dec 10, 2021

I had a subsequent problem with the fact that the system defaults to Python 2.6, which I have resolved pointing the PYTHON environment variable to python3 binary (Python 3.9). After that, the make install is fully successful and I have also tested the application with my identity card, all is working.
Please let me know if I can be of any help in fixing the issue or providing any evidences.

@andreolira
Copy link

andreolira commented Sep 21, 2022

I had a subsequent problem with the fact that the system defaults to Python 2.6, which I have resolved pointing the PYTHON environment variable to python3 binary (Python 3.9). After that, the make install is fully successful and I have also tested the application with my identity card, all is working.
Please let me know if I can be of any help in fixing the issue or providing any evidences.

Does anyone have detailed install instructions? I may be particularly dense today, but am not having much luck installing. Also, anyone installed this with Monterey?

@gy-mate
Copy link

gy-mate commented Apr 12, 2023

I have the same issue on macOS 13.3.1 Ventura, with Xcode 14.2 and Python 3.11.3 installed.

@frankmorgner
Copy link
Owner

I've updated the installation guide:

git clone https://github.com/frankmorgner/vsmartcard.git
cd vsmartcard/virtualsmartcard
autoreconf -vis
./configure --enable-infoplist
make
make install

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

No branches or pull requests

4 participants