Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sys/fcntl.h : no such file while cross compiling pcsclite for Android?

all: i'm making a android application that can commnicate with a ccid smart card reader from android mobile, i chose this way :"pcsc-lite-1.8.5 + ccid-1.4.7 + libusb-1.0.3" which run in Ubuntu(linux OS on pc) very well. then i tried to port them to android , there are lots of problems while cross-compiling. most of these problems is that Bionic library of Android lack some headers and functions, like:

  1. sys/fcntl.h , mqueue.h : no such file ;

  2. pthread_cancel : undefined reference ;

and now , while i'm cross-compiling pcsclite for building executable "pcscd" , i got this error :

sd-daemon.c:35:23: fatal error:sys/fcntl.h:No such file or directory

Android.mk :

#===================================================
# ******  pcscd ******  
#===================================================

include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE:=false
LOCAL_SRC_FILES:=atrhandler.c \
     debuglog.c \
     dyn_hpux.c \
     dyn_macosx.c \
     dyn_unix.c \
     eventhandler.c \
     hotplug_generic.c \
     ifdwrapper.c \
     pcscdaemon.c \
     powermgt_generic.c \
     prothandler.c \
     readerfactory.c \
     simclist.c \
     strlcat.c \
     sys_unix.c \
     tokenparser.c \
     hotplug_libudev.c \
     hotplug_libusb.c \
     hotplug_linux.c \
     hotplug_macosx.c \
     utils.c \
     winscard.c \
     winscard_msg.c \
     winscard_msg_srv.c \
     winscard_svc.c \
     sd-daemon.c
LOCAL_CFLAGS+= -DHAVE_LIBUSB
LOCAL_C_INCLUDES+=$(LOCAL_PATH)/ $(LOCAL_PATH)/src/ $(HOME)/android-ndk-r8b/samples/includes-libusb1.0.3/ $(LOCAL_PATH)/PCSC/ 
LOCAL_LDFLAGS:=-shared
LOCAL_MODULE:=pcscd
LOCAL_LDLIBS:=-llog $(HOME)/android-ndk-r8b/samples/libs-libusb1.0.3/libusb-1.0.so
include $(BUILD_EXECUTABLE)
like image 578
bob Avatar asked Sep 12 '12 08:09

bob


1 Answers

Many of the Android headers aren't in the standard location. You can use the following command to search the NDK for the location of missing files find . -name fcntl.h. It appears include <sys/fcntl.h> needs to be changed to include <fcntl.h>.

The Android pthread library does not include pthread_cancel see 'docs/OVERVIEW.html'. It should not be difficult to replace pthread_cancel.

I am not sure what to do about mqueue.

like image 93
Frohnzie Avatar answered Oct 13 '22 00:10

Frohnzie