session-foundation / session-ios

A private messenger for iOS.
https://getsession.org
GNU General Public License v3.0
3 stars 1 forks source link

Unable to build and run Session 2.6.0 #17

Open Dodo0303 opened 6 months ago

Dodo0303 commented 6 months ago

I am currently on an Intel MacOS using Xcode 15.4 and the latest iOS SDK. For earlier releases I had always been able to build and test the app with no problems. Now, I am getting two different problems, depending on where I try to build it. If I build on any simulator, I get this: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This method shouldn't be run on the logging thread/queue that make flush fast enough' *** First throw call stack: ( 0 CoreFoundation 0x00007ff8004cd531 __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007ff8000837e8 objc_exception_throw + 48 2 Foundation 0x00007ff800dba624 _userInfoForFileAndLine + 0 3 CocoaLumberjack 0x000000011201f22e -[DDLog flushLog] + 174 4 CocoaLumberjack 0x000000011201f16f +[DDLog flushLog] + 79 5 SignalCoreKit 0x0000000112b52586 +[OWSLogger flush] + 54 6 SignalCoreKit 0x0000000112b5c380 $s13SignalCoreKit6LoggerC5flushyyFZ + 64 7 SignalCoreKit 0x0000000112b60532 $s13SignalCoreKit12owsFailDebug_4file8function4lineySS_S2SSitF + 274 8 SignalCoreKit 0x0000000112b60a4a $s13SignalCoreKit14owsAssertDebug__4file8function4lineySb_SSyXKS2SSitF + 490 9 SessionUtilitiesKit 0x000000011758e5d3 $s19SessionUtilitiesKit20OWSCurrentAppContextC26appSharedDataDirectoryPathSSvgZ + 963 10 SessionUtilitiesKit 0x000000011758e1e4 $s19SessionUtilitiesKit20OWSCurrentAppContextC26appSharedDataDirectoryPathSSvgZTo + 36 11 SessionUtilitiesKit 0x0000000117563a96 +[OWSFileSystem appSharedDataDirectoryPath] + 54 12 Session 0x000000010fd8ae2a $s7Session14AppEnvironmentC13setupLogFiles33_CFC2D9B747C972AA8C90D2DE57EBA639LLyyFyyYbcfU_yyYbcfU_ + 282 13 Session 0x000000010fcb2198 $sIegh_IeyBh_TR + 40 14 libdispatch.dylib 0x000000011253729d _dispatch_call_block_and_release + 12 15 libdispatch.dylib 0x000000011253858f _dispatch_client_callout + 8 16 libdispatch.dylib 0x00000001125404ba _dispatch_lane_serial_drain + 1127 17 libdispatch.dylib 0x0000000112541255 _dispatch_lane_invoke + 441 18 libdispatch.dylib 0x000000011254e356 _dispatch_root_queue_drain_deferred_wlh + 318 19 libdispatch.dylib 0x000000011254d751 _dispatch_workloop_worker_thread + 590 20 libsystem_pthread.dylib 0x0000000112097b84 _pthread_wqthread + 327 21 libsystem_pthread.dylib 0x0000000112096acf start_wqthread + 15 ) libc++abi: terminating due to uncaught exception of type NSException

If I build instead on my physical iPhone, I get these errors.

Screenshot 2024-05-25 at 17 11 14

Here is what I changed in order to build the app (NOTE: I don't have an apple developer program subscription, but again, this has never caused me any problems in the past):

mpretty-cyro commented 5 months ago

@Dodo0303 so it looks like the debug build is failing because it can't find the AppGroup folder in order to create the database, one thing to double check is whether you have updated the applicationGroup variable that is hard-coded in the app here: https://github.com/oxen-io/session-ios/blob/master/SessionUtilitiesKit/General/SNUserDefaults.swift#L65

public extension UserDefaults {
    static let applicationGroup: String = "group.com.loki-project.loki-messenger"
}

At some point I want to tweak the build process to try and automatically extract the value so we don't need to manually ensure they match but I haven't been able to find the time to get to it

As for the release build - it looks like something is going wrong when building the libSession dependency, this one is a bit more of a pain to debug because extracting the errors which occur doesn't always work (this is what has happened in your case)

If you look the actual build logs for the failed build, under the Build target SessionUtil section it outputs a path to the CMake build output file which will include the full build logs (and errors) for building libSession - if you look at or share this log file it'll help with debugging the build issue further

build_error
Dodo0303 commented 5 months ago

@mpretty-cyro thanks for helping! The app group variable indeed didn't match. For the release build, it wouldn't print out the location of the logs for some reason. All I can share is this:

image
mpretty-cyro commented 5 months ago

Hey @Dodo0303, I made a couple of changes in oxen-io/session-ios#976 (write the AppGroupId to the info.plist while building and read it during runtime, and update some build settings) which might make your build process a little better - can you please let me know if you are still experiencing the build issue after you update?

If these changes don't help then it'll probably have to wait a bit until I have the chance to spend some time trying to improve the build process (I'd like to try to move things into Swift Package Manager but just need to find the time)