This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

armcc.exe returning a Windows error 0xc0000142

I'm using Arm Development Studio 2019.1 on Windows 10.

From within ARM Development Studio I select "Build Project" for my project.  It starts executing but I get a Windows pop-up error for armcc.exe that says:

Application was unable to start correctly. (0xc0000142)

The make is invoking Arm C Compiler 5.

I have tried running Arm Development Studio both as a user and as an administrator but I get the same error in either case.

This error occurs on the first file to be compiled for the project.

I've done some searching and found that this error is raised when a DLL is not able to be initialized.

Has anyone else seen this error?

  • Hi Doug,

    Sorry to hear you are having these problems - suffice to say I run the tool daily on my Win10 machine without issue.

    As a first pass, can you check if you can run the compiler from the command line - easiest check is to open the Arm DS Command prompt, use the select_toolchain utility to ensure Compiler 5 is selected, and then run the compiler (armcc -vsn should suffice).

    Is it only armcc that is affected? Try also with armasm, armlink, and also Arm Compiler 6, armclang (run the select_toolchain utility again).

  • Thanks for your response Ronan.

    I tried running the various compilers from the command line prompt, armcc --vsn, and they all executed correctly.

    Doug

  • I just tried running make for the project from the Arm DS command prompt and I get the same error message from armcc.exe on the first compile in the make process, 0xc0000142.

  • Thanks Doug, for your extra information.  Ronan & I are colleagues at Arm, and I'm following up on his behalf.

    You said this error occurs on the first file to be compiled for the project.

    Does it always fail for that one particular source?  I'm wondering if there is something special about that source file, e.g. it contains embedded assembler.  Could you try temporarily removing that file from the project - do other source files compile OK?

    Please could you also try compiling that file on the command-line with e.g.
    armcc -c yourfile.c

    Have you tried compiling a simple Hello World program, or one of the ready-made AC5 examples that are provided in the examples directory?  To try the latter, use File > Import > Arm Development Studio > Examples & Programming Libraries, enter "AC5" in the filter, then select e.g. the fireworks example. You'll need to clean/build/clean/build.  Does that build OK?

    Do you have other shells e.g. Cygwin or MinGW installed on the PC>  The problem is that these tools provide their own “sh.exe” executable.  E.g. Cygwin puts C:\cygwin64\bin on the “Path” environment variable, and the C:\cygwin64\bin directory contains a “sh.exe” executable.  Try modifying the PATH to remove access to these tools-specific shells.
    “make” will look for sh.exe first if the SHELL variable is not set, so it might also be possible to workaround this problem by explicitly specifying e.g. SHELL=$(windir)\system32\cmd.exe

    Stephen

  • Stephen,

    Thank you for the information and suggestions.

    I tried to build the fireworks example as you described from within Arm Dev Studio and I get the armcc.exe error of 0xc0000142 which is what I was seeing with the project I'm working with.

    I will work on compiling from the command line now.

    Doug

  • I tried adding the SHELL variable to my windows environment but I still get the same error.

    I removed C:\MinGW\bin from my PATH and I get the following when I attempt to build the fireworks example:

    make all
    Building file: ../src/Fireworks.c
    Invoking: Arm C Compiler 5
    armcc.exe --cpu=Cortex-A9 --apcs=/hardfp --thumb -DSTANDALONE -O0 -Otime -g --md --depend_format=unix_escaped --no_depend_system_headers --depend_dir="src" -c -o "src/Fireworks.o" "../src/Fireworks.c"
    /usr/bin/sh: /c/Program Files/Arm/Development Studio 2019.1/sw/ARMCompiler5.06u6/bin/armcc.exe: Invalid argument

    I then set my PATH value back to its original value.  I still have the SHELL variable set the suggested value.  From the Arm DS command prompt I tried to compile the fireworks.c file and that compiled successfully.

  • Hi again Doug

    Thanks for testing further.  It does seem that the compilation tools themselves are installed and working correctly, but that the mechanism that launches them from the IDE has been broken somehow.  The error message:
    /usr/bin/sh: /c/Program Files/Arm/Development Studio 2019.1/sw/ARMCompiler5.06u6/bin/armcc.exe: Invalid argument
    is suspicious because this is an error from 'sh', not from 'armcc'.

    Do you have the AVR tools installed?  We've seen "The application was unable to start correctly” errors where sh.exe (provided by AVR tools that were present) was being picked up by make.  If so, can you try temporarily modifying the PATH to remove the AVR tools?  If that doesn't help, try using 'make --trace' to investigate in more detail exactly what is being picked up and from where.

    Stephen

  • Stephen,

    Yes I have AVR tools installed on the computer.  I exited DS, modified the PATH variable to remove the AVR tools, then started DS.  I did a project->build in DS and I no longer get the windows error.

    I now get the following:

    make all
    Building file: C:/src/platform/utilities/src/debug_console_imx.c
    Invoking: Arm C Compiler 5
    armcc.exe --cpu=Cortex-M4 --fpu=FPv4-SP --apcs=/hardfp -D__DEBUG -DCPU_MCIMX7D_M4 -IC:/src/../platform/CMSIS/Include -IC:/src/../platform/devices -IC:/src/../platform/devices/MCIMX7D/include -IC:/src/../platform/devices/MCIMX7D/startup -IC:/src/../platform/drivers/inc -IC:/src/../platform/utilities/inc -IC:/src/../Machine/inc -IC:/src/.. --c99 --gnu -O0 -g --diag_suppress=1296,66,9931 --c99 --split_sections --md --depend_format=unix_escaped --no_depend_system_headers --depend_dir="utilities" -c -o "utilities/debug_console_imx.o" "C:/src/platform/utilities/src/debug_console_imx.c"
    /usr/bin/sh: /c/Program Files/Arm/Development Studio 2019.1/sw/ARMCompiler5.06u6/bin/armcc.exe: Invalid argument
    make: *** [utilities/subdir.mk:23: utilities/debug_console_imx.o] Error 126

    Thanks,

    Doug

  • Hi again Doug, and thanks Stephen for following up in my absence.

    I agree with Stephen that the issue seems to be pathing to your shell... could you try the following, at least as a workaround to build your project for now...

    Right click on the project, and select Show in local terminal -> Terminal, and enter "make" there. Does that build?

    If you get errors of the form "'armcc' is not recognized as an internal or external command, then close the IDE, open the "Arm DS Command Prompt", run the "select_toolchain.bat" script to select Arm Compiler 5, and therein launch the IDE (armds_ide.exe), and 

  • Hi again Doug

    I've done some further investigation.  I believe that a rogue sh.exe is being picked-up from somewhere on your PC.

    On a 'vanilla' Arm DS system on Windows, 'make' should be picking up Windows's own cmd.exe, not some other sh.exe.

    To demonstrate this, I launched 'make' with '-d' to include debugging information:

    C:\Users\YourName\Development Studio Workspace\fireworks_A9-FVP_AC5>make -d -f makefile | more
    GNU Make 4.2
    Built for Windows32
    Copyright (C) 1988-2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <gnu.org/.../gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Reading makefiles...
    Reading makefile 'makefile'...
    find_and_set_shell() setting default_shell = $(windir)/system32/cmd.exe
    Reading makefile 'obj/timer_interrupts.o.d' (search path) (don't care) (no ~ expansion)...
    Reading makefile 'obj/banner_data.o.d' (search path) (don't care) (no ~ expansion)...
    :

    Notice the line:
    find_and_set_shell() setting default_shell = $(windir)/system32/cmd.exe

    You should see something similar.  If you see sh.exe here then you'll have to modify your PATH to prevent it from being picked-up.

    Hope this fixes your problem.

  • Ronan & Stephen,

    Thank you for your suggestions and "debugging" tips!  Once I removed all references to the AVR toolset I am no longer getting the windows error when I attempt to build the project.  Turns out I had set the PATH values in both the user and all users area of windows environment variable settings.

    I will have to come up with batch files to use so that when I switch projects and toolsets I get the correct environment variables for the appropriate toolset.

    Again thank you for your help and patience.

    Doug

  • Hey Doug Lewis, as you are having this issue where you see the error 0xc0000142 and you are not able to start the application, so this can be fixed by running the app in compatibility mode. To do that you need to right click on file that gives application error 0xc0000142, tap on Properties and then press on the option of Compatibility tab. Now tap on the option that says “Run Compatibility Troubleshooter” in case the games work save the settings if not continue. Here put a check mark on the option that states Run this program in compatibility mode for. Then choose the OS to which the driver is accessible and put a check mark on Run this program as an administrator under Privilege Level. In the end press on the option that states Apply and then exit. Try out https://appuals.com/the-application-was-unable-to-start-correctly-0xc0000142/ in case you need to see more solutions. Now you can see in case the issue is the eor has been resolved.

     

  • Hey Doug Lewis, as you are having this issue where you see the error 0xc0000142 and you are not able to start the application, so this can be fixed by running the app in compatibility mode. To do that you need to right click on file that gives application error 0xc0000142, tap on Properties and then press on the option of Compatibility tab. Now tap on the option that says “Run Compatibility Troubleshooter” in case the games work save the settings if not continue. Here put a check mark on the option that states Run this program in compatibility mode for. Then choose the OS to which the driver is accessible and put a check mark on Run this program as an administrator under Privilege Level. In the end press on the option that states Apply and then exit. Try out https://appuals.com/the-application-was-unable-to-start-correctly-0xc0000142/ in case you need to see more solutions. Now you can see in case the issue is the eor has been resolved.