Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Unable to launch avr-gcc(Build throws an error immediately on launching avr-gcc)
Unable to launch avr-gcc [message #1840754] Fri, 23 April 2021 11:25 Go to next message
Peter Charles-Jones is currently offline Peter Charles-JonesFriend
Messages: 11
Registered: April 2021
Junior Member
I am a newbie trying to move from Arduino IDE to Eclipse and am keen to program AVR MCU (I'm new at this too).
I have successfully installed (I hope) winAVR and the AVR Eclipse Plugin.
I can use the Project | Properties | AVR | Target Hardware to interrogate the AVR (it's an Arduino Uno - ATMegga328P) and the Project | Properties | AVR AVRDude | Fuses | direct hex values | Load from MCU seems to communicate (flashing Tx Rx on Arduino Uno) and update fuse settings on screen.
I have built my 'blinky' code, saved it (main.c) and now want to get something uploaded onto my AVR but when I Build it, I get an avr-gcc.exe - Application Error dialog - The application was unable to start correctly (0xc0000142):

My environment on a Windows 10 Home 64bit machine:

Eclipse IDE for C/C++ Developers (includes Incubating components)
Version: 2021-03 (4.19.0)
Build id: 20210312-0638
AVR Eclipse Plugin 2.4.2 de.innot.avreclipse.feature.group avr-eclipse.sourceforge.net
avrdude version 5.10, URL:

More detailed description of issue:

The command line Eclipse is trying to execute is:
avr-gcc -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega328p -DF_CPU=1000000UL -MMD -MP -MF"main.d" -MT"main.o" -c -o "main.o" "../main.c"

I was trying to use an IDE so I didn't need to use the command line directly. However I looked up an a article (How to compile and burn the code to AVR chip on Linux/MacOSX/Windows 2016-01-08 by Łukasz Podkalicki) to get a simplified command to see if there was a fundamental issue and this ran as below.

C:\Users\Peter\OtherWorkspace\Bliknk2>avr-gcc -Wall -g -mmcu=atmega328p -o main.bin main.c

C:\Users\Peter\OtherWorkspace\Bliknk2>dir
Volume in drive C has no label.
Volume Serial Number is F652-2CC9

Directory of C:\Users\Peter\OtherWorkspace\Bliknk2

23/04/2021 11:54 <DIR> .
23/04/2021 11:54 <DIR> ..
23/04/2021 10:25 8,739 .cproject
22/04/2021 21:55 840 .project
22/04/2021 22:07 <DIR> .settings
23/04/2021 11:54 2,947 main.bin
23/04/2021 11:17 189 main.c
22/04/2021 22:15 <DIR> Release
4 File(s) 12,715 bytes
4 Dir(s) 388,531,277,824 bytes free

C:\Users\Peter\OtherWorkspace\Bliknk2>avr-size -C main.bin
AVR Memory Usage
----------------
Device: Unknown

Program: 156 bytes
(.text + .data + .bootloader)

Data: 0 bytes
(.data + .bss + .noinit)

I must be close with the Eclipse setup but something must be incorrect. Please can you help me? What have I done wrong?
Re: Unable to launch avr-gcc [message #1840780 is a reply to message #1840754] Fri, 23 April 2021 14:45 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
The key is here: avr-gcc.exe - Application Error dialog - The application was unable to start correctly (0xc0000142). It means that Windows is not happy with your avr-gcc.

To verify, attempt to run the compiler from the command line:
avr-gcc -c -mmcu=atmega328p main.c,
or
avr-gcc --version

You may need to search for solutions to the Windows error code (0xc0000142). Sorry, I'm a Mac user and cannot help here.


--

Tauno Voipio
Re: Unable to launch avr-gcc [message #1840787 is a reply to message #1840780] Fri, 23 April 2021 16:33 Go to previous messageGo to next message
Peter Charles-Jones is currently offline Peter Charles-JonesFriend
Messages: 11
Registered: April 2021
Junior Member
Hi Tauno

Thanks for your reply.

I was thinking along the same lines as you which is why in my post I included the screen output from my simplified avr-gcc which I ran from a command prompt from the same directory as my source main.c file. This was successfully able to compile the code into main.bin and I also included the output from a command prompt launched avr-size to show the main.bin was actually created (also included a command line directory listing showing main.bin).

I'll start researching Windows error codes but it seemed to me that maybe one of the avr-gcc switches in the Eclipse generated commands could be the root cause or some how launching avr-gcc from a command line (successfully) was different from Eclipse launching avr-gcc.

Are there any special environment variables I need to check are set?

The version of avr-gcc I have was bundled with winAVR which included arvdude version 5.1 - I could not find a command switch to list the version of avr-gcc .

If you or anyone else has any further thoughts, I'd welcome the help.

I feel I am on a clear runway, the throttle is at full and I've picked up 150knotts but I just can't take off.

Best regards Peter
Re: Unable to launch avr-gcc [message #1840790 is a reply to message #1840787] Fri, 23 April 2021 17:45 Go to previous messageGo to next message
Peter Charles-Jones is currently offline Peter Charles-JonesFriend
Messages: 11
Registered: April 2021
Junior Member
Well things have changed but still no solution:

I researched the error and ran
C:>DISM.exe /Online /Cleanup-image /Restorehealth

Then I ran
C:>sfc /scannow

It did claim to fix some things but I had the same result as before.

I also started PC in clean mode - with all the start up junk disabled just in case there was some type of app conflict.

Then I located the avr-gcc.exe and had Windows run Troubleshoot compatibility (right click on .exe)

Running Build in Eclipse now gives me a different error - Permission denied - I think the Troubleshoot compatibility utility was running avr-gcc.exec as administrator - I certainly had to confirm access before it was launched by Eclipse. Not sure I can get any more permissions higher than administrator.

I feel I am getting closer but I do not know how to resolve the issue. Maybe a complete re-install of Eclipse? I don't know.

Please help me if you can.

Best regards Peter

Details here
18:33:40 **** Incremental Build of configuration Release for project Bliknk2 ****
make all
Building file: ../main.c
Invoking: AVR Compiler
avr-gcc -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega328p -DF_CPU=1000000UL -MMD -MP -MF"main.d" -MT"main.o" -c -o "main.o" "../main.c"
/usr/bin/sh: /c/WinAVR-20100110/bin/avr-gcc: Permission denied
make: *** [main.o] Error 126
"make all" terminated with exit code 2. Build might be incomplete.

18:33:40 Build Failed. 1 errors, 0 warnings. (took 167ms)


[Updated on: Fri, 23 April 2021 18:14]

Report message to a moderator

Re: Unable to launch avr-gcc [message #1840835 is a reply to message #1840790] Mon, 26 April 2021 11:42 Go to previous messageGo to next message
Peter Charles-Jones is currently offline Peter Charles-JonesFriend
Messages: 11
Registered: April 2021
Junior Member
I suspect this is an unresolvable Windows issue so I plan to run up a Virtualbox instance of Ubuntu and start again from there.
Re: Unable to launch avr-gcc [message #1840938 is a reply to message #1840754] Thu, 29 April 2021 09:55 Go to previous messageGo to next message
Peter Charles-Jones is currently offline Peter Charles-JonesFriend
Messages: 11
Registered: April 2021
Junior Member
Time passes...
Thinking maybe my Windows PC was in some way 'broken', I attempted the same set up on a very new machine only 4 months old:
Intel i7-9750 CPU running at 2.6 GHz
32 G RAM
64 bit
Windows 10 Home OS build 19041.928

To the point - I ended up at the same place with the same error code.

My conclusion is that there is something systemically wrong with the install packages and it's not my PC.

Another gambit - create an Ubuntu virtual guest running on Windows Virtualbox host. This took a while and although I was able to compile my source, I could not figure out how to get Eclipse to talk to the ISP programmer (actually an Arduino Uno) hung out of USB , reporting as COM3 on my Windows PC. I started another post on this subject but I have to say I'm just about at the end of my road.

All I want is something better than Arduino IDE - I'm now looking at Atmel's Microchip Studio. It seems more limited on choice of MCU and programmer tool but I'd settle for this just for an easy life - hey I want to crack on programming AVRs after all.

Eclipse looks really cool but if I can't get it to fly, I can't use it.
Re: Unable to launch avr-gcc [message #1864537 is a reply to message #1840938] Fri, 22 March 2024 04:49 Go to previous message
Rhys Drummond is currently offline Rhys DrummondFriend
Messages: 4
Registered: June 2018
Location: Australia
Junior Member
I struggled with this recently.
Turns out I had 2 versions of AVRGCC installed. The older one was on the path, so the Make process would use 'make' from the older version. But that make would invoke avr-gcc in the newer version, which it had a problem with, generating this error.
So drop to a command line and type 'where make' to see where it's being called from.
Previous Topic:Control flow guard, security flags
Next Topic:signing certificate for tools from marketplace
Goto Forum:
  


Current Time: Thu Oct 10 05:06:47 GMT 2024

Powered by FUDForum. Page generated in 0.10258 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top