I have the following shell-script:

xcodebuild -IDEBuildOperationMaxNumberOfConcurrentCompileTasks=`sysctl -n hw.ncpu` \
            BUILD_DIR=../../Libraries/usr/lib \
            CONFIGURATION_BUILD_DIR=../../Libraries/usr/lib \
            -project ./libusb/Xcode/libusb.xcodeproj \
            -target "libusb" \
            -configuration Release \
            -xcconfig "./libusb_osx_config.xcconfig"

to compile LibUSB for MacOS via command line with certain flags enabled in my .xcconfig:

#include "./libusb/Xcode/libusb.xcconfig"
ARCHS = $(ARCHS_STANDARD)
SDKROOT = macosx
SUPPORTED_PLATFORMS = macosx
VALID_ARCHS = i386 x86_64
MACOSX_DEPLOYMENT_TARGET = 10.14
SKIP_INSTALL = YES
INSTALL_PATH = "./libusb/build"
CODE_SIGNING_ALLOWED = NO
OTHER_LDFLAGS = -framework IOKit
LD_DYLIB_INSTALL_NAME = @rpath/libusb-1.0.0.dylib
PRODUCT_NAME = libusb-1.0.0

In the ./Libraries/usr/lib I have a modified version of IOKit.framework for iOS (not MacOS)!

However, if I run the script above with that exact config, it tells me:

ld: symbol(s) not found for architecture x86_64

for the IOKit because it's trying to link against my modified iOS (ARM) framework instead of the MacOS system framework.. If I removed CONFIGURATION_BUILD_DIR it links against the system framework instead of my custom one.

Is there a way to get it to always link against the system framework even if CONFIGURATION_BUILD_DIR is specified? I am only using CONFIGURATION_BUILD_DIR so it will place the libusb-1.0.0.dylib in that local ./Libraries/usr/lib folder. Without it, it places it in a Release folder.

Any ideas?

0 Answers