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 pcscd error #25

Closed
FeitianSmartcardReader opened this issue Sep 27, 2017 · 8 comments
Closed

Build pcscd error #25

FeitianSmartcardReader opened this issue Sep 27, 2017 · 8 comments

Comments

@FeitianSmartcardReader
Copy link

Hi Ludovic

I do build pcscd and found some error:
root@ubuntu:/opt/software/pcscd/PCSC# ./configure CC=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-fsl-linux-gnueabi-gcc --host=arm-fsl-linux prefix=/usr/ccid --enable-libusb LIBUSB_LIBS="-L/usr/ccid/install/lib -lusb-1.0" LIBUSB_CFLAGS="-I/usr/ccid/install/include/libusb-1.0" PCSC_CFLAGS="-I/usr/ccid/include/PCSC" PCSC_LIBS="-L/usr/ccid/lib/ -lpcsclite" --enable-usbdropdir="/usr/ccid/lib/pcsc/drivers" --enable-static --disable-libudev --disable-libsystemd

After, do make, got below error:
root@ubuntu:/opt/software/pcscd/PCSC# make
make all-recursive
make[1]: Entering directory /opt/software/pcscd/PCSC' Making all in src make[2]: Entering directory /opt/software/pcscd/PCSC/src'
Making all in spy
make[3]: Entering directory /opt/software/pcscd/PCSC/src/spy' make[3]: Nothing to be done for all'.
make[3]: Leaving directory /opt/software/pcscd/PCSC/src/spy' make[3]: Entering directory /opt/software/pcscd/PCSC/src'
CCLD pcsc-wirecheck
pcsc-wirecheck-main.o: In function main': /opt/software/pcscd/PCSC/src/pcsc-wirecheck-main.c:12: undefined reference to pcsc_assert_wire_constants'
collect2: ld returned 1 exit status
make[3]: *** [pcsc-wirecheck] Error 1
make[3]: Leaving directory /opt/software/pcscd/PCSC/src' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory /opt/software/pcscd/PCSC/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/software/pcscd/PCSC'
make: *** [all] Error 2
root@ubuntu:/opt/software/pcscd/PCSC#

I do comment that line, then can build successful

There have two issues:

  1. Build got /opt/software/pcscd/PCSC/src/pcsc-wirecheck-main.c:12: undefined reference to `pcsc_assert_wire_constants'
  2. Download package from release, build give configfile.c missing
@LudovicRousseau
Copy link
Owner

pcsc_assert_wire_constants is defined in pcsc-wirecheck-dist.c generated by pcsc-wirecheck-gen.

What is the result of:

$ make pcsc-wirecheck-dist.c

@FeitianSmartcardReader
Copy link
Author

strange, the pcsc-wirecheck-dist.c is empty, no any code.

root@ubuntu:/opt/software/package/ccid/CCID/PCSC/src# cat pcsc-wirecheck-dist.c root@ubuntu:/opt/software/package/ccid/CCID/PCSC/src# make pcsc-wirecheck-dist.cmake: `pcsc-wirecheck-dist.c' is up to date.
root@ubuntu:/opt/software/package/ccid/CCID/PCSC/src#

@LudovicRousseau
Copy link
Owner

Remove the file pcsc-wirecheck-dist.c and run make pcsc-wirecheck-dist.c again.

@FeitianSmartcardReader
Copy link
Author

root@ubuntu:/opt/software/package/ccid/CCID/PCSC/src# make pcsc-wirecheck-dist.c CC pcsc-wirecheck-gen.o
CCLD pcsc-wirecheck-gen
rm -f pcsc-wirecheck-dist.c
./pcsc-wirecheck-gen > pcsc-wirecheck-dist.c.tmp
/bin/bash: line 7: ./pcsc-wirecheck-gen: cannot execute binary file
mv pcsc-wirecheck-dist.c.tmp pcsc-wirecheck-dist.c
root@ubuntu:/opt/software/package/ccid/CCID/PCSC/src#

@FeitianSmartcardReader
Copy link
Author

FeitianSmartcardReader commented Sep 27, 2017

Another strange issue is below
I if comment that line, I can build successful on embed linux, but it has issue for multi-slot reader support, then I want do test under Ubuntu, build pcsc source code under ubuntu, I found another issue.
I am using same command to build, put all related file under /usr/ccid
libusb build with no error
build pcsc got error below
If I using below command, it can build without error:
./configure CC=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-fsl-linux-gnueabi-gcc --host=arm-fsl-linux prefix=/usr/ccid --enable-libusb LIBUSB_LIBS="-L/usr/ccid/install/lib -lusb-1.0" LIBUSB_CFLAGS="-I/usr/ccid/install/include/libusb-1.0" PCSC_CFLAGS="-I/usr/ccid/include/PCSC" PCSC_LIBS="-L/usr/ccid/lib/ -lpcsclite" --enable-usbdropdir="/usr/ccid/lib/pcsc/drivers" --enable-static --disable-libudev --disable-libsystemd

But if replacement to ubuntu local gcc, it give error:
./configure CC=/usr/bin/gcc --host=arm-fsl-linux prefix=/usr/ccid --enable-libusb LIBUSB_LIBS="-L/usr/ccid/install/lib -lusb-1.0" LIBUSB_CFLAGS="-I/usr/ccid/install/include/libusb-1.0" PCSC_CFLAGS="-I/usr/ccid/include/PCSC" PCSC_LIBS="-L/usr/ccid/lib/ -lpcsclite" --enable-usbdropdir="/usr/ccid/lib/pcsc/drivers" --enable-static --disable-libudev --disable-libsystemd

checking libusb.h usability... yes
checking libusb.h presence... yes
checking for libusb.h... yes
checking for libusb_init... configure: error: libusb not found, use ./configure LIBUSB_LIBS=...

root@ubuntu:/opt/software/package/test/PCSC# cat /usr/ccid/install/lib/pkgconfig/libusb-1.0.pc 
prefix=/usr/ccid/install
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libusb-1.0
Description: C API for USB device access from Linux, Mac OS X, Windows, OpenBSD/NetBSD and Solaris userspace
Version: 1.0.21
Libs: -L${libdir} -lusb-1.0
Libs.private: -lrt  -pthread
Cflags: -I${includedir}/libusb-1.0
root@ubuntu:/opt/software/package/test/PCSC# 

I don't understand the libusb already installed, and I do give the right path, but it still inform error

@LudovicRousseau
Copy link
Owner

LudovicRousseau commented Sep 27, 2017

I understand the problem.
pcsc-wirecheck-gen is cross compiled for ARM but is executed on the x86 system.

You can avoid the problem by creating an empty pcsc-wirecheck file.

@FeitianSmartcardReader
Copy link
Author

FeitianSmartcardReader commented Oct 25, 2017

Add comments:
When I do install pcsc and I found it always give below error

checking for libusb_init... configure: error: libusb not found, use ./configure LIBUSB_LIBS=...

after check config.log, I saw there have error

/usr/ccid/lib/libusb-1.0.so: undefined reference to `clock_gettime'

To sovle this issue, will need do build with -lrt:

./configure CC=/opt/arm-2014.05/bin/arm-none-linux-gnueabi-gcc --host=arm-none-linux --prefix=/usr/ccid --prefix=/usr/ccid --enable-libusb LIBUSB_LIBS="-L/usr/ccid/lib/ -lusb-1.0 -lrt" LIBUSB_CFLAGS="-I/usr/ccid/include/libusb-1.0" PCSC_CFLAGS="-I/usr/ccid/include/PCSC" PCSC_LIBS="-L/usr/ccid/lib/ -lpcsclite" --enable-usbdropdir="/usr/ccid/lib/pcsc/drivers"

@LudovicRousseau
Copy link
Owner

The files pcsc-wirecheck-dist.c, pcsc-wirecheck-gen.c and pcsc-wirecheck-main.c are provide in the .tar.bz2 archive.
If you really want to use the source code from git and do cross-compilation you should generate the missing .c files first.

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

2 participants