Page 1 of 1

"No rule to make target" while compiling

Posted: Wed Dec 14, 2016 1:10 am
by arao23
Everything was working fine, when all of a sudden, I am getting the following error:

Code: Select all

...
CC src/crypto/md5-internal.o
CC src/crypto/sha256-internal.o
CC src/crypto/aes-internal-enc.o
CC port/os_xtensa.o
AR libwpa_supplicant.a
CC trax.o
AR libxtensa-debug-module.a
CC main.o
make[1]: *** No rule to make target 'main', needed by 'libmain.a'.  Stop.
make: *** [C:/esp/esp-idf/make/project.mk:342: main-build] Error 2
I tried make clean and make all and tried deleting the build folder, but I keep getting the "No rule to make target" error. Any ideas?

Re: "No rule to make target" while compiling

Posted: Wed Dec 14, 2016 2:37 am
by arao23
Figured it out. To help others:

There seems to be an issue if you use both Eclipse and the msys terminal at the same time. This could be also caused by the virus scanner, so I haven't looked into the exact cause, but here is what I had to do:

1. Disable your real-time filesystem virus shield (temporarily, say 10 minutes). I use Avast, I simply had to right-click on the system tray icon -> Shields control -> Disable for 10 min.

2. If you use Eclipse, disable "Build Automatically" from the Project menu.

3. Project -> Clean. Uncheck the box for "Build automatically"

4. Open the msys terminal and navigate to your project folder.

5. "make app" and "make app-flash" should work now. You may see multiple "C:\msys32\opt\xtensa-esp32-elf\bin\xtensa-esp32-elf-ar.exe: unable to rename 'xxxxxxx.a'; reason: File exists" errors, but keep running "make app" and eventually one of them will go through... Sometimes just 1 re-run, sometimes 10. Not sure why that happens.

6. Re-enable your virus scanner.

I no longer build in Eclipse -- I just use it to code and do the building / flashing in terminal. Not sure why that is happening.

Re: "No rule to make target" while compiling

Posted: Thu Aug 31, 2017 6:08 am
by chaotaklon
I have the same error but my case is different.

I copied the main.c as main (copy).c as a backup. It will create the same error. Moving the file out of the repository solve the problem.

Re: "No rule to make target" while compiling

Posted: Fri Nov 24, 2017 6:09 pm
by avi007
had a back-up file with extension "main-Copy.cpp". Got the same error, but deleting this file fixed the problem!

Re: "No rule to make target" while compiling

Posted: Fri Nov 24, 2017 10:25 pm
by kolban
When I rename files, occasionally, I have to delete the generated build folder and let it be recreated.

Re: "No rule to make target" while compiling

Posted: Thu Mar 28, 2019 6:42 pm
by akotowski
I have the same problem but these solutions do not work for me...