View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014877CMakeCMakepublic2014-04-15 09:482014-10-06 10:33
Reporterraspy 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionduplicate 
Platformx86_64OSRedHat Enterprise LinuxOS Version6.4
Product VersionCMake 2.8.12.2 
Target VersionFixed in Version 
Summary0014877: TI toolchain should not call ranlib
DescriptionCurrently building static libraries with TI toolchain ends with ranlib call which apparently does something with the libraries because the linker complains:

...
Linking C static library libfoo.a
/path/to/CMake/2.8.12.2/linux/i386/bin/cmake -P CMakeFiles/foo.dir/cmake_clean_target.cmake
/path/to/CMake/2.8.12.2/linux/i386/bin/cmake -E cmake_link_script CMakeFiles/foo.dir/link.txt --verbose=1
/path/to/ar6x -r libfoo.a CMakeFiles/foo.dir/src/foo.c.obj
  ==> new archive 'libfoo.a'
  ==> building archive 'libfoo.a'
/usr/bin/ranlib libfoo.a
...
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 libfoo.a CMakeFiles/hello.dir/src/hello.c.obj
<Linking>
warning: archive symbol directory is missing from archive "libfoo.a"

I suggest to set up in TI-C.cmake the following:

set(CMAKE_C_ARCHIVE_FINISH)

to clean up call to ranlib on finishing archive.

I would also suggest to either set CMAKE_C_ARCHIVE_APPEND to ${CMAKE_C_ARCHIVE_CREATE}. Currently, since CMAKE_C_ARCHIVE_CREATE is declared explicitly in TI toolchain support, but CMAKE_C_ARCHIVE_APPEND is inherited from CMakeCInformation, it looks inconsistent:

/vob/tetra/tools/CMake/2.8.12.2/linux/i386/share/cmake-2.8/Modules/Compiler/TI-C.cmake(9): set(CMAKE_C_ARCHIVE_CREATE <CMAKE_AR> -r <TARGET> <OBJECTS> )
/vob/tetra/tools/CMake/2.8.12.2/linux/i386/share/cmake-2.8/Modules/CMakeCInformation.cmake(181): set(CMAKE_C_ARCHIVE_APPEND <CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS> )

Similar update should also be performed in TI-CXX.cmake.
Steps To Reproduce$ cat CMakeLists.txt
cmake_minimum_required(VERSION 2.8.12.2 FATAL_ERROR)
project(hello C)
# Enable/disable following to observe the issue
set(CMAKE_C_ARCHIVE_FINISH)
add_library(foo src/foo.c)
add_executable(hello src/hello.c)
target_link_libraries(hello foo)
set_target_properties(hello PROPERTIES LINKER_LANGUAGE C)

$ cat src/foo.c
void foo(void)
{
}

$ cat src/hello.c
void foo(void);

int main(int argc, char *argv[])
{
    foo();
    return 0;
}

$ /path/to/cmake -DCMAKE_C_COMPILER=/path/to/cl6x -DCMAKE_SYSTEM_NAME=Generic .

$ make

Observe that in case that CMAKE_C_ARCHIVE_FINISH is not redefined, ranlib is run and then linker complains:
warning: archive symbol directory is missing from archive "libfoo.a"
TagsNo tags attached.
Attached Files

 Relationships
related to 0014876closedKitware Robot Improve support for TI compiler 

  Notes
(0035710)
Brad King (manager)
2014-04-15 09:58

Since CMake does not currently contain platform information files for TI these are not individual bugs. Please keep discussion in 0014876.
(0036975)
Robert Maynard (manager)
2014-10-06 10:33

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-04-15 09:48 raspy New Issue
2014-04-15 09:57 Brad King Relationship added related to 0014876
2014-04-15 09:58 Brad King Note Added: 0035710
2014-04-15 09:58 Brad King Status new => resolved
2014-04-15 09:58 Brad King Resolution open => duplicate
2014-10-06 10:33 Robert Maynard Note Added: 0036975
2014-10-06 10:33 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team