hbang / Alderis

A fresh new color picker, with a gentle, fun, and dead simple user interface.

Home Page:https://hbang.github.io/Alderis/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot link libcolorpicker

X1nto opened this issue · comments

The linker cannot find Preferences.framework. I'm using the 16.5 patched SDK from theos, but the build always seems to default to the latest SDK (17.5 for me, which isn't patched) available on the system as xcodebuild is run with --sdk-root /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.5.sdk.

==> Linking library libcolorpicker (arm64)…
ld: warning: -multiply_defined is obsolete
ld: warning: search path '/Users/Xinto/uYouPlus/.theos/obj/install/Library/Frameworks' not found
ld: warning: search path '/Users/Xinto/uYouPlus/.theos/obj/install/var/jb/Library/Frameworks' not found
ld: framework 'Preferences' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[5]: *** [/Users/Xinto/theos/makefiles/instance/library.mk:52: /Users/Xinto/uYouPlus/.theos/obj/arm64/libcolorpicker.dylib] Error 1
make[4]: *** [/Users/Xinto/theos/makefiles/instance/library.mk:52: /Users/Xinto/uYouPlus/.theos/obj/arm64/libcolorpicker.dylib] Error 2
make[3]: *** [/Users/Xinto/theos/makefiles/instance/library.mk:37: internal-library-all_] Error 2
make[2]: *** [/Users/Xinto/theos/makefiles/master/rules.mk:146: libcolorpicker.all.library.variables] Error 2
make[1]: *** [/Users/Xinto/theos/makefiles/master/aggregate.mk:12: internal-all] Error 2
make: *** [/Users/Xinto/theos/makefiles/master/aggregate.mk:12: internal-all] Error 2

make clean outputs the following:

Build settings from command line:
    ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO
    ARCHS = arm64
    BUILD_LIBRARY_FOR_DISTRIBUTION = YES
    CODE_SIGNING_ALLOWED = NO
    DSTROOT = /Users/Xinto/uYouPlus/.theos/obj/debug/install_Alderis
    DYLIB_INSTALL_NAME_BASE = @rpath
    ENABLE_BITCODE = NO
    LD_DYLIB_INSTALL_NAME = @rpath/Alderis.framework/Alderis
    LOCAL_LIBRARY_DIR = /Library
    SDKROOT = iphoneos17.5
    STRIP_INSTALLED_PRODUCT = NO

I set the TARGET to iphone:clang:16.5:14.5, however, Alderis still uses 17.5.

export TARGET = iphone:clang:16.5:14.5

Sorry if this isn't related to Alderis or libcolorpicker, but I couldn't find references to other issues in the logs.

Fixed by adding

export SDK_PATH = $(THEOS)/sdks/iPhoneOS16.5.sdk/
export SYSROOT = $(SDK_PATH)

under export TARGET

Here's how the final export looks like:

export TARGET = iphone:clang:16.5:14.5
export SDK_PATH = $(THEOS)/sdks/iPhoneOS16.5.sdk/
export SYSROOT = $(SDK_PATH)
commented

As I see it, Xcode tries to use 16.5 to compile and 17.5 to link??? Very confusing, please correct me if I'm wrong.

Theos and Xcode use different build configs. You should have no issue building with latest SDK with the Xcode side of the project (assuming you don’t need to support iOS 12-13 arm64e). The Theos side needs a patched SDK with Preferences.framework defined. If you don’t use libcolorpicker compatibility or Preferences integration, then you can skip building lcpshim by commenting out the SUBPROJECTS = lcpshim line in Makefile.

The problem is that it grabs the unpatched 17.5 SDK, even though I've specified 16.5 in the TARGET export. I don't understand why it tries to compile with 17.5, but explicit SYSROOT and SDK_PATH solve the issue. I assume it's a bug in Theos. Thanks for suggesting the lcpshim part though, helps a lot.