[CMake] CMake 2.8.2 with WindRiver diab compiler dcc.exe/dplus.exe on WinXP: CMake Error: Could not COPY_FILE. while detecting compiler ABI

Molsen, Hannes Hannes.Molsen at draeger.com
Mon Sep 20 04:45:54 EDT 2010


Hi Brad, Hi Alex.

I ran CMake with --debug-trycompile on a clean and empty build tree. Not a single file inside that folder.
After that I find the generated files testCCompiler.c and CMakeCCompilerABI.c in CMakeFiles/CMakeTmp/.
But I also find the file testCCompiler.c.obj and CMakeCCompilerABI.c.obj in CMakeFiles/CMakeTmp/CMakeFiles/cmTryCompileExec.dir/.
It's the same with CXX.

If I compile the files "by hand" they are binary identical to the ones mentioned above.

But actually I do not link these objects to an executable. This would not make any sense (for me), as the "executables" would be VxWorks binary files which can not be run under Windows XP.

Therefore I don't have a CMAKE_EXECUTABLE_SUFFIX set, because actually I do not build executables at all.
The real project consists of libraries as "libFramework.a".
The builds of the CMake test files stop after assembly, only object files are generated.
Is this maybe the problem? Does CMake need to have an executable to detect the compiler ABI? How could that ever work for cross compiling? Then I would have to set the ABI always in the toolchain file.

Here is something else to think about:
As I wrote in the last mail, CMake always starts with a clean build path. In the scenario "clean -> run | leave -> debug" the copy file error does not occur. So what is happening there?
{run} deletes the temporary tree, right?
{debug} does not. But: does it have any old executables? No. How could there be any, if I start with a clean tree, and the {run} fails.
So what's my point? You, said, that --debug-trycompile copies an executable from a *previous* try_compile. Do I understand that right:
CMake uses the same name for an executable several times. try_compile is performed several times for different things. For example
try_compile(CMakeTestCCompiler) -> Output.out -> copy -> do NOT delete
try_compile(CMakeDetermineCompilerABI) -> no output generated, but Output.out expected. -> copy Output.out from CMakeTestCCompiler build?

Because if the output file is unique for try_compile(DetermineCompilerABI), there can't be any *previous* file, as I always compile with the same parameters and the .c.obj file is always generated.

Now Alex' questions:

I don't have a VxWorks.cmake, I know it would be the right way, but until now I only have the Generic-DCC-PPC603.cmake file. As the operating system in our project will not change, I was too lazy to split that up :-)

Executables (later in the project, when I get CMake to run properly) will have no extension. Until then I'm only building the libraries (libFramework.a) etc.

And here comes the toolchain file:

=== TC_diab.cmake : > begin ===

# =========================
# basic directory variables
# =========================
[...] these are set correctly :-)

# ===========
# basic setup
# ===========
SET(OPTIMIZATION_LEVEL "-g3")

SET(DCCFLAGS "-c -tPPC603FH:vxworks55 [...]")

SET(GLOBAL_EXTRA_CFLAGS 		"")
SET(GLOBAL_EXTRA_CDEFINES 		"")
SET(GLOBAL_EXTRA_CINCLUDES 		"")
SET(GLOBAL_EXTRA_CXXFLAGS 		"")
SET(GLOBAL_EXTRA_CXXDEFINES 		"")
SET(GLOBAL_EXTRA_CXXINCLUDES 		"")

# ==================
# basic system setup
# ==================
SET(CMAKE_SYSTEM_NAME 		"Generic")
SET(CMAKE_SYSTEM_PROCESSOR 	"PPC603")
SET(CMAKE_FIND_ROOT_PATH  	"${TGT_DIR}")

# ================
# c-compiler setup
# ================
SET(CMAKE_C_COMPILER "${WIND_BIN}/dcc.exe")
SET(CCFLAGS 		"-XO ${OPTIMIZATION_LEVEL} [...] ${DCCFLAGS} ${GLOBAL_EXTRA_CFLAGS}")
SET(CCDEFINES 		"-DMPC603 -DCPU=PPC603 -DTOOL_FAMILY=diab -DTOOL=diab -DVXWORKS -D__DIAB__ -D_WRS_KERNEL ${GLOBAL_EXTRA_CCDEFINES}")
SET(CCINCLUDES 		"-I${TGT_DIR}/h -I${TGT_DIR}/h/wrn/coreip -I${GLOBAL_S16CORE} -I${GLOBAL_FRAMEWORK} ${GLOBAL_EXTRA_CCINCLUDES}")
SET(CMAKE_C_FLAGS 	"${CCFLAGS} ${CCDEFINES} ${CCINCLUDES}")

# ==================
# c++-compiler setup
# ==================
SET(CMAKE_CXX_COMPILER "${WIND_BIN}/dplus.exe")
SET(CXXFLAGS 		"-XO ${OPTIMIZATION_LEVEL} [...] ${DCCFLAGS} ${GLOBAL_EXTRA_CXXFLAGS}")
SET(CXXDEFINES 		"-DMPC603 -DCPU=PPC603 -DTOOL_FAMILY=diab -DTOOL=diab -DVXWORKS -D__DIAB__ -DUNICODE -D_UNICODE -D_WRS_KERNEL ${GLOBAL_EXTRA_CXXDEFINES}")
SET(CXXINCLUDES 	"-I${TGT_DIR}/h -I${TGT_DIR}/h/wrn/coreip -I${TGT_DIR}/config/all -I${M16_BSP} -I${M16_BSP}/drv/h -I${GLOBAL_S16CORE} -I${GLOBAL_FRAMEWORK} ${GLOBAL_EXTRA_CXXINCLUDES}")
SET(CMAKE_CXX_FLAGS "${CXXFLAGS} ${CXXDEFINES} ${CXXINCLUDES}")

# ============
# linker setup
# ============
SET(CMAKE_LINKER "${WIND_BIN}/dld.exe")

=== TC_diab.cmake : < EOF ===

Thanks for your help!

- Hannes

-----Original Message-----
From: Brad King [mailto:...king at kitware.com] 
Sent: Freitag, 17. September 2010 14:37
To: Molsen, Hannes
Cc: David Cole; cmake at cmake.org
Subject: Re: [CMake] CMake 2.8.2 with WindRiver diab compiler dcc.exe/dplus.exe on WinXP: CMake Error: Could not COPY_FILE. while detecting compiler ABI

On 09/17/2010 03:35 AM, Molsen, Hannes wrote:
> In CMakeTestCCompiler.cmake I found a flag called "CMAKE_C_COMPILER_FORCED".

This is meant to be set by cross compiling toolchain files that explicitly
set the compiler ABI information.  It is not set by --debug-trycompile.

> So I still want to get the ABI detection working correctly.

Normally the try_compile command deletes the small test project it creates.
It has a COPY_FILE option to first copy the built executable to some other
place before deleting the test build tree.  The --debug-trycompile option
tells it to not delete the test tree.

For some reason the ABI detection test build is not succeeding.  The errors
should be in CMakeError.log or CMakeOutput.log.  When --debug-trycompile
is off the executable simply doesn't exist and cannot be copied.  When it
is on then the executable from a *previous* try_compile happens to still
exist as it was not overwritten or deleted by the failed build.  Then the
COPY_FILE succeeds but is actually copying the wrong file.

The root of the problem is that this toolchain fails to build the test
executable.  Try building "CMakeCCompilerABI.c" from the CMake Modules
directory by hand using this compiler.

-Brad

-----Original Message-----
From: Alexander Neundorf [mailto:...-work at gmx.net] 
Sent: Freitag, 17. September 2010 19:34
To: cmake at cmake.org
Cc: Brad King; Molsen, Hannes
Subject: Re: [CMake] CMake 2.8.2 with WindRiver diab compiler dcc.exe/dplus.exe on WinXP: CMake Error: Could not COPY_FILE. while detecting compiler ABI

Please post your toolchain file.
Do you also have a VXWorks.cmake or are you using "Generic" ?
How you you set CMAKE_EXECUTABLE_SUFFIX ?
Is it empty ? Are the executables produced by the compiler then also without suffix ?

Alex
---
This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.

Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den Absender zurück und löschen Sie die E-mail aus Ihrem System.


More information about the CMake mailing list