Subito-it / PodBuilder

A tool to precompile CocoaPods pods
Other
284 stars 28 forks source link

Debugging while using prebuilt frameworks. #12

Closed tareksabry1337 closed 4 years ago

tareksabry1337 commented 4 years ago

I'm having an issue after integrating pod_builder into my project that I can no longer debug my code it throws Couldn't IRGen expression, no additional error when I try to do "po someVariable" on the console

I also tried the sample project but no avail it's the same.

Am I doing something wrong ? Or is this supposed to be run on CI environments only ?

tcamin commented 4 years ago

Which version of PodBuilder are you using?

tareksabry1337 commented 4 years ago

The latest 1.9.4

tcamin commented 4 years ago

Are you able to reproduce this on a minimal example project that can be shared?

tareksabry1337 commented 4 years ago

Yes, I cloned the Example project and ran pod_builder init then ran pod_builder build_all and I ran the project, set breakpoint on AppDelegate then tried to do "po application" I got the same error

Screen Shot 2020-09-03 at 9 56 25 AM

Attached screenshot.

I'm running Xcode 11.5, Cocoapods 1.9.3

tcamin commented 4 years ago

Could you try with the latest beta? gem install pod-builder --pre

tareksabry1337 commented 4 years ago

The beta version does not init on the sample project and throws xcworkspace not found! even though I'm at the project folder where .xcworkspace file exists.

Screen Shot 2020-09-03 at 10 02 59 AM
tcamin commented 4 years ago

I made a few changes, tried on beta 23 and it seemed to work ok.

tareksabry1337 commented 4 years ago

Unfortunately I am still unable to init it on the example project using the beta version (updated to beta 23)

Screen Shot 2020-09-03 at 12 40 57 PM
tcamin commented 4 years ago

Forgot to mention that you need to checkout the deterministic_build branch. BTW the Example project is already inited so you just need to run pod_builder build_all.

tareksabry1337 commented 4 years ago

After checking out deterministic_build and running pod_builder build_all the result is as below.

Screen Shot 2020-09-03 at 1 17 04 PM
tcamin commented 4 years ago

Bear with me one more time 😂. Pull and try again

tareksabry1337 commented 4 years ago

The command was taking unusually long time, I though it was because of all the pods installed. I remove all of them and installed only Alamofire to test faster but it has been a while and it's stuck on "Downloading Pods source code"

Screen Shot 2020-09-03 at 1 39 05 PM

I'm leaving it until it's done nonetheless.

tcamin commented 4 years ago

Did you remove the entries from the PodBuilder/Podfile?

tareksabry1337 commented 4 years ago

Nope, I didn't. Now I did and it's done. Will report back once it's done.

tareksabry1337 commented 4 years ago

Everything is working as expected, except that I'm still having the same exact error.

Screen Shot 2020-09-03 at 1 45 35 PM
tcamin commented 4 years ago

That's the main Podfile, the other one is autogenerated and should be generally not be modified manually (as changes will be overwritten)

tcamin commented 4 years ago

That is kind of weird because it is working fine on my side and I have your same setup: Xcode 11.5 and CP 1.9.3.

Try the following

  1. delete derived data and run again
  2. delete the PodBuilder/dSYM folder, delete derived data and run again.
tareksabry1337 commented 4 years ago

Wow, can't believe that actually deleting derived data worked lol. Thanks for all of your hard work on this.

Just one last question, is the newest beta intended to fix Firebase installation issues from https://github.com/Subito-it/PodBuilder/issues/8 ?

tcamin commented 4 years ago

🎉🎉🎉

The OP seems not to have solved the issue however we are using the beta on a very large project that uses Firebase and it works on our side.

The example project integrates firebase as in #8. It compiles fine here but it will take a significant amount of time (depends on the hardware) because it is building the framework with several slices (that's the benefit of PB: build once for all archs).

If you try it and run into troubles reply to that issue or open a new one.

Closing this one for the moment, thanks for the feedback so far.

tareksabry1337 commented 4 years ago

@tcamin I have a quick question regarding this issue, so it turns out that deleting derived data isn't the issue but the dSYM folder under PodBuilder folder is actually what resolves that, so my question is how does this affect my project when I delete the dSYM folder ?

tcamin commented 4 years ago

It is strange because on my side it is working fine even with dSYM folder. Nonetheless I sugggested to delete the folder because I read about the issue here: https://steipete.com/posts/couldnt-irgen-expression

dSYM bundles contain debug information that is used to symbolicate your application's frames, that is translating binary memory addresses back to your source come classes and methods. You should send these files to e.g to Firebase so that your crash report get properly symbolicated. They are also used for example when running Instruments.

You do not need dSYM to run/debug your project but you can't get rid of them because they are essential to get proper information out of crashes.

tcamin commented 4 years ago

We don't have the Couldn't IRGen expression, no additional error issue so I would suggest to investigate if it somehow related to something in your setup.

tareksabry1337 commented 4 years ago

I'm certainly convinced it's something on my setup, but I've no idea what's wrong I'm coming from a neighbor plugin cocoapods-binary I had the exact same issue there but I thought because that plugin is outdated and is no longer maintained but boy oh boy I was wrong. I'll try to do a fresh installation of macOS / Xcode maybe I messed something up.

tcamin commented 4 years ago

Does this happen both on device and simulator?

tareksabry1337 commented 4 years ago

Yep, just tried both and I'm getting the same error. What's even more interesting that I have a mac mini that has the exact same environment Xcode 11.5, Cocoapods 1.9.3 and it has the same exact issue.

At this point I'm not really sure what's causing it.

tcamin commented 4 years ago

What if you exclude the entire project folder from Spotlight?

tareksabry1337 commented 4 years ago

What do you mean by excluding a project from Spotlight ? I'm not really aware.

tcamin commented 4 years ago

Remove the project folder from Spotilight indexing

Screenshot 2020-09-03 at 15 36 45
tcamin commented 4 years ago

Alternatively and more interestingly you could modify the PodBuilder.json file by adding the build_settings_overrides key as follows

"build_settings_overrides": {
    "OTHER_SWIFT_FLAGS": "$(inherited) -Xfrontend -no-serialize-debugging-options"
}

I didn't try myself. If you try let me know.

tareksabry1337 commented 4 years ago

What kind of black magic is this ? Excluding the folder from Spotlight works even with dSYM files ! Can you explain how does excluding folder from spotlight help ?

tcamin commented 4 years ago

Because lldb uses spotlight to find dSYMs which are causing the issue. Good it works but it probably won't symbolicate instrument sessions. I would suggest to try the -no-serialize-debugging-options alternative which if it works should be more solid.

tareksabry1337 commented 4 years ago

No avail from "OTHER_SWIFT_FLAGS": "$(inherited) -Xfrontend -no-serialize-debugging-options" I guess I'll have to live with Spotlight off and enable it when needed 😂

tcamin commented 4 years ago

I managed to reproduce it.

Apparently adding an Objective-C file to the project (together with the bridging headers) seems to workaround the issue. I updated the sample project accordingly and was able to print variables.

tareksabry1337 commented 4 years ago

Yep it works, even though it's "hacky" but this is better than both Spotlight indexing, slow build times combined.

Screen Shot 2020-09-03 at 4 31 01 PM
tareksabry1337 commented 4 years ago

I'm curious what are the side effects of doing this ?

tcamin commented 4 years ago

Not that I'm aware of.