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

[helpwanted] Compile Errors of libcephei #58

Open
Liam0205 opened this issue May 12, 2023 · 9 comments
Open

[helpwanted] Compile Errors of libcephei #58

Liam0205 opened this issue May 12, 2023 · 9 comments

Comments

@Liam0205
Copy link

Hi @kirb ,

I'm a tweak developer, and now I want to derootify my previous tweaks that are depending on libcephei. I've noticed that libcephei is now with rootless support (but under testing...), thus the compilling.

Installed lates patched sdks, make gives the following error report. Would you please have a look and any clues to fix this would be appreciated.

MastodonAPIClient.swift:85:3: error: cannot find 'Task' in scope
                Task.detached {
                ^~~~
MastodonAPIClient.swift:134:5: error: cannot find 'Task' in scope
                                Task.detached(priority: .background) {
                                ^~~~
MastodonAPIClient.swift:166:3: error: cannot find 'Task' in scope
                Task.detached(priority: .userInitiated) {
                ^~~~
MastodonAPIClient.swift:202:12: error: cannot find 'MainActor' in scope
                                        await MainActor.run { [finalImage] in
                                              ^~~~~~~~~
MastodonAPIClient.swift:238:24: error: type of expression is ambiguous without more context
                        let (data, _) = try await URLSession.shared.data(for: request(with: url, acceptingContentType: "application/json"))
                                        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MastodonAPIClient.swift:255:24: error: type of expression is ambiguous without more context
                        let (data, _) = try await URLSession.shared.data(for: request(with: url, acceptingContentType: "application/activity+json"))
                                        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MastodonAPIClient.swift:273:31: error: type of expression is ambiguous without more context
                        if let imageURL = userInfo.imageURL {
                                          ~~~~~~~~~^~~~~~~~
MastodonAPIClient.swift:292:24: error: type of expression is ambiguous without more context
                        let (data, _) = try await URLSession.shared.data(for: request(with: url))
                                        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@kirb
Copy link
Member

kirb commented May 12, 2023

You need a newer version of the Swift toolchain - the one you’re using doesn’t support async/await and Task. It was introduced in Swift 5.5.

@Liam0205
Copy link
Author

@kirb Thanks for your reply.

I ran xcrun swift --version, and it gives

swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
Target: x86_64-apple-macosx12.0

It seems that, I already have Swift 5.7.2 with XCode (14.2).

Is it possible that despite having Xcode 14.2 installed on my Mac with Swift version 5.7.2, the correct version was not used when building libcephei?

How can I troubleshoot this issue?

@kirb
Copy link
Member

kirb commented May 27, 2023

Which SDK are you using? It’ll also need to be iOS 15 or newer. I’m using Xcode 14.2/Swift 5.7.2 and iOS 16.2 SDK.

@Liam0205
Copy link
Author

Which SDK are you using? It’ll also need to be iOS 15 or newer. I’m using Xcode 14.2/Swift 5.7.2 and iOS 16.2 SDK.

Well, nevermind.

iPhoneOS16.0b4.sdk is used, and this CE is gone. Now, it comes:

cp: /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64/generated/Cephei-Swift.h: No such file or directory

This could be fixed by #58. And after the fix, it comes:

cp: /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64/Cephei.swiftdoc: No such file or directory
cp: /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64/Cephei.swiftmodule: No such file or directory
cp: /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64/Cephei.abi.json: No such file or directory
cp: /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64e/Cephei.swiftdoc: No such file or directory
cp: /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64e/Cephei.swiftmodule: No such file or directory
cp: /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64e/Cephei.abi.json: No such file or directory

It seems that recent modifications have been made to the Makefile and the directory structure of the project, resulting in these issues. It might be more appropriate for me to compile and test the project again once you have resolved them.

@kirb
Copy link
Member

kirb commented May 27, 2023

Are you using the Theos orion branch? Those files aren’t emitted on the master branch currently.

@Liam0205
Copy link
Author

Yes, I'm compiling libcephei with the main branch, and orion branch of THEOS is used:

$ /Users/Liam/opt/theos/bin/update-theos 
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 10 (delta 8), reused 10 (delta 8), pack-reused 0
Unpacking objects: 100% (10/10), 894 bytes | 44.00 KiB/s, done.
From https://github.com/theos/theos
   6821e50..9b103c1  orion      -> origin/orion
Already up to date.

@Liam0205
Copy link
Author

Sorry, I'm actually on master of THEOS.

Liam@❤️  [15:26:46]:~/opt/theos
$ pwd
/Users/Liam/opt/theos
Liam@❤️  [15:26:47]:~/opt/theos
$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
Liam@❤️  [15:26:50]:~/opt/theos
$ git log -1
commit a12c440f566afad7e0f1578b2414fd5c8ab899e5 (HEAD -> master, origin/master, origin/HEAD)
Author: theosbot <[email protected]>
Date:   Sun Apr 30 11:26:09 2023 +0000

    [submodules] Update submodules to the latest commit

@Liam0205
Copy link
Author

Liam0205 commented May 27, 2023

Now, when I switched THEOS to the orion branch and ran gmake clean; gmake SYSROOT=$THEOS/sdks/iPhoneOS15.5.sdk, the error has changed:

ListController+Actions.swift:4:8: error: no such module 'MobileIcons'
import MobileIcons
       ^

ListController+Actions.swift:4:8: error: no such module 'MobileIcons'
import MobileIcons
       ^

gmake[5]: *** [/Users/Liam/opt/theos/makefiles/instance/rules.mk:344: internal-swift-CepheiPrefs-arm64] Error 1
gmake[5]: *** [/Users/Liam/opt/theos/makefiles/instance/rules.mk:344: internal-swift-CepheiPrefs-arm64e] Error 1
gmake[4]: *** [/Users/Liam/opt/theos/makefiles/instance/rules.mk:353: /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64/.swift-stamp] Error 2
gmake[4]: *** [/Users/Liam/opt/theos/makefiles/instance/rules.mk:353: /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64e/.swift-stamp] Error 2
rm /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64/Tint.x.mrm /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64e/Localization.x.m /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64e/UINavigationItem+HBTintAdditions.x.m /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64/Localization.x.m /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64e/Tint.x.m /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64e/Slider.x.m /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64/UINavigationItem+HBTintAdditions.x.m /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64e/PSListController+HBTintAdditions.x.m
 /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64/PSListController+HBTintAdditions.x.m /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64/Slider.x.m
gmake[3]: *** [/Users/Liam/opt/theos/makefiles/instance/framework.mk:36: /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64e/CepheiPrefs.framework/CepheiPrefs] Error 2
gmake[3]: *** Waiting for unfinished jobs....
gmake[3]: *** [/Users/Liam/opt/theos/makefiles/instance/framework.mk:36: /Users/Liam/iOSdev/libcephei/.theos/obj/debug/arm64/CepheiPrefs.framework/CepheiPrefs] Error 2
gmake[2]: *** [/Users/Liam/opt/theos/makefiles/instance/framework.mk:27: internal-framework-all_] Error 2
gmake[1]: *** [/Users/Liam/opt/theos/makefiles/master/rules.mk:152: CepheiPrefs.all.framework.variables] Error 2
gmake: *** [/Users/Liam/opt/theos/makefiles/master/aggregate.mk:12: internal-all] Error 2

This is strange because the MobileIcons is actually present in $THEOS/sdks/iPhoneOS15.5.sdk:

Liam@❤️  [15:45:40]:~/opt/theos/sdks/iPhoneOS15.5.sdk
$ find . | grep MobileIcons
./System/Library/PrivateFrameworks/MobileIcons.framework
./System/Library/PrivateFrameworks/MobileIcons.framework/MobileIcons.tbd

@kirb
Copy link
Member

kirb commented May 28, 2023

I’ll need to push the header changes I made shortly, although the changes are pretty minimal:

Preferences/PSTableCell.h:

-- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier specifier:(PSSpecifier *)specifier;
+- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier specifier:(PSSpecifier *)specifier NS_DESIGNATED_INITIALIZER;

MobileCoreServices/MobileCoreServices.h:

#import <MobileCoreServices/LSAppLink.h>
#import <MobileCoreServices/LSApplicationProxy.h>
#import <MobileCoreServices/LSApplicationWorkspace.h>
#import <MobileCoreServices/LSBundleProxy.h>
#import <MobileCoreServices/LSDocumentProxy.h>
#import <MobileCoreServices/LSOpenOperation.h>
#import <MobileCoreServices/LSPlugInKitProxy.h>
#import <MobileCoreServices/LSResourceProxy.h>
#import <MobileCoreServices/MobileCoreServices.h>
#import <MobileCoreServices/NSString+LSAdditions.h>
#import <MobileCoreServices/NSURL+LSAdditions.h>
#import <MobileCoreServices/_LSQueryResult.h>

MobileCoreServices/module.modulemap:

module MobileCoreServices {
	umbrella header "MobileCoreServices.h"

	link framework "MobileCoreServices"

	export *
	module * { export * }
}

MobileIcons/module.modulemap:

module MobileIcons {
	umbrella header "MobileIcons.h"

	link framework "MobileIcons"

	export *
	module * { export * }
}

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