{"action":"created","issue":{"url":"https://api.github.com/repos/Carthage/Carthage/issues/924","labels_url":"https://api.github.com/repos/Carthage/Carthage/issues/924/labels{/name}","comments_url":"https://api.github.com/repos/Carthage/Carthage/issues/924/comments","events_url":"https://api.github.com/repos/Carthage/Carthage/issues/924/events","html_url":"https://github.com/Carthage/Carthage/issues/924","id":117188505,"number":924,"title":"Correct framework DWARFs and symbols to workaround broken debugging 🔥","user":{"login":"NachoSoto","id":685609,"avatar_url":"https://avatars.githubusercontent.com/u/685609?v=3","gravatar_id":"","url":"https://api.github.com/users/NachoSoto","html_url":"https://github.com/NachoSoto","followers_url":"https://api.github.com/users/NachoSoto/followers","following_url":"https://api.github.com/users/NachoSoto/following{/other_user}","gists_url":"https://api.github.com/users/NachoSoto/gists{/gist_id}","starred_url":"https://api.github.com/users/NachoSoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NachoSoto/subscriptions","organizations_url":"https://api.github.com/users/NachoSoto/orgs","repos_url":"https://api.github.com/users/NachoSoto/repos","events_url":"https://api.github.com/users/NachoSoto/events{/privacy}","received_events_url":"https://api.github.com/users/NachoSoto/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Carthage/Carthage/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/Carthage/Carthage/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Carthage/Carthage/milestones/11","html_url":"https://github.com/Carthage/Carthage/milestones/1.0:%20Carthaginian%20Peace","labels_url":"https://api.github.com/repos/Carthage/Carthage/milestones/11/labels","id":979859,"number":11,"title":"1.0: Carthaginian Peace","description":"Stability for the CarthageKit API, the on-disk directory structure, `Cartfile` syntax, and command-line flags.","creator":{"login":"jspahrsummers","id":432536,"avatar_url":"https://avatars.githubusercontent.com/u/432536?v=3","gravatar_id":"","url":"https://api.github.com/users/jspahrsummers","html_url":"https://github.com/jspahrsummers","followers_url":"https://api.github.com/users/jspahrsummers/followers","following_url":"https://api.github.com/users/jspahrsummers/following{/other_user}","gists_url":"https://api.github.com/users/jspahrsummers/gists{/gist_id}","starred_url":"https://api.github.com/users/jspahrsummers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jspahrsummers/subscriptions","organizations_url":"https://api.github.com/users/jspahrsummers/orgs","repos_url":"https://api.github.com/users/jspahrsummers/repos","events_url":"https://api.github.com/users/jspahrsummers/events{/privacy}","received_events_url":"https://api.github.com/users/jspahrsummers/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":6,"state":"open","created_at":"2015-02-15T05:13:09Z","updated_at":"2016-01-07T22:57:11Z","due_on":null,"closed_at":null},"comments":32,"created_at":"2015-11-16T18:26:43Z","updated_at":"2016-01-28T20:40:04Z","closed_at":null,"body":"*This is a follow up to #832 with details on a possible solution.*\r\n\r\n## The story:\r\n\r\nWe've all been aware since the very beginning that debugging projects that include pre-compiled (Carthage) frameworks has been very broken. As Apple *promised* that this got better in Xcode 7.2, a few people on #832 did the test (I still can't test it myself [because reasons](http://www.openradar.me/22993940)), and realized that it's still just as broken.\r\n\r\nUpon further investigation, looks like [DWARF files use absolute paths everywhere](https://twitter.com/nachosoto/status/666309518775599104), based on when they were compiled. \r\n\r\nUsing `dwarfdump`:\r\n<img width=\"867\" alt=\"screen shot 2015-11-16 at 09 37 05\" src=\"https://cloud.githubusercontent.com/assets/685609/11190412/293eb692-8c4a-11e5-8d41-ec7dba10df1d.png\">\r\n<img width=\"1028\" alt=\"screen shot 2015-11-16 at 09 43 53\" src=\"https://cloud.githubusercontent.com/assets/685609/11190309/a61b9a00-8c49-11e5-89fd-dc2936c852f7.png\">\r\n\r\nAs you can see, they're full of paths to **the derived data directory of the user who built the framework**.\r\nNeedless to say, it's not just a problem because we can't share these frameworks with other devs, but also for personal use, **given how extremely frequent one must clear derived data to work around Xcode**.\r\n\r\n![what year is it](https://cloud.githubusercontent.com/assets/685609/11190448/59bf4002-8c4a-11e5-9c02-6ae9942d23b0.jpg)\r\n\r\nThis is why I finally decided to file a radar, because after **two years** this is still utterly broken: http://www.openradar.me/23551273.\r\n\r\nOf course, I don't expect this to be fixed (ever?), so we need a solution.\r\n\r\n## Proposed solutions\r\n\r\n#### Abandon `Carthage`:\r\n\r\nWe can go back to working like animals, adding all dependencies as submodules. However, **this just doesn't cut it, Apple**, when will you see this?\r\n- Swift compilation times **are already insanely long**. *Khan Academy* was taking 15 minutes for a clean build before I changed `Swift` dependencies to pre-compiled frameworks.\r\n- Nested dependencies: this solution would not be feasible if you have multiple dependencies that depend on a common one. This is one of the reasons why `CocoaPods` was born:\r\n\r\n#### `CocoaPods`\r\n*(Yeah, I went there, but I wanted to analyze this too)*\r\n\r\n- Obviously deals with the dependency graph problem.\r\n- It's *invasive* and very complex, which is why Carthage was born.\r\n- It's still not what we want for development. It's the year 2015, we want to be able to distribute built dependencies and compile our applications in the order of seconds, **not minutes**.\r\n\r\n#### Work around it in `Carthage`\r\n\r\nI have an idea that might work. Distributing pre-compiled frameworks would still be broken (so `--no-use-binaries` would have to be the only option), but we'd be able to **compile once and forget**:\r\n```bash\r\nxcodebuild -sdk $SDK -project $PROJECT -configuration Release -scheme $SCHEME ONLY_ACTIVE_ARCH=NO SYMROOT=$DIR/Carthage/Build/$PLATFORM/$FRAMEWORK clean build\r\n```\r\n\r\nNotice the `SYMROOT` parameter. In my tests compiling with this option correctly **sets *the absolute paths* in the `DWARF` to that path, instead of derived data**! Which means that debugging should hopefully work.\r\n\r\nWith this, the recommended approach would be to `.gitignore` `Carthage/Build`, and using `carthage update` to build the frameworks.\r\n\r\nOnce we do that, one can freely clear derived data, and that won't affect the compiled frameworks.\r\n\r\nIt's still not clear that this is enough, though. It's possible that we'll also need `OBJROOT`, **and putting everything** in `Carthage/Build`:\r\n<img width=\"461\" alt=\"screen shot 2015-11-16 at 10 25 37\" src=\"https://cloud.githubusercontent.com/assets/685609/11190782/6aa2c040-8c4c-11e5-8cba-86c1a8172871.png\">\r\n\r\n------------------------\r\n*Prolonged sigh*."},"comment":{"url":"https://api.github.com/repos/Carthage/Carthage/issues/comments/176403865","html_url":"https://github.com/Carthage/Carthage/issues/924#issuecomment-176403865","issue_url":"https://api.github.com/repos/Carthage/Carthage/issues/924","id":176403865,"user":{"login":"mathiasnagler","id":9951231,"avatar_url":"https://avatars.githubusercontent.com/u/9951231?v=3","gravatar_id":"","url":"https://api.github.com/users/mathiasnagler","html_url":"https://github.com/mathiasnagler","followers_url":"https://api.github.com/users/mathiasnagler/followers","following_url":"https://api.github.com/users/mathiasnagler/following{/other_user}","gists_url":"https://api.github.com/users/mathiasnagler/gists{/gist_id}","starred_url":"https://api.github.com/users/mathiasnagler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathiasnagler/subscriptions","organizations_url":"https://api.github.com/users/mathiasnagler/orgs","repos_url":"https://api.github.com/users/mathiasnagler/repos","events_url":"https://api.github.com/users/mathiasnagler/events{/privacy}","received_events_url":"https://api.github.com/users/mathiasnagler/received_events","type":"User","site_admin":false},"created_at":"2016-01-28T20:40:04Z","updated_at":"2016-01-28T20:40:04Z","body":"Hopefully... "}}