-
-
Notifications
You must be signed in to change notification settings - Fork 121
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
Cocoapods executable doesn't work on x86 machines #245
Comments
@dtaylor1701 Thank you for reporting this. Unfortunately, I no longer have an x86 machine available. I also didn't write the In the meantime, does going back to 4.8.1 work? The main changes were just to make BartyCrouch more configurable, but if it was working fine for you with the previous version, there's actually no reason to opt for 4.9.0. I also don't plan to make any new releases before next WWDC. |
I had the same issue on an Intel Mac after updating to 4.9.0. Going back to 4.8.0 solved it. |
I've put up an edit to the Makefile which should solve the issue. #246 |
Thank you @dtaylor1701, I'll have a look this weekend and upload a universal binary once merged. 👍 |
@dtaylor1701 @DaanVanHirtum @dtaylor1701 Thank you for the PR, unfortunately the script didn't work for me, I had to adjust some paths, see d0a60c7. But now running the script succeeds in a binary file that has double the size of the previous one, which makes sense given it's building for 2 different architectures, so looks good to me. Hope it works now. |
There still seems to be a problem on my x86 machine after updating to 4.9.0
|
@wassup- Ahh, how I hate that error. I'm also getting it during development which prevents me from using breakpoints while coding on this project. 😞 It used to work ... It's some kind of path problem, I think, but don't fully understand these things so I couldn't figure out a solution yet. If anyone has any tips on that, please help. The solution I'm currently aiming towards is a rewrite of BartyCrouch without any dependencies, such as swift-syntax or |
Unfortunately it's not working for the same reason @wassup- pointed out. To meet it looks like |
@dtaylor1701 Do you know a way to bundle |
Seeing as versions 4.12 & 4.13 try to address the linker issue, could you also release them on CocoaPods? Latest available there is 4.11. Hopefully we can start using newer versions (been stuck on 4.8 since this issue appeared). |
@djbe IIRC there was an issue with the CocoaPods script not working with the new linker logic. But the linker logic isn't working anyways, so I will make a new release soon where I can try again and report the details here if I run into any issues again. Having that said, I never planned to add CocoaPods support in the first place and it's more of a community thing. I'm happy to do a few steps more during release, but if things don't work, I neither have the time nor the knowledge to fix things myself for CocoaPods users. So, feel free to run the |
No worries, I'll see if those work, and post my findings here Update: can confirm that the current .13 release is broken, still complains about
|
Hey everyone, I just made a new release Please also report if the newly released build |
Confirmed that the lib_InternalSwiftSyntaxParser issue is still present on 4.14.1, after additional Idea: Remove the internal static library dependency / linking logic by migrating from SwiftSyntaxParser => SwiftParser (see: 4ac0804a1, 318de5cf28a) Rationale:
Caveat: Not sure about migration complexity, or any side-effects that it will cause for other installation methods (e.g. SPM, Homebrew) Similar change in SwiftLint: realm/SwiftLint#4216 |
Yeah can confirm that it's not working yet, just tried it. Had a look through the SwiftLint PR, the code changes seem very minimal (if you ignore some other unrelated changes in that PR). Sourcery also switched to it a few months ago (PR). Regarding installation methods, for SPM there should be no change, as long as your package.swift works. Homebrew should just create a release build via SPM. Or via your makefile 🤷 For SwiftGen, our brewfile invokes our rake build, which in turn just calls swift build --disable-sandbox -c release. Non brew builds trigger a universal build with |
@djbe I just followed this NSHipster article until things worked: https://nshipster.com/homebrew/ I'm not an expert on Makefile at all, so if you want to introduce a different form of shipping this tool via Homebrew, feel free to suggest one. As long as I can understand it (I have some experience with Rails, so I should be able to read Ruby code) and it's as easy as it's today for me to make a release (see end of README), I'm willing to merge any changes to the build pipeline if it helps some users in the community. Having that said, the Makefile is already using SwiftPM, the exact call for CocoaPods is (the one for Brew is here): swift build \
-c release \
--arch arm64 --arch x86_64 \
--disable-sandbox \
--scratch-path "$(BUILDDIR)" How exactly is the latest CocoaPods version failing? Is it an issue with the SwiftSyntax dylib? Last thing I tried was to ship the dylib alongside the ZIP file by adding this copy line. But there may be a better way to do it. For Homebrew, copying the dylib to |
Thanks for the info @Jeehut, that definitely helps!
Yes, it appears that the Pod will be unable to find the embedded dylib, which by default is located in Here's a more thorough error describing the issue via Xcode, upon building an app target which depends on BartyCrouch
Potential Workaround: Update the location of the dylib to one of the search paths used by BartyCrouch (i.e.
post_install do |installer|
installer.pod_targets.each do |pod_target|
if pod_target.name == "BartyCrouch" then
library_source_directory = pod_target.pod_target_srcroot.sub('${PODS_ROOT}', "#{installer.sandbox.root}")
library_dest_directory = "#{library_source_directory}/../lib"
syntax_parser_library = "lib_InternalSwiftSyntaxParser.dylib"
system("mkdir -p #{library_dest_directory}; mv #{library_source_directory}/#{syntax_parser_library} #{library_dest_directory}/#{syntax_parser_library}")
end
end
end Additional Notes:
|
As @Hilehele mentioned, it's looking for the dylib one level too high: in the
We should add install_name_tool -add_rpath @executable_path/. Pods/BartyCrouch/bartycrouch Until BartyCrouch switches to portable_zip: bartycrouch_universal
rm -f "$(BUILDDIR)/Apple/Products/Release/portable_bartycrouch.zip"
$(eval TMP := $(shell mktemp -d))
cp "$(BUILDDIR)/Apple/Products/Release/bartycrouch" "$(TMP)/bartycrouch"
@install_name_tool -add_rpath "@executable_path/." "$(TMP)/bartycrouch"
zip -j "$(BUILDDIR)/Apple/Products/Release/portable_bartycrouch.zip" \
"$(TMP)/bartycrouch" \
"$(REPODIR)/LICENSE" \
".build/artifacts/swift-syntax/_InternalSwiftSyntaxParser.xcframework/macos-arm64_x86_64/lib_InternalSwiftSyntaxParser.dylib"
echo "Portable ZIP created at: $(BUILDDIR)/Apple/Products/Release/portable_bartycrouch.zip"
rm -rf $(TMP) Note: I'm a noob at makefiles. If there's a better way to temporarily create a folder and tweak the binary, go ahead. |
@djbe Thank you very much for the fix! |
Expected Behavior
Running the executable distributed via cocoopods in a build phase works as expected.
Example:
${PODS_ROOT}/BartyCrouch/bartycrouch lint -x --fail-on-warnings
Actual Behavior
An error is returned:
bartycrouch: Bad CPU type in executable
Steps to Reproduce the Problem
Pods/BartyCrouch/bartycrouch
Specifications
The text was updated successfully, but these errors were encountered: