InjectionApp icon indicating copy to clipboard operation
InjectionApp copied to clipboard

Fails to locate compile command

Open ilyapuchka opened this issue 7 years ago • 36 comments

Always get this error even on clean build:

Could not locate compile command for /Users/iilyapuchka/Documents/.../....swift

If you have switched xcode versions, please cmd-shift-k to clean then rebuild the project so there is a complete build history logged and try again.


ilyapuchka avatar Jan 16 '17 16:01 ilyapuchka

Do you have spaces in the path to your project?

johnno1962 avatar Jan 16 '17 16:01 johnno1962

No, the path does not have spaces.

ilyapuchka avatar Jan 16 '17 16:01 ilyapuchka

Want me to take a look.. if so, send TeamViewer co-ords to injectionapp at johnholdsworth.com

johnno1962 avatar Jan 16 '17 16:01 johnno1962

Do you have a custom Derived data path perhaps?

johnno1962 avatar Jan 16 '17 16:01 johnno1962

No custom Derived data paths too, no spaces there as well. I can provide you with a console log:

buidRoot: /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Build
logDir: /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build


*** Could not locate compile command for /Users/iilyapuchka/Documents/ios/HelloFresh/HelloFresh/MealChoiceViewController.swift
If you have switched xcode versions, please cmd-shift-k to clean then rebuild the project so there is a complete build history logged and try again.
/Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/AABE0AAF-0D2E-479C-90E3-5948FC17F674.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/E698E44A-2AE5-4660-A399-AD357138016F.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/8205E04F-30D8-473B-B7C5-4295395CFB36.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/../Debug/6AEF43E7-E5CD-4CF5-B410-9A1225DFD2A6.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/3E5C928A-5C04-4EB2-BFDC-0C8E97BD77D0.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/BD220AE9-8D0C-4D10-BFDA-1E74E755F97D.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/../Debug/F261E078-2376-41F5-BF23-A30D5CC3D0D5.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/6CD85D7A-151A-4E53-A4E2-0F288B623EB9.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/FFB0A313-9853-4A16-8320-C59BE30CCB0D.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/../Debug/7393D390-C262-4E4C-B119-DD595B760D16.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/79FA7D18-9184-4ED5-8420-0C5E536D8084.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/../Debug/49686601-BB2D-459B-938E-37B47C6285C1.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/96D54CF5-62A5-472F-B2D3-D979452616E7.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/../Debug/3EC4F749-75F5-40CB-A037-CDE177A1D069.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/BAE85150-1BC0-477C-AF4F-416B7EFDB258.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/../Debug/91997F8E-2F4A-484C-9E00-CF3B24F6E929.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/651C2764-83DD-4079-8549-2B977177D269.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/3774CEBA-D7DC-4AE0-B1E1-551C19802E7F.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/../Debug/D986878C-EBA6-47E6-B4DC-B2CBAE29E94A.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/63330041-0CBB-4596-8C35-BC5D6ADAB648.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/../Debug/E4BAFCFD-4DAC-4281-9A06-86C1A6CD723C.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/72D35F87-F0C7-4074-8E53-4BB79CB73F99.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/../Debug/E23F6FC7-6E24-4835-9B7C-59AA8473947A.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/FDDE468D-454E-4DFB-95E3-203FCC008074.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/../Debug/14DF614E-1D18-42B0-BC4D-72D14285AF50.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/422D7200-04E5-4BE9-A53D-1D1163602B9A.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/99B5B784-D73A-45B2-ADC3-C4326CAEED3D.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/../Debug/73E547D6-B296-4DE2-8B44-9847A1793BA7.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/301C4F6D-438A-464D-BF58-824E83719198.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/A133D5D7-5CB8-4F26-843B-595A8545B36F.xcactivitylog /Users/iilyapuchka/Library/Developer/Xcode/DerivedData/HelloFresh-cnmqtfuzousgftdxpsfvsbaygdua/Logs/Build/../Debug/4E24F647-8815-4A03-9502-2D309E5AE075.xcactivitylog ***

 at /Applications/Injection.app/Contents/Resources/common.pm line 61.
 main::error('Could not locate compile command for /Users/iilyapuchka/Docum...') called at /Applications/Injection.app/Contents/Resources/injectSource.pl line 271
*** Bundle build failed ***



ilyapuchka avatar Jan 16 '17 16:01 ilyapuchka

Nothing seems to be amiss. I’d need to take a look. What is your path to Xcode?

johnno1962 avatar Jan 16 '17 17:01 johnno1962

Having the same error.

the log is as follows:

buidRoot: /Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Build

logDir: /Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Logs/Build



*** Could not locate compile command for /Users/akaralar/Development/freelancework/warp/ios/warp-ios/Warp/Views/ViewControllers/Publish/PublishViewController.swift

If you have switched xcode versions, please cmd-shift-k to clean then rebuild the project so there is a complete build history logged and try again.

/Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Logs/Build/0EC01539-AA59-45DE-8FF3-6DD93DE9B705.xcactivitylog
/Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Logs/Build/../Debug/20EE672C-F569-4269-B2FD-E43D9DABEFE1.xcactivitylog 
/Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Logs/Build/D97C7379-D660-4849-88E2-F7D5526D0CDC.xcactivitylog
/Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Logs/Build/EB556284-D8F1-4638-8B35-F6A40859A717.xcactivitylog 
/Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Logs/Build/6365F064-13F8-4228-B5B2-44A4975D7B31.xcactivitylog 
/Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Logs/Build/39B9B9B7-4DDA-4517-9515-BD3E49545A9D.xcactivitylog 
/Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Logs/Build/../Debug/15672498-EED9-4CBE-B0C0-9D05630C87CA.xcactivitylog 
/Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Logs/Build/9C7AE591-B12B-43E0-A2DC-49FE8D860748.xcactivitylog 
/Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Logs/Build/../Debug/70BEB1B8-9343-41C2-A8D5-B3655B80B98C.xcactivitylog 
/Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Logs/Build/0BA2A968-E2A3-4FD0-A0D8-88871694A64A.xcactivitylog 
/Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Logs/Build/../Debug/0AB74A89-03A9-4626-BCCC-F2D7B50F4276.xcactivitylog 
/Users/akaralar/Library/Developer/Xcode/DerivedData/Warp-fgqcdtjyxrlfltebdmdfcbbqtqvs/Logs/Build/B0AC8D8E-2617-40F4-8B6F-92F1A456BB0D.xcactivitylog 
***

 at /Applications/Developer/Injection.app/Contents/Resources/common.pm line 61.
	
main::error(‘Could not locate compile command for /Users/akaralar/Developm…’) called at /Applications/Developer/Injection.app/Contents/Resources/injectSource.pl line 291

*** Bundle build failed ***



akaralar avatar Feb 25 '17 14:02 akaralar

BTW You can take a look from TeamViewer if you'd like to.

akaralar avatar Feb 25 '17 14:02 akaralar

Tried with AppCode and got the same error.

akaralar avatar Feb 25 '17 14:02 akaralar

Have you got a non-standard Derived Data path?

johnno1962 avatar Feb 25 '17 15:02 johnno1962

No it's the default path

akaralar avatar Feb 25 '17 16:02 akaralar

If you like you can send through your TeamViewer co-ordinates to injection at johnholdsworth.com

johnno1962 avatar Feb 25 '17 16:02 johnno1962

Sent

akaralar avatar Feb 25 '17 18:02 akaralar

Turns out the problem was using “whole module optimisation” which stops injection working.

johnno1962 avatar Feb 26 '17 13:02 johnno1962

Is there any other possible reason for this error?

I disabled whole module optimization, cleaned the project, removed derived data (default path).. still unable to inject

This is the error I'm getting:

*** Could not locate compile command for /Users/leandro/MyApp/MyApp/Code/Logic/Navigation/TabbedNavigator.swift
Injection doesn’t work when using whole module optimisation.
If you have switched xcode versions, please cmd-shift-k to clean then rebuild the project so there is a complete build history logged and try again.
/Users/leandro/Library/Developer/Xcode/DerivedData/MyApp-bbhfhdjizpcjbfcekiggqzaesufm/Logs/Build/B98EC9E7-60E8-45AC-A09A-23B2C5D1B037.xcactivitylog ***

 at /Applications/Injection.app/Contents/Resources/common.pm line 61.
 main::error(‘Could not locate compile command for /Users/leandro/MyApp/MyApp…’) called at /Applications/Injection.app/Contents/Resources/injectSource.pl line 292
*** Bundle build failed ***


leandromperez avatar Jan 11 '18 17:01 leandromperez

Have you tried the new version https://github.com/johnno1962/InjectionIII. It’s a rewrite of the core in Swift.

johnno1962 avatar Jan 11 '18 18:01 johnno1962

@johnno1962 I just downloaded it and tried it out.

On a clean install, clean simulator, clean derived data folder, the path contains no special characters.

I started injection: Injection connected, watching /Users/leandro/MyApp/...

Then saved a file and got this error:

"Could not locate compile command for /Users/leandro/MyApp/Code/Logic/Navigation/TabbedNavigator.swift Try a clean build. There are also restrictions on characters allowed in paths."

leandromperez avatar Jan 14 '18 14:01 leandromperez

Do you have a custom path set for DerivedData? Is injection able to find any of the files in your project?

johnno1962 avatar Jan 14 '18 17:01 johnno1962

@johnno1962

No, default DerivedData folder.

I created a blank new VC and no luck either.

I am able to Run XProbe and see results. But unable to inject any code. Each time I save the file, I get a "Could not locate compile command" error.

I was able to make it work on a new test project, but not on my main project.

leandromperez avatar Jan 14 '18 20:01 leandromperez

Do you want to TeamView on this? If so, send your details to injection at johnholdsworth dot com

johnno1962 avatar Jan 14 '18 21:01 johnno1962

I am afraid I will not be able to TeamView until I ask permissions tomorrow, nda stuff...

I am also seeing this in the system console

Sandbox: mds(69) deny file-write-xattr /Users/leandro/MyApp/Code/Logic/Navigation/TabbedNavigator.swift [Duplicate; no report will be generated.]

This is what I get if I sudo InjectionIII from terminal:

2018-01-14 19:13:41.642 InjectionIII[39257:611026] Injected Simulator 2018-01-14 19:13:43.217 InjectionIII[39257:611049] Connection from 127.0.0.1:59289 2018-01-14 19:13:43.389 InjectionIII[39257:625293] Connection with project file: /Users/leandro/Workspace/MyApp/MyApp/MyApp.xcworkspace 2018-01-14 19:13:43.398 InjectionIII[39257:625293] Bad estimate of Derived Logs: /Users/leandro/Workspace/MyApp/MyApp/MyApp.xcworkspace -> /var/root/Library/Developer/Xcode/DerivedData/MyApp-abyyudkdjeykkkaunrbufdficbbd/Logs/Build Scanning /Users/leandro/Library/Developer/Xcode/DerivedData/MyApp-abyyudkdjeykkkaunrbufdficbbd/Logs/Build/D88584BF-981C-458A-8397-C31194EE5CAF.xcactivitylog Scanning /Users/leandro/Library/Developer/Xcode/DerivedData/MyApp-abyyudkdjeykkkaunrbufdficbbd/Logs/Build/E315F946-8B4D-4A9A-A8B0-E54D7323ACC5.xcactivitylog

leandromperez avatar Jan 14 '18 22:01 leandromperez

Thanks for the info. You seem to have two problems. It should be able to guess your derived data from the project and it should fall back provided you project file is in the project’s root directory. Do you have more than one project open?

johnno1962 avatar Jan 15 '18 06:01 johnno1962

@johnno1962 I tried adding a new vc to the project's root directory. I also made sure that the project was the only opened, no luck, same errors.

leandromperez avatar Jan 15 '18 10:01 leandromperez

Hi guys, I got the same issue did you find any fix for this ?

Athosone avatar Apr 15 '18 21:04 Athosone

I have the exact same problem. Does Injection III work for multi-module projects (that is, I have a workspace open with 3 Xcode projects—one with various "framework" classes, the second with model classes, and the third containing the main app... AppDelegate, UI, etc.

Running on High Sierra 10.13.5. The sample GettingStarted app works correctly.

stuartro avatar Jun 20 '18 21:06 stuartro

Provided there is only one workspace you should be ok provide you are using the App Store version. If it’s not finding your logs at all check you don’t have a non-default setting for the DerrivedData location.

johnno1962 avatar Jun 20 '18 21:06 johnno1962

DerivedData is set to default. Using Xcode 9.4.1, running iOS 11.4 simulator. I'm willing to try TeamView if it will help

stuartro avatar Jun 20 '18 21:06 stuartro

@johnno1962 If you want to reach me directly, I'm at: stuartro AT gmail.com

stuartro avatar Jun 20 '18 21:06 stuartro

Send your TeamView co-ords to injection at johnholdsworth.com and I can take a look.

johnno1962 avatar Jun 20 '18 22:06 johnno1962

Should be in your inbox

stuartro avatar Jun 20 '18 22:06 stuartro

Was the old “doesn’t work with whole module optimisation” chestnut. I must put a message in.

johnno1962 avatar Jun 20 '18 23:06 johnno1962

@johnno1962 Thanks for your help!

stuartro avatar Jun 20 '18 23:06 stuartro

I am seeing error,

*** Could not locate containing project or it's logs. Have you customised the DerivedData path? ***

I am using default derived path.

Let me know if I am eligible for Teamviewer ?

narendrabade avatar Feb 25 '19 20:02 narendrabade

This is probably to do with unusual characters in you project name. If you want to TeamView send your details to injection at johnholdsworth.com.

johnno1962 avatar Feb 25 '19 20:02 johnno1962

In the end it was a mac App and you need turn off the App Sandbox for injection to work. I’ll change the error message to remind people.

johnno1962 avatar Feb 26 '19 23:02 johnno1962

@johnno1962 how to turn off the app sandbox? I installed the app from Mac AppStore but couldn't get that working. I constantly receive this error:

*** Could not locate compile command for ... (Injection does not work with Whole Module Optimization.

Whole Module Optimization is off.

agordeev avatar Mar 20 '19 13:03 agordeev