Error during Muter installation
ArthurBrum opened this issue ยท 15 comments
Hi There,
I'm running into this problem everytime:
(...)
[15/17] Compiling ArgumentParser BashCompletionsGenerator.swift
[16/17] Compiling SwiftSyntax AbsolutePosition.swift
/Users/administrator/azuredevops_agent/_work/36/s/muter/.build/checkouts/swift-syntax/Sources/SwiftSyntax/RawSyntax.swift:120:46: error: value of type 'CSyntaxNode' (aka 'swiftparse_syntax_node_t') has no member 'range'
let textSize = hasCustomText ? Int(cnode.range.length) : 0
~~~~~ ^~~~~
/Users/administrator/azuredevops_agent/_work/36/s/muter/.build/checkouts/swift-syntax/Sources/SwiftSyntax/RawSyntax.swift:153:35: error: value of type 'CSyntaxNode' (aka 'swiftparse_syntax_node_t') has no member 'range'
let startOffset = Int(cnode.range.offset)
~~~~~ ^~~~~
/Users/administrator/azuredevops_agent/_work/36/s/muter/.build/checkouts/swift-syntax/Sources/SwiftSyntax/RawSyntax.swift:157:55: error: value of type 'CSyntaxNode' (aka 'swiftparse_syntax_node_t') has no member 'range'
let end = utf8.index(begin, offsetBy: Int(cnode.range.length))
~~~~~ ^~~~~
/Users/administrator/azuredevops_agent/_work/36/s/muter/.build/checkouts/swift-syntax/Sources/SwiftSyntax/RawSyntax.swift:873:32: error: value of type 'CSyntaxNode' (aka 'swiftparse_syntax_node_t') has no member 'range'
let byteLength = Int(cnode.range.length)
~~~~~ ^~~~~
/Users/administrator/azuredevops_agent/_work/36/s/muter/.build/checkouts/swift-syntax/Sources/SwiftSyntax/SyntaxParser.swift:195:57: error: missing argument for parameter #3 in call
let c_top = swiftparse_parse_string(c_parser, source)
^
, <#Int#>
_InternalSwiftSyntaxParser.swiftparse_parse_string:1:13: note: 'swiftparse_parse_string' declared here
public func swiftparse_parse_string(_: swiftparse_parser_t!, _ source: UnsafePointer<CChar>!, _ len: Int) -> swiftparse_client_node_t!
^
make: *** [build-release] Error 1
Funny that one month ago I had no problem with it and it still was v15... :(
I hope that someone could help me here.. I have no idea what to do
Obs1: This message is popping when I try to install it from either brew or git clone+make
Obs2: I'm using Self Hosted machines on azure to run this on pipelines
Obs3: I'm using Xcode version 13.2.1 (macOS 11.6)
Hi @ArthurBrum!
Could you please give it a try with Xcode 13.4?
I suspect that this error is a linking error with a wrong version of lib_InternalSwiftSyntaxParser.dylib
Hi there, sorry for taking this long to answer... I cannot use Xcode 13.4 because we haven't updated our machines to use Mac OS Monterey yet, and this is a requirement for Xcode 13.4
Do you happen to know any other solution @rakaramos ?
Gotacha!
In this case, I think the only solution is to change the SwiftSyntax
version on the package manifest.
We could probably adopt having semantic package versions in the future, to avoid those breaking changes.
I'm not a homebrew geek, but maybe it's possible to install a specific version of a formulae.
Ok, managed to make it work changing version of the swift-syntax in the Package.swift
dependencies: [
(...)
.package(name: "SwiftSyntax", url: "https://github.com/apple/swift-syntax.git", .revision("0.50500.0")),
OBS: I'm using Swift 5.5.2, if anyone else tries this, make sure to match swift syntax version looking here:
https://github.com/apple/swift-format/releases
And yeah, I'm no homebrew expert either, so the correct fix would be a little tricky :(
Yeah... it just succeeded the compilation.. now I'm facing runtime problems.. execution stops and xcode console says:
dyld: Library not loaded: @rpath/lib_InternalSwiftSyntaxParser.dylib
Referenced from: /Users/arthurbrum/Library/Developer/Xcode/DerivedData/muter-ebzuurlpkixrigcxpuymaerkyier/Build/Products/Debug/muter
Reason: image not found
(lldb)
...And trying to solve that I ran
swift package generate-xcodeproj
to generate the muter.xcodeproj and open it...
but then again I get compiling errors of Bundle.module(..)
not being found on file
muter/Sources/muterCore/TestReporting/HTML/Resources/BundleResource.swift
yeah... no luck for a while now :(
@ArthurBrum are you trying to run muter from Xcode or the Terminal?
Oh, sorry, forgot to mention:
When I opened this issue I was just trying to compile and install muter on remote machines (through terminal).
But then I decided to try debug muter, so I started trying to run from xcode on my local machine. So I ran into this same SwiftSyntax error, that's why I continued in the same thread here =/
Gotcha!
To debug muter on Xcode, you have to change the Package
so the dylib is linked:
Line 65 in c12ef7d
Nah, no luck.. same error... I believe there's something missing on the configs...
I also tried resetting the repository to main branch before doing what you recommended but now I'm facing a different error.. and xcode won't even let me clean it :(
(and trying to auto create schemes is not working either)
on a side note, open Xcode
via xed .
or by double clicking on the Package.swift
file, I'm not sure if it will work 100% if you try to generate the xcodeproj file
Okay, now its compiling and seems to run until it starts looking for the project files... :)
How can I setup muter to run the mutations over a project in another path? To debug it? On readme I found no option for that =/
(I know it's not related to this issue, but I intend to debug muter in more situations like #216 and probably try to fix this brew formulae problem too.. hope I can contribute then! ๐ )
What I do is to change the current path to the project that I want to debug.
You can do that in several places, but I think it's easier to do it in main.swift
import class muterCore.Muter
import Foundation
FileManager.default.changeCurrentDirectoryPath("/some/path")
Muter.start()