I have been trying to use CMake to generate Makefiles for a C project compiling using GreenHills compiler. But I am getting these errors:
– The C compiler identification is GHS
– The CXX compiler identification is GHS
– Detecting C compiler ABI info
CMake Error: Generator: execution of make failed. Make command was: C:/AGL_2005/COMPILER/ARM/GHS/V2019_5_4/ccarm.exe/gbuild.exe -top CMAKE_TRY_COMPILE.top.gpj cmTC_dd868.tgt.gpj &&
– Detecting C compiler ABI info - failed
– Check for working C compiler: C:/AGL_2005/COMPILER/ARM/GHS/V2019_5_4/ccarm.exe
CMake Error: Generator: execution of make failed. Make command was: C:/AGL_2005/COMPILER/ARM/GHS/V2019_5_4/ccarm.exe/gbuild.exe -top CMAKE_TRY_COMPILE.top.gpj cmTC_86df9.tgt.gpj &&
– Check for working C compiler: C:/AGL_2005/COMPILER/ARM/GHS/V2019_5_4/ccarm.exe - broken
CMake Error at C:/Sources/cmake-3.21.3-windows-x86_64/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
Change Dir: C:/UIDE/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/AGL_2005/COMPILER/ARM/GHS/V2019_5_4/ccarm.exe/gbuild.exe -top CMAKE_TRY_COMPILE.top.gpj cmTC_86df9.tgt.gpj && The system cannot find the file specified
Generator: execution of make failed. Make command was: C:/AGL_2005/COMPILER/ARM/GHS/V2019_5_4/ccarm.exe/gbuild.exe -top CMAKE_TRY_COMPILE.top.gpj cmTC_86df9.tgt.gpj &&
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
– Configuring incomplete, errors occurred!
See also “C:/UIDE/build/CMakeFiles/CMakeOutput.log”.
See also “C:/UIDE/build/CMakeFiles/CMakeError.log”.
What was the full command to CMake to receive this output?
I’m confused why the output shows gbuild.exe. This is the build tool for GHS project files which is a file format very different from Makefiles. You can use GHS compilers with Ninja or Make but then you need to run the appropriate generator and use the correct compiler options.
CMake can also be used to generate GHS project files for use with MULTI and gbuild.exe.
In this case the command line would be something like: cmake -G "Green Hills MULTI" -T "C:\AGL_2005\COMPILER\ARM\GHS\V2019_5_4" -D GHS_PRIMARY_TARGET=arm_standalone.tgt. ccarm should be the standalone target compiler for ARM. -T is used to specify the directory of where the tools are installed. I made a guess on what target you wanted for GHS_PRIMARY_TARGET. This is usually specific to the board you are targeting and should have been specified when receiving the tools from Green Hills.
@fdk17 Thank you so much Your input is very helpful.
Now it is generated but with another error in the linker
Green Hills MULTI: -A not specified; defaulting to “arm”
– The C compiler identification is GHS 2019.5.4
– The CXX compiler identification is GHS 2019.5.4
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: C:/AGL_2005/COMPILER/ARM/GHS/V2019_5_4/ccarm.exe - skipped
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: C:/AGL_2005/COMPILER/ARM/GHS/V2019_5_4/cxarm.exe - skipped
– Configuring done
CMake Error: CMake can not determine linker language for target: UIDE_test_1.elf
CMake Error: CMake can not determine linker language for target: UIDE_test_1.elf
– Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
This is usually only necessary, if you don’t have any recognized source files.
So if you have added e.g. a main.cpp to your executable, the language should be automatically set to CXX.
I don’t know if there are some issues with GHS generator (which I don’t have) or your cmake files.
I made a minimal example to demonstrate it. With if(1) it shows the “can not determine linker language for target” error message. And with if(0) the message vanishes.
I haven’t run into that issue with C and CXX code while using the GHS generator. If you could create a minimum example that demonstrates the issue that would be beneficial to understanding the problem.
@ClausKlein No,
I haven’t found it necessary to use one. I do use a small script to run the CMake command. For me it’s working fine. I’m using the Green Hills MULTI generator to use gbuild to parse the integrate file, generate header files, build the kernel, build the applications, and then integrate everything into a Monolith image, then a custom command to deploy image.
I’m not using Ninja for running the build with the GHS compilers. I pushed some changes that incorporates some of the ideas of #19743. cmake/cmake!4136 and cmake/cmake#20089 make it easy to at least compile a file with Ninja but there would be more work for archiving libraries. Then there would be the custom rules for running the integrate and other commands required for building a monolith image.
Can some one help me on this. I noticed below
– Warning: Did not find file Compiler/GHS-ASM
– Warning: Did not find file Compiler/GHS-ASM
– Configuring done
I came across your post about using the Green Hills MULTI generator with CMake and had a quick question. I apologize for responding to an old message, but I’m really interested in your approach.
You mentioned that you use the Green Hills MULTI generator to parse the integrate file, generate header files, build the kernel, build the applications, and integrate everything into a Monolith image. Did you manage to do all this natively with the CMake Green Hills MULTI generator, or did you have to add custom commands to achieve this?
I’m currently trying to create a CMake build that uses the Green Hills MULTI generator, but I’m struggling to get it to actually create a Green Hills project that builds a Monolith image. Any insights or guidance would be greatly appreciated!