rockbruno / SwiftInfo

📊 Extract and analyze the evolution of an iOS app's code.
https://swiftrocks.com
MIT License
1.15k stars 58 forks source link

Fatal error `SourceKit` #69

Closed viniciusml closed 3 years ago

viniciusml commented 3 years ago

Hi, I've been trying to use the tool with Xcode 12.2, and I get the following error:

Exit status of command '../swiftinfo/bin/swiftinfo ' was 4 instead of 0.
Fatal error: 'try!' expression unexpectedly raised an error: SwiftInfoCore.DLError.dlopen("dlopen(/Applications/Xcode, 261): image not found"): file SwiftInfoCore/SourceKit.swift, line 53
Stack dump:
0.  Program arguments: /Applications/Xcode 12.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret ../Infofile.swift -enable-objc-interop -sdk /Applications/Xcode 12.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk -I /Users/viniciusmoreiraleal/Documents/Other/Pokedex/swiftinfo/bin/../include/swiftinfo -I /Users/viniciusmoreiraleal/Documents/Other/Pokedex/swiftinfo/bin/../include/swiftinfo/Csourcekitd/include -Xcc -fmodule-map-file=/Users/viniciusmoreiraleal/Documents/Other/Pokedex/swiftinfo/bin/../include/swiftinfo/Csourcekitd/include/module.modulemap -target-sdk-version 11.0 -module-name Infofile -lSwiftInfoCore -- -toolchain /Applications/Xcode 12.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/sourcekitd.framework/sourcekitd 
1.  Apple Swift version 5.3.1 (swiftlang-1200.0.41 clang-1200.0.32.8)
2.  While running user code "../Infofile.swift"
0  swift                    0x000000010abf9c15 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x000000010abfa332 SignalHandler(int) + 610
2  libsystem_platform.dylib 0x00007fff205e5d7d _sigtramp + 29
3  libsystem_c.dylib        0x00007fff88bdb4e0 __global_locale + 0
4  libswiftCore.dylib       0x00007fff2ca045f9 swift_unexpectedError + 585
5  libSwiftInfoCore.dylib   0x000000010fb521e1 $s13SwiftInfoCore9SourceKitC4pathACSS_tcfcTf4gn_n + 13281
6  libSwiftInfoCore.dylib   0x000000010fb55da6 $s13SwiftInfoCore0aB0V07projectB09fileUtils14slackFormatter6client9sourceKitAcA07ProjectB0V_AA04FileF0VAA05SlackH0VAA10HTTPClientCAA06SourceK0CSgtcfC + 630
7  libSwiftInfoCore.dylib   0x000000010ff90207 $s13SwiftInfoCore0aB0V07projectB09fileUtils14slackFormatter6client9sourceKitAcA07ProjectB0V_AA04FileF0VAA05SlackH0VAA10HTTPClientCAA06SourceK0CSgtcfC + 4433623
8  swift                    0x0000000106458605 llvm::orc::runAsMain(int (*)(int, char**), llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, llvm::Optional<llvm::StringRef>) + 1221
9  swift                    0x0000000106435ebb swift::RunImmediately(swift::CompilerInstance&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, swift::IRGenOptions const&, swift::SILOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >&&) + 6763
10 swift                    0x00000001064115ce performCompileStepsPostSILGen(swift::CompilerInstance&, swift::CompilerInvocation const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 2446
11 swift                    0x00000001064017ba swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 21802
12 swift                    0x00000001063822c1 main + 1265
13 libdyld.dylib            0x00007fff205bc621 start + 1
* SwiftInfo 2.3.12

Am I missing something? Thanks for the help 😊

rogerluan commented 3 years ago

From the log, looks like SwiftInfo is trying to open an app called Xcode.app (in Application folder), but your app is actually at /Applications/Xcode 12.2.app - could you check if that's the case?

viniciusml commented 3 years ago

Oh I missed that. Yes, when using /Applications/Xcode.app it runs successfully. Thank you!