Knowledgebase: Compilation
7.x: "'ecc32.exe' is not recognized as an internal or external command" when using TwineCompile
Posted by Aleksandr Alekseev on 20 February 2024 17:39

Problem:

I get the following error message when trying to compile my C++ Builder project with TwineCompile:

Target TCPostLink:
ecc32.exe --el_alter_exe=C:\Projects\Project1.cbproj
'ecc32.exe' is not recognized as an internal or external command, operable program or batch file.
C:\Program Files (x86)\JomiTech\TwineCompile\TCTargets120.Targets(888,5): error MSB3073: 
The command "ecc32.exe --el_alter_exe=C:\Projects\Project1.cbproj" exited with code 9009.

It happens even in a project without EurekaLog. Why is there this post link event if EurekaLog is not included? There are no post build events specified for this project and no mentions in the project file.

 

Reason:

EurekaLog does not modify your project's build events. The C:\Program Files (x86)\JomiTech\TwineCompile\TCTargetsXYZ.Targets file (which is a part of TwineCompile) contains the following:

<Target Name="TCPostLink">
<Exec
Condition="'$(EurekaLog)'!='' And '$(TLibLink)'!='true' And ('@(OutputOutOfDate)'!='' Or '$(ForceLink)'=='true')"
Command="ecc32.exe --el_alter_exe=$(MSBuildProjectFullPath)"
/>
</Target>

This command is supposed to post-process the compiled executable to include EurekaLog's data.

However, this command will not work with modern versions of EurekaLog and modern IDEs:

  1. This command is trying to call the ecc32.exe file from the \bin folder of your IDE. However, the ecc32.exe is no longer copied into the \bin folder of your IDE, because modern IDE will throw the license validation error if 3rd party files are copied into IDE's \bin folder:
    Question: I’ve installed and registered C++ Builder or Delphi, yet when it starts I am brought to a web page with the error “Product or License Validation Error”. How can I fix this?
    Answer: By far the most common cause for this error is having files or applications not provided by Embarcadero that are copied into the bin folder below where RAD Studio is installed. Only files provided by Embarcadero may reside in the bin folder.
    That is why modern EurekaLog versions will have the ecc32.exe file located in the corresponding C:\Program Files (x86)\Neos Eureka S.r.l\EurekaLog 7\Packages\IDEName\ folder. The command line from the TCTargetsXYZ.Targets file will fail to locate the ecc32.exe inside the mentioned folder.
  2. The command line does not mention which build configuration was used to compile the project (for example, "Debug" or "Release"). It means that even if the ecc32.exe could be called - it will not know where your compiled file is located, failing with the error message similar to this:
    Target TCPostLink:
    ecc32.exe --el_alter_exe=C:\Projects\Project1.cbproj
    EurekaLog Command-Line Compiler (debug) v7.12.0.0 for RAD Studio 28.0
    ----------------------------------------------------------------
    Loading EurekaLog options...
    Compiled file "C:\Projects\Win32\Release\Project1.exe" not found
    C:\Program Files (x86)\JomiTech\TwineCompile\TCTargets120.Targets(888,5): error MSB3073: 
    The command "ecc32.exe --el_alter_exe=C:\Projects\Project1.cbproj" exited with code 2.
    Done building target "TCPostLink" in project "Project1.cbproj" -- FAILED.
    or it will try to post-process a wrong file (and either fail or succeed).

Conclusion: the TCTargetsXYZ.Targets file was created for EurekaLog 6 and early builds of EurekaLog 7 for older IDEs which output the compiled file into the same folder as the project file by default.

 

Solution:

Try to update TwineCompile to the latest version.

 

The TCPostLink target will be executed only when the "EurekaLog" condition is defined. You can remove/disable the "EurekaLog" condition/override to skip the TCPostLink target. Please note that you will have to manually call ecc32.exe to post-process your compiled executable. For example, you may try to use MSBuild build events.

 

Alternatively, to fix the "'ecc32.exe' is not recognized as an internal or external command, operable program or batch file" error you can do one of the following:

  1. If you have just one IDE installed - you can just add the corresponding C:\Program Files (x86)\Neos Eureka S.r.l\EurekaLog 7\Packages\IDEName\ folder to your PATH environment variable.
  2. Alternatively, you can edit the C:\Program Files (x86)\JomiTech\TwineCompile\TCTargetsXYZ.Targets file to include full file name of the ecc32.exe. Do not forget to add double quotes to escape spaces. 
  3. As last resort measure - you can copy the ecc32.exe file from EurekaLog's folder to the \bin folder of your IDE and see if your IDE will load. While it is a possible workaround, we do not recommend it.
  4. Or you can edit the C:\Program Files (x86)\JomiTech\TwineCompile\TCTargetsXYZ.Targets file to simply remove the whole TCPostLink block, so it will not try to call EurekaLog at all. Please note that you will have to manually call ecc32.exe to post-process your compiled executable. For example, you may try to use MSBuild build events.

Once the ecc32.exe will be called properly - you need to sort out the "Compiled file "...\Win32\Release\Project1.exe" not found" error. You can do one of the following:

  1. Configure your project to output the final compiled file into the same folder as your project file (.cbproj). Do it for the Base configuration - so it will be inherited by all build configurations. If some build configuration overrides this setting - do not forget to reset it too.
  2. Alternatively, you can edit the C:\Program Files (x86)\JomiTech\TwineCompile\TCTargetsXYZ.Targets file to include additional info about how your project is compiled.

 

For example, the final fixed TCPostLink target in the TCTargetsXYZ.Targets file may look something like this:

<Target Name="TCPostLink">
<Exec
Condition="'$(EurekaLog)'!='' And '$(TLibLink)'!='true' And ('@(OutputOutOfDate)'!='' Or '$(ForceLink)'=='true')"
Command='"C:\EurekaLog\Packages\Studio29\ecc32.exe" --el_mode=Builder "--el_alter_exe=$(MSBuildProjectFullPath);$(OutputPath)"'
/>
</Target>

where:

  • "C:\EurekaLog" is your EurekaLog installation folder. You should replace it with your EurekaLog path; 
  • "Studio29" is the name of RAD Studio 12. You should replace it with your IDE name.

However, you can add additional arguments - such as --el_ide, --el_buildconfig, --el_config, --el_wait, etc.


Help Desk Software by Kayako Resolve