View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014876CMakeCMakepublic2014-04-15 08:322016-06-10 14:31
Reporterraspy 
Assigned ToKitware Robot 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionmoved 
Platformx86_64OSRedHat Enterprise LinuxOS Version6.4
Product VersionCMake 2.8.12.2 
Target VersionFixed in Version 
Summary0014876: Improve support for TI compiler
DescriptionI use a custom compilation command, which requires to use OBJECT_DIR, like this:

SET(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -fr=<OBJECT_DIR> <SOURCE>")

<OBJECT_DIR> used to be set up correctly using CMake 2.8.10.2, i.e.:

[ 0%] Building C object libs/acelp/CMakeFiles/acelp.dir/src/acelp.obj
cd /path/to/libs/acelp && /path/to/cl6x --gcc -o3 -DNDEBUG -I/path/to/acelp -I/path/to/include -I/path/to/acelp/inc --display_error_number -pdsr230 -pdsr14 -pdsw225 -pc -mv6740 --preinclude=sw_model.h -o3 -pm -fr=CMakeFiles/acelp.dir/src /path/to/acelp/src/acelp.c

However, after upgrade to CMake 2.8.12.2 it seems that OBJECT_DIR is missing directory of the source file which is beneath ${CMAKE_CURRENT_SOURCE_DIR}:

[ 0%] Building C object libs/acelp/CMakeFiles/acelp.dir/src/acelp.obj
cd /path/to/libs/acelp && /path/to/cl6x --gcc -o3 -DNDEBUG --include_path=/path/to/acelp --include_path=/path/to/include --include_path=/path/to/acelp/inc --display_error_number -pdsr230 -pdsr14 -pdsw225 -pc -mv6740 --preinclude=sw_model.h -o3 -pm -fr=CMakeFiles/acelp.dir /path/to/acelp/src/acelp.c

Note that -fr option is now missing /src part, which makes object file created as libs/acelp/CMakeFiles/acelp.dir/acelp.obj instead of libs/acelp/CMakeFiles/acelp.dir/src/acelp.obj and linking then fails due to not found objects.
Steps To ReproduceCreate a custom compilation rule which uses <OBJECT_DIR> and a source file in subdirectory:

$ cat CMakeLists.txt
project(hello C)
set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -fr=<OBJECT_DIR> <SOURCE>")
add_executable(hello src/hello.c)

$ cat src/hello.c
int main(int argc, char *argv[])
{
    return 0;
}

Configure project with TI's cl6x compiler:

$ /path/to/CMake/2.8.12.2/linux/i386/bin/cmake -DCMAKE_C_COMPILER=/path/to/cl6x .

Run compilation:

$ make VERBOSE=1
...
[100%] Building C object CMakeFiles/hello.dir/src/hello.c.o
/path/to/cl6x -fr=CMakeFiles/hello.dir /path/to/src/hello.c
Linking C executable hello
/path/to/CMake/2.8.12.2/linux/i386/bin/cmake -E cmake_link_script CMakeFiles/hello.dir/link.txt --verbose=1
/path/to/cl6x --run_linker --output_file=hello --map_file=hello.map CMakeFiles/hello.dir/src/hello.c.o
<Linking>
"/tmp/08605AX1MaL", line 6: error: cannot find file
   "CMakeFiles/hello.dir/src/hello.c.o"
fatal error: no input files

TagsNo tags attached.
Attached Files

 Relationships
related to 0014667closedBrad King MSVC compiler PDB change breaks PCH support (with minimal testcase) 
related to 0014877closed TI toolchain should not call ranlib 
related to 0014878closed TI toolchain should follow TI's library naming convention 
related to 0014879closed Use short switches for TI toolchain 
related to 0014880closed TI ASM rule should not use --asm_file switch 
related to 0014881closed Older versions of TI compilers do not support --output_file 

  Notes
(0035704)
Brad King (manager)
2014-04-15 08:46

This was due to the fix to 0014667, see 0014667:0034856.
(0035705)
Brad King (manager)
2014-04-15 08:48

The compile rule variables and their placeholders are internal implementation details for which no documented guarantee is made.
(0035706)
Brad King (manager)
2014-04-15 08:59

The TI compiler documentation:

 http://www.ti.com/lit/ug/spru187o/spru187o.pdf [^]

shows the -fr option to set the object file output directory but does not appear to have an option to specify the name of the object file itself. Therefore we need a dedicated placeholder like "<OBJECT_FILE_DIR>" whose purpose is to specify the directory of the current compile command object file.
(0035711)
Brad King (manager)
2014-04-15 09:59

For reference, adding support for TI will also require handling the problems reported in 0014877 and 0014878.
(0035712)
Brad King (manager)
2014-04-15 10:01

CMake already knows how to detect the "TI" compiler id and version:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeCCompilerId.c.in;hb=v3.0.0-rc3#l132 [^]

We will need new platform information modules of the form:

 Modules/Compiler/TI-<lang>.cmake
 Modules/Platform/<os>-TI-<lang>.cmake
(0035713)
Brad King (manager)
2014-04-15 10:05

Actually it looks like we already have Compiler/TI-<lang>.cmake:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Compiler/TI-C.cmake;hb=v3.0.0-rc3 [^]
 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Compiler/TI-CXX.cmake;hb=v3.0.0-rc3 [^]
 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Compiler/TI-ASM.cmake;hb=v3.0.0-rc3 [^]

They use --output_file=<OBJECT> to specify the object location in the compile rule.

Likely we will need just

 Platform/Linux-TI-<lang>.cmake

modules to fix issues like running ranlib.
(0035715)
Brad King (manager)
2014-04-15 10:36

Re 0014876:0035711: And 0014879. Please stop submitting separate issues.
(0035716)
Brad King (manager)
2014-04-15 10:37

If you rewrite/add the

 Modules/Compiler/TI-<lang>.cmake
 Modules/Platform/<os>-TI-<lang>.cmake

modules to work the way you want then please attach them here for consideration.
(0035718)
raspy (reporter)
2014-04-15 10:51

Sorry for separate issues, I was pretty sure you would like to track them separately. It wasn't until I finished submitting that I read your comment here.
(0035719)
raspy (reporter)
2014-04-15 10:52

Please also link 14881 to this one. I can submit later my proposed patches if you would like to consider.
(0035720)
Brad King (manager)
2014-04-15 10:55

Re 0014876:0035718: Okay. Separate issues make sense for unrelated bugs against mature features. Here you are asking for TI compiler support to have a major overhaul. That is new development and likely a single or small number of commits will update the platform information modules to resolve all problems at once.
(0035726)
raspy (reporter)
2014-04-16 10:44

Got two more issues:

1. Linker command creates mapfile, which is good, but this mapfile is not cleaned up on make clean.
2. Linker command specifies libraries before objects, which is wrong.
(0036116)
hume npx (reporter)
2014-06-03 23:02

There is a similar problem in my erlang module, because erlc -o option only accepts directory and not full object path, so the OBJECT_FILE_DIR is a requirement to support erlang modules, or maybe OBJECTS_DIR while not OBJECT_DIR is most close to semantics after the changes?
(0036123)
Brad King (manager)
2014-06-05 09:08

Re 0014876:0036116: I just implemented OBJECT_FILE_DIR here:

 Add OBJECT_FILE_DIR rule placeholder for compilation lines
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8256ccb7 [^]
(0037990)
nurF (reporter)
2015-02-18 03:51
edited on: 2015-02-18 04:54

The issue http://public.kitware.com/Bug/view.php?id=14880 [^] still persists.
However it might be the case that the TI assembler cannot determine if its normal assembly or linear assembly file, then the problem will occur again.

Therefore I propose to add a new ASM dialect and keep TI-ASM as is.
Create 'ASM_TI' and change the parameter as suggested by raspy.
Then I have still the possibility to use "set_source_files_properties" with LANGUAGE "ASM_TI".

I actually could compile the linear assembly adding a new dialect using the guide from http://www.cmake.org/Wiki/CMake/Assembler. [^]

(0042534)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2014-04-15 08:32 raspy New Issue
2014-04-15 08:45 Brad King Relationship added related to 0014667
2014-04-15 08:46 Brad King Note Added: 0035704
2014-04-15 08:48 Brad King Note Added: 0035705
2014-04-15 08:59 Brad King Note Added: 0035706
2014-04-15 08:59 Brad King Severity major => feature
2014-04-15 08:59 Brad King Summary <OBJECT_DIR> not set correctly after upgrade to CMake 2.8.12.2 => Add support for TI compiler command lines
2014-04-15 09:57 Brad King Relationship added related to 0014877
2014-04-15 09:57 Brad King Relationship added related to 0014878
2014-04-15 09:59 Brad King Note Added: 0035711
2014-04-15 10:01 Brad King Note Added: 0035712
2014-04-15 10:05 Brad King Note Added: 0035713
2014-04-15 10:06 Brad King Status new => backlog
2014-04-15 10:06 Brad King Summary Add support for TI compiler command lines => Improve support for TI compiler
2014-04-15 10:35 Brad King Relationship added related to 0014879
2014-04-15 10:36 Brad King Note Added: 0035715
2014-04-15 10:37 Brad King Note Added: 0035716
2014-04-15 10:40 Brad King Relationship added related to 0014880
2014-04-15 10:51 raspy Note Added: 0035718
2014-04-15 10:52 raspy Note Added: 0035719
2014-04-15 10:55 Brad King Note Added: 0035720
2014-04-15 10:55 Brad King Relationship added related to 0014881
2014-04-16 10:44 raspy Note Added: 0035726
2014-06-03 23:02 hume npx Note Added: 0036116
2014-06-05 09:08 Brad King Note Added: 0036123
2015-02-18 03:51 nurF Note Added: 0037990
2015-02-18 04:54 nurF Note Edited: 0037990
2016-06-10 14:29 Kitware Robot Note Added: 0042534
2016-06-10 14:29 Kitware Robot Status backlog => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team