MantisBT - CMake
View Issue Details
0012405CMakeModulespublic2011-08-17 05:162012-11-19 09:58
Florian Reinhard 
Alex Neundorf 
normalfeaturealways
closedfixed 
x64Windows7
CMake 2.8.5 
CMake 2.8.11CMake 2.8.11 
0012405: TI cl6x improovments
* use short options to be compatible with 6.x series (7.x provides gcc compilant flags)
* put <OBJECTS> in last place, otherwise a linker commandfile specified in <LINK_FLAGS> won't have any effect on them
* put <LINK_LIBRARIES> before <LINK_FLAGS>, same as above, libraries linked against and referenced in a command file would cause an error.


# -i, --search_path
# -l, --library=
# -I, --include_path
set(CMAKE_LIBRARY_PATH_FLAG "-i")
set(CMAKE_LINK_LIBRARY_FLAG "-l")
set(CMAKE_INCLUDE_FLAG_C "-I")
set(CMAKE_INCLUDE_FLAG_CXX "-I")
set(CMAKE_INCLUDE_FLAG_ASM "-I")

# -c, --compile_only
# -n, --skip_assembler
# -fa, --asm_file
# -fc, --c_file
# -fp, --cpp_file
# -fe, --output_file (compiler)
# -o, --output_file (linker)
# -ppo,--preproc_only
# -z, --run_linker
set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> -c --n -fc=<SOURCE> <DEFINES> <FLAGS> -fe=<ASSEMBLY_SOURCE>")
set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> -ppo -fc=<SOURCE> <DEFINES> <FLAGS> -fe=<PREPROCESSED_SOURCE>")

set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> -c -fc=<SOURCE> <DEFINES> <FLAGS> -fe=<OBJECT>")
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> -z -o <TARGET> <LINK_LIBRARIES> <LINK_FLAGS> <CMAKE_C_LINK_FLAGS> <OBJECTS>")

set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> -c --n -fp=<SOURCE> <DEFINES> <FLAGS> -fe=<ASSEMBLY_SOURCE>")
set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> -ppo -fp=<SOURCE> <DEFINES> <FLAGS> -fe=<PREPROCESSED_SOURCE>")

set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> -c -fp=<SOURCE> <DEFINES> <FLAGS> -fe=<OBJECT>")
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> -z --o <TARGET> <LINK_LIBRARIES> <LINK_FLAGS> <CMAKE_CXX_LINK_FLAGS> <OBJECTS>")

set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -c -fa=<SOURCE> <DEFINES> <FLAGS> -fe=<OBJECT>")
set(CMAKE_ASM_LINK_EXECUTABLE "<CMAKE_ASM_COMPILER> -z -o <TARGET> <CMAKE_ASM_LINK_FLAGS> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>")

set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm;s;abs)
No tags attached.
txt cmake-2.8-crash-log-abi.txt (117,247) 2012-01-09 05:13
https://public.kitware.com/Bug/file/4177/cmake-2.8-crash-log-abi.txt
Issue History
2011-08-17 05:16Florian ReinhardNew Issue
2011-08-17 07:06Florian ReinhardNote Added: 0027212
2011-08-17 12:29David ColeAssigned To => Alex Neundorf
2011-08-17 12:29David ColeStatusnew => assigned
2011-08-17 12:30David ColeNote Added: 0027222
2011-08-17 18:24Alex NeundorfNote Added: 0027224
2011-08-17 18:25Alex NeundorfNote Edited: 0027224bug_revision_view_page.php?bugnote_id=27224#r404
2011-09-22 04:52Florian ReinhardNote Added: 0027468
2011-09-23 06:15Florian ReinhardNote Added: 0027480
2011-10-04 16:14Alex NeundorfNote Added: 0027522
2011-10-07 11:06Florian ReinhardNote Added: 0027552
2012-01-04 16:10Alex NeundorfSeveritytweak => feature
2012-01-04 16:10Alex NeundorfCategoryDevelopment => Modules
2012-01-04 16:36Alex NeundorfNote Added: 0028182
2012-01-09 05:13Florian ReinhardFile Added: cmake-2.8-crash-log-abi.txt
2012-01-09 05:15Florian ReinhardNote Added: 0028216
2012-08-13 14:50Alex NeundorfNote Added: 0030579
2012-08-13 14:50Alex NeundorfTarget Version => CMake 2.8.10
2012-08-16 04:42Florian ReinhardNote Added: 0030685
2012-10-11 08:39kwtcNote Added: 0031215
2012-10-18 14:04Alex NeundorfNote Added: 0031276
2012-10-18 14:04Alex NeundorfTarget VersionCMake 2.8.10 => CMake 2.8.11
2012-11-04 09:53Alex NeundorfNote Added: 0031413
2012-11-04 10:21Alex NeundorfNote Added: 0031414
2012-11-05 15:22Alex NeundorfNote Added: 0031462
2012-11-17 14:27Alex NeundorfNote Added: 0031599
2012-11-17 14:27Alex NeundorfStatusassigned => closed
2012-11-17 14:27Alex NeundorfResolutionopen => fixed
2012-11-19 09:58David ColeFixed in Version => CMake 2.8.11

Notes
(0027212)
Florian Reinhard   
2011-08-17 07:06   
just noticed that this won't work either. i guess one would have to find out the version and have version specific lines.
(0027222)
David Cole   
2011-08-17 12:30   
Alex, is this referring to the branch that is currently sitting in the CMake stage repository, not yet merged to 'next' ... ? Or is it a different TI compiler than that one...?
(0027224)
Alex Neundorf   
2011-08-17 18:24   
(edited on: 2011-08-17 18:25)
Yes, the one in stage, not merged into next yet.
With the comments above it seems it will have to wait until after my vacation.

Alex

(0027468)
Florian Reinhard   
2011-09-22 04:52   
I'm sorry that i answer this late, but i've been on hollidays as well and one is usually quite busy afterwards ;)

i think to do things right here we'd need to separate support for the 6.x series and the 7.x compiler series. 7.x offers more GNU-like compiler options especially for the output of object files.
for 7.x you can directly specify path and name, for 6.x you can just specify the output directory and the extension it should have. This can be done for c, c++ and asm files separately.

So if we'd know about the compiler version i'd provide some "not that easy readable" commandline options for the 6.x series (no verbose options, just short) and we can keep the long ones for the 7.x series.

I've been using my cmake setup for over a month now and found some other glitches.

I do use -G"MinGW Makefiles" and that way cmake adds ranlib.exe for creating libraries / archives, therefore i added:
# prevent CMAKE from running ranlib.exe (mingw) on our libraries
UNSET (CMAKE_C_ARCHIVE_FINISH)
UNSET (CMAKE_CXX_ARCHIVE_FINISH)

as i wrote on the mailinglist cmake crashes with no useable backtrace (or maybe cl6x crashes?) when i don't add these:
SET (CMAKE_C_COMPILER_WORKS 1)
SET (CMAKE_CXX_COMPILER_WORKS 1)
#skip ABI checks
SET (CMAKE_DETERMINE_C_ABI_COMPILED 1)
SET (CMAKE_DETERMINE_CXX_ABI_COMPILED 1)
SET (CMAKE_DETERMINE_ASM_ABI_COMPILED 1)

all cmake options above are in my projects root CMakeLists.txt

Thank you,

Florian
(0027480)
Florian Reinhard   
2011-09-23 06:15   
here's some short regex to get the version of the CL6x compilers from the output of what is being done in CMakeDetermineCompilerId, EXECUTE_PROCESS, line 280.

SET(CMAKE_COMPILER_ID_VERSION_REGEX_TI_DSP "^TMS320C6x C/C\\+\\+ Compiler[ ]+v([0-9\\.]+).*")
STRING(REGEX REPLACE "${CMAKE_COMPILER_ID_VERSION_REGEX_TI_DSP}" "\\1"
     compiler_version "${output}")

could this be integrated and stored in a cmake variable so we can later choose different compiler options for different versions in TI_DSP-${lang}.cmake?
(0027522)
Alex Neundorf   
2011-10-04 16:14   
(...also back from vacation)

Hmm, so for 6.x it is not possible to specify the complete name of the resulting object file ?
That looks like a major problem.
Would it be good enough for you if cmake supported only version 7 and above ?

Alex
(0027552)
Florian Reinhard   
2011-10-07 11:06   
i just tried the unmodified cmake files from the staging repo on 6.1.19 and they do work, even though not documented or available by cl6x -h.

about the crash upon the ABI stuff:
Can cmake parse COFF binaries? The compiler does not create out files/binaries in ELF format.

besides the disabling of the ABI check i also do the following to create non-shared libraries:
SET (CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -r <TARGET> <OBJECTS>")
SET (CMAKE_CXX_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE})

so here's what i see what needs to be done:
* disable ABI checks (couldn't create a useable backtrace with mingw on win7)
* get rid of ranlib
* add --map_file=<TARGET>.map to CMAKE_?_LINK_EXECUTEABLE (cl6x users are embedded developers and they mostlikely want to see the memory map file)
* change the order of the linker options so it finally looks like this:
"<CMAKE_C_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_C_LINK_FLAGS> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>"
(0028182)
Alex Neundorf   
2012-01-04 16:36   
I created a CMake repository on github with a branch TI_DSP_Compiler:
https://github.com/neundorf/CMake/tree/TI_DSP_Compiler [^]

It has the changes from your last comment here.
Can you please try and see if it works, also without disabling the compiler ID and ABI checks ?
It would be really good if you could produce a usaful backtrace.

If it crashes, please post the logging output from cmake here.
Maybe also run cmake with the --trace option, and attach the produced file here, this should show in which line of cmake code exactly it crashed.

Thanks
Alex
(0028216)
Florian Reinhard   
2012-01-09 05:15   
For the trace file i just attached i disabled the following lines from my cmake project:
SET (CMAKE_DETERMINE_C_ABI_COMPILED 1)
SET (CMAKE_DETERMINE_CXX_ABI_COMPILED 1)
SET (CMAKE_DETERMINE_ASM_ABI_COMPILED 1)

is ranlib disabled with the changes you did?
(0030579)
Alex Neundorf   
2012-08-13 14:50   
I'll try to get either this one or 0012614 in 2.8.10 , but can't guarantee which one.
(0030685)
Florian Reinhard   
2012-08-16 04:42   
Thx for the update, if you need testing on Win7 x64 let me know. unfortunately i can't test on linux since our project doesn't build due to lazy programmers ignoring case-sensitivity of includes (any script that corrects this is appreciated ;) ), correcting this by hand is a whole-day job...
(0031215)
kwtc   
2012-10-11 08:39   
I have imported in my installed copy of cmake 2.8.7 the three files commited in the TI_DSP_Compiler branch and I set CMAKE_C_COMPILER to 'cl6x' executable in a toolchain file.

It worked perfectly, enabling me to use cmake to target the C6740 DSP using the compiler from Texas, under Ubuntu 12.04 64 bits.

Thanks !
(0031276)
Alex Neundorf   
2012-10-18 14:04   
It's a bit late now for 2.8.10, but I'll work on it in the next days so it'll be in 2.8.11.
(0031413)
Alex Neundorf   
2012-11-04 09:53   
This is now in the TI_DSP_Compiler branch on cmake stage, and I'll merge it into next soon, so it'll be in 2.8.11.

I downloaded the TI compiler more than a year ago. Now I went back to the TI website, and was quite confused which package I have to download to just get the compiler.
Do I need the Code Composer Studio ? Or the Linux SDK ?
(0031414)
Alex Neundorf   
2012-11-04 10:21   
kwtc: can you please give the TI_DSP_Compiler branch on cmake stage a try and let me know how it works ?
(0031462)
Alex Neundorf   
2012-11-05 15:22   
I merged this now into the "next" branch, so it should be part of cmake 2.8.11.
Please give it a try.
(0031599)
Alex Neundorf   
2012-11-17 14:27   
This is now in cmake master.
If something doesn't work, please open a separate bug report for it.