PCSC icon indicating copy to clipboard operation
PCSC copied to clipboard

Fix using dlopen on OpenBSD

Open brad0 opened this issue 1 year ago • 4 comments

libraries dlopen'd on OpenBSD need to have the major version left off.

brad0 avatar Jul 29 '24 00:07 brad0

Surprising

How do you install 2 different major versions of a library at the same time? You can't do that on OpenBSD?

LudovicRousseau avatar Jul 29 '24 09:07 LudovicRousseau

Surprising

How do you install 2 different major versions of a library at the same time? You can't do that on OpenBSD?

Shared libs and versioning are handled a bit differently with OpenBSD versus other ELF based OS. There are no symlinks. As in no libfoo.so, libfoo.so.1 symlinks. Just libfoo.so.2.0, libfoo.so.3.0.

brad0 avatar Aug 01 '24 06:08 brad0

ah OK. So will it work if the code uses libpcsclite_real.so.1.0 instead of libpcsclite_real.so.1?

LudovicRousseau avatar Aug 01 '24 10:08 LudovicRousseau

I tried on OpenBSD 7.5 and I have NO problem with the current code.

In the build directory the files are:

openbsd$ ls
build.ninja                libpcsclite_real.so.1      pcsc_demo.p
compile_commands.json      libpcsclite_real.so.1.p    pcscd
config.h                   libpcscspy.so              pcscd.8
doxygen.conf               libpcscspy.so.0            pcscd.h
libpcsclite.so             libpcscspy.so.0.p          pcscd.p
libpcsclite.so.1           meson-info                 pcsclite.h
libpcsclite.so.1.p         meson-logs                 reader.conf.5
libpcsclite_fake.so        meson-private              testpcsc
libpcsclite_fake.so.p      meson-uninstalled          testpcsc.p
libpcsclite_real.so        pcsc_demo

I have no problem to run the sample code ./testpcsc for example:

penbsd$ ./testpcsc                                                            

MUSCLE PC/SC Lite unitary test Program

THIS PROGRAM IS NOT DESIGNED AS A TESTING TOOL FOR END USERS!
Do NOT use it unless you really know what you do.

Testing SCardEstablishContext	: Command successful.
Testing SCardIsValidContext	: Command successful.
Testing SCardIsValidContext	: Invalid handle. (don't panic)
Testing SCardListReaderGroups	: Command successful.
Group 01: SCard$DefaultReaders
Testing SCardFreeMemory		: Command successful.
Testing SCardListReaders	: Cannot find a smart card reader. (don't panic)
Testing SCardGetStatusChange 
Please insert a working reader	: ^C

If pcscd is not started I get:

openbsd$ ./testpcsc                                                            

MUSCLE PC/SC Lite unitary test Program

THIS PROGRAM IS NOT DESIGNED AS A TESTING TOOL FOR END USERS!
Do NOT use it unless you really know what you do.

Testing SCardEstablishContext	: Service not available.

"Service not available." is the expected error.

If I remove libpcsclite_real.so.1 I get instead:

openbsd$ ./testpcsc                                                            

MUSCLE PC/SC Lite unitary test Program

THIS PROGRAM IS NOT DESIGNED AS A TESTING TOOL FOR END USERS!
Do NOT use it unless you really know what you do.

loading "libpcsclite_real.so.1" failed: File not found
Testing SCardEstablishContext	: Internal error.

I guess your problem is elsewhere.

LudovicRousseau avatar Aug 02 '24 09:08 LudovicRousseau

No feedback since one month. If you think there is a real bug please add your comments.

Closing for now

LudovicRousseau avatar Sep 07 '24 09:09 LudovicRousseau