Opened 3 months ago

Last modified 3 months ago

#4879 new defect

Fix macOS Monterey compilation issues

Reported by: ohmza Owned by:
Priority: critical Component: General
Severity: high Keywords:
Cc: Sensitive: no

Description (last modified by ohmza)

Three files on source code need to be changed in order to make oscam being able to be compiled on macOS Monterey.

First, on Makefile

Change:

ifeq ($(uname_S),Darwin)
	DEFAULT_LIBUSB_FLAGS = -I/opt/local/include
	DEFAULT_LIBUSB_LIB = -L/opt/local/lib -lusb-1.0
	DEFAULT_PCSC_FLAGS = -isysroot $(OSX_SDK)
	DEFAULT_PCSC_LIB = -isysroot $(OSX_SDK) -framework IOKit -framework CoreFoundation -framework PCSC
else

To:

ifeq ($(uname_S),Darwin)
        FIX_OPENSSL_FLAGS_DIR := $(shell ln -sf /usr/local/opt/openssl@1.1/include/openssl /usr/local/include)
        FIX_OPENSSL_LIB_DIR := $(shell ln -sf /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib /usr/local/lib)
        FIX_OPENSSL_LIBCRYPTO_DIR := $(shell ln -sf /usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib /usr/local/lib)
        DEFAULT_LIBCRYPTO_LIB = -L/usr/local/opt/openssl@1.1/lib -lcrypto
        DEFAULT_SSL_LIB = -L/usr/local/opt/openssl@1.1/lib -lssl
	DEFAULT_LIBUSB_FLAGS = -I/usr/local/opt/libusb/include
	DEFAULT_LIBUSB_LIB = -L/usr/local/opt/libusb/lib -lusb-1.0 -framework IOKit -framework CoreFoundation -framework Security
	DEFAULT_PCSC_FLAGS = -I/usr/local/opt/pcsc-lite/include/PCSC
	DEFAULT_PCSC_LIB = -L/usr/local/opt/pcsc-lite/lib -framework IOKit -framework CoreFoundation -framework PCSC
else

Second, on globals.h

Change:

#include <sys/sysmacros.h>

To:

#if !defined(__APPLE__)
#include <sys/sysmacros.h>
#endif

Lastly, on csctapi/ifd_pcsc.c

Change:

#if defined(__CYGWIN__)
#define __reserved
#define __nullnullterminated
#include <specstrings.h>
#include <WinSCard.h>
#else
#include <PCSC/pcsclite.h>
#include <PCSC/winscard.h>
#include <PCSC/wintypes.h>
#if !defined(__APPLE__)
#include <PCSC/reader.h>
#endif
#endif

To:

#if defined(__CYGWIN__)
#define __reserved
#define __nullnullterminated
#include <specstrings.h>
#include <WinSCard.h>
#endif

#if !defined(__CYGWIN__)
#if !defined(__APPLE__)
#include <PCSC/pcsclite.h>
#include <PCSC/winscard.h>
#include <PCSC/wintypes.h>
#include <PCSC/reader.h>
#endif
#endif

#if defined(__APPLE__)
#include "pcsclite.h"
#include "winscard.h"
#include "wintypes.h"
#endif

With all of the above changes, you should be able to compile oscam on macOS Monterey with a single command below:

make USE_PCSC=1 USE_LIBUSB=1

Change History (6)

comment:1 by ohmza, 3 months ago

Description: modified (diff)

Fix broken CYGWIN compilation due to previous fix.

Last edited 3 months ago by ohmza (previous) (diff)

in reply to:  1 comment:2 by ohmza, 3 months ago

In case of the compilation resulted in errors about libusb, pcsc-lite or openssl. Try to run

brew install libusb pcsc-lite openssl@1.1 first and then re-run make USE_PCSC=1 USE_LIBUSB=1 to compile the oscam again.

Last edited 3 months ago by ohmza (previous) (diff)

comment:3 by ohmza, 3 months ago

Description: modified (diff)

Fix broken smartreader due to previous fix.

Last edited 3 months ago by ohmza (previous) (diff)

comment:4 by ohmza, 3 months ago

Description: modified (diff)

Preliminary fix for openssl compilation error issues.

Last edited 3 months ago by ohmza (previous) (diff)

comment:5 by ohmza, 3 months ago

Description: modified (diff)

Incompleted fix for openssl compilation errors issues.

Last edited 3 months ago by ohmza (previous) (diff)

comment:6 by ohmza, 3 months ago

Description: modified (diff)

Completed fix for openssl compilation errors issues.

Last edited 3 months ago by ohmza (previous) (diff)
Note: See TracTickets for help on using tickets.