johnno1962 / injectionforxcode

Runtime Code Injection for Objective-C & Swift
MIT License
6.55k stars 565 forks source link

Learnt compile failed #54

Closed objectiveSee closed 9 years ago

objectiveSee commented 9 years ago

Hello. I am trying to get the plugin working again and running into Learnt compile failed error on both Xcode 6 and 7. I have a project with no Swift code. I have tried to install via the .DMG as well as from source code. The error that I get is the same each time. It appears to be 1 long line, so I pasted it as a gist though you may wish to view in Sublime.

Error:

error: PCH was compiled with module cache path ‘/Users/username/Library/Developer/Xcode/DerivedData/ModuleCache/3LMKQ5BP9LJJE’, but the path is currently ‘/Users/username/Library/Developer/Xcode/DerivedData/ModuleCache/QR54I550FG9N’
1 error generated.


Full Output: https://gist.githubusercontent.com/objectiveSee/b56bf3d895475fdb6d0e/raw/6ea6d7db2600871ccc2e15ad1d982b1a2266c5e4/Injection%2520Output

johnno1962 commented 9 years ago

Hi Danny. This is new to the version just released? Building from source is best thesedays. Switching between Xcode 6 & 7 can create problems however. Have you tried a cmd-option-shift-k clean on your project after switching or deleting the ModuleCache directory?

johnno1962 commented 9 years ago

I’ve checked in a minor modification to prevent builds from differrent versions of Xcode from getting crossed which may fix your problem. Can you give it a try please?

objectiveSee commented 9 years ago

Hi John. Still not working. I tried the following steps:

  1. Uninstall the plugin via (/Applications/Injection.app) and killed Xcode
  2. Pull your latest code, launch InjectionPlugin.xcodeproj in Xcode 7, and run the XcodePlugin for Mac target
  3. Kill Xcode
  4. Delete all files in the DerivedData directory
  5. Re-launch Xcode, build, run, attempt to inject.

I end up getting the same build error as before. Tested on both Xcode 6.4 and Xcode 7 Beta 4.

johnno1962 commented 9 years ago

Not good :( This could be anything so I completely rolled back the script which does the actual injection to (hopefully) get you up and running again if you download and reubuild the plugin. If this doesn’t fix it can you try downloading the zip for release 6.3 which I made before this weekends changes and see if you still get the error and we can go from there. Thanks

johnno1962 commented 9 years ago

Any luck?

skrew commented 9 years ago

Same problem for me. If you need any help for debugging....

Tested:

The path in the debug log "but the path is currently (...)" don't exists on disk.

I have XCode 6.4 and XCode 7 installed (i use 6.4) Project are in obj-c, and have shared framework (iOS 8 only)

Thanks.

johnno1962 commented 9 years ago

Hi, this seems to be a new problem which is either caused by Xcode 7 or a combination of Xcode 6 & 7 or the slight changes I made the other weekend. I’m a little fuzzy about what exactly the ModuleCache is for. In order to factor these out is there any chance you could download the zip for tag 6.3 of injection taken before thes changes and give it a try? If it solves the problem I’ll have to roll back and leave things as they were or we’ll know that it seems to be an Xcode 7 speciality. If you could do this it would be a big help. Cheers.

skrew commented 9 years ago

Hi,

Little precision: The error come when i try to inject a file in the "main" project. If i try to inject a file in the shared framework, it's works (but the shared framework don't have a PCH file...)

johnno1962 commented 9 years ago

Sorry, I meant to download and build the sources for the v6.3 version of injectionforxcode which you can download here: https://github.com/johnno1962/injectionforxcode/releases

skrew commented 9 years ago

Yes i had tested with the 6.3 tag (zip version).

skrew commented 9 years ago

If you want to do some tests in (my) real case i can provide you a xxx session...

johnno1962 commented 9 years ago

That would be a real help thanks.. do you want to email me your ID to support at injectionforxcode.com

johnno1962 commented 9 years ago

Finally found the problem here thanks to a session with skrew. This should be resolved at last. https://github.com/johnno1962/injectionforxcode/commit/926b51424d6ed5bdf201db98c79ce963513d1be8

johnno1962 commented 8 years ago

By the way @skrew. I added some code to check classes for “sharedInstance” methods to include singletons in the sweep. This should mean better delivery on -injected messages on injection.

skrew commented 8 years ago

@johnno1962 ok thanks i will check that

objectiveSee commented 8 years ago

Latest version is working great!