"No rule to make target" while compiling

arao23
Posts: 30
Joined: Tue Dec 13, 2016 4:44 pm

"No rule to make target" while compiling

Postby arao23 » Wed Dec 14, 2016 1:10 am

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?

arao23
Posts: 30
Joined: Tue Dec 13, 2016 4:44 pm

Re: "No rule to make target" while compiling

Postby arao23 » Wed Dec 14, 2016 2:37 am

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.

chaotaklon
Posts: 4
Joined: Thu Aug 31, 2017 6:06 am

Re: "No rule to make target" while compiling

Postby chaotaklon » Thu Aug 31, 2017 6:08 am

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.

avi007
Posts: 11
Joined: Fri May 26, 2017 12:58 am

Re: "No rule to make target" while compiling

Postby avi007 » Fri Nov 24, 2017 6:09 pm

had a back-up file with extension "main-Copy.cpp". Got the same error, but deleting this file fixed the problem!

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: "No rule to make target" while compiling

Postby kolban » Fri Nov 24, 2017 10:25 pm

When I rename files, occasionally, I have to delete the generated build folder and let it be recreated.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

akotowski
Posts: 16
Joined: Sat Sep 01, 2018 2:54 pm

Re: "No rule to make target" while compiling

Postby akotowski » Thu Mar 28, 2019 6:42 pm

I have the same problem but these solutions do not work for me...

Who is online

Users browsing this forum: No registered users and 156 guests