View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013149CMakeCMakepublic2012-04-19 08:322013-01-09 10:55
ReporterJim Hague 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformPowerPCOSAIXOS Version5.2
Product VersionCMake 2.8.7 
Target VersionCMake 2.8.9Fixed in VersionCMake 2.8.9 
Summary0013149: cmTryCompileExec fails on AIX 5.2
Descriptionbootstrap; gmake works (given compile issues as per Issue 13148).

Atempting to build the Example fails with a link command error in cmTryCompileExec. This is true whether gcc or xlc is used.
Steps To ReproduceBuild cmake on AIX 5.2. Then:

$ cd Example
$ ../bin/cmake -G "Unix Makefiles"
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- broken
CMake Error at /home/jim/work/src/cmake-2.8.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
  The C compiler "/usr/bin/gcc" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /home/jim/work/src/cmake-2.8.8/Example/CMakeFiles/CMakeTmp

  

  Run Build Command:/usr/bin/gmake "cmTryCompileExec2449469290/fast"

  /usr/bin/gmake -f CMakeFiles/cmTryCompileExec2449469290.dir/build.make
  CMakeFiles/cmTryCompileExec2449469290.dir/build

  gmake[1]: Entering directory
  `/home/jim/work/src/cmake-2.8.8/Example/CMakeFiles/CMakeTmp'

  /home/jim/work/src/cmake-2.8.8/bin/cmake -E cmake_progress_report
  /home/jim/work/src/cmake-2.8.8/Example/CMakeFiles/CMakeTmp/CMakeFiles 1

  Building C object
  CMakeFiles/cmTryCompileExec2449469290.dir/testCCompiler.c.o

  /usr/bin/gcc -o CMakeFiles/cmTryCompileExec2449469290.dir/testCCompiler.c.o
  -c
  /home/jim/work/src/cmake-2.8.8/Example/CMakeFiles/CMakeTmp/testCCompiler.c

  Linking C executable cmTryCompileExec2449469290

  /home/jim/work/src/cmake-2.8.8/bin/cmake -E cmake_link_script
  CMakeFiles/cmTryCompileExec2449469290.dir/link.txt --verbose=1

  /usr/bin/gcc CMakeFiles/cmTryCompileExec2449469290.dir/testCCompiler.c.o -o
  cmTryCompileExec2449469290 /usr/lib /lib

  ld: 0711-168 SEVERE ERROR: Input file: /usr/lib

        Input files must be regular files.

  collect2: ld returned 12 exit status

  gmake[1]: *** [cmTryCompileExec2449469290] Error 1

  gmake[1]: Leaving directory
  `/home/jim/work/src/cmake-2.8.8/Example/CMakeFiles/CMakeTmp'

  gmake: *** [cmTryCompileExec2449469290/fast] Error 2
Additional InformationThis failure happens on 2.8.7 and 2.8.8. 2.6.4 works fine.

link.txt for the failing gcc on 5.8.8 is:

/usr/bin/gcc CMakeFiles/cmTryCompileExec732778660.dir/testCCompiler.c.o -o cmTryCompileExec732778660 /usr/lib /lib

On 5.6.4 for the successful g++ is:

/usr/bin/g++ CMakeFiles/cmTryCompileExec.dir/CMakeCXXCompilerABI.cpp.o -o cmTryCompileExec -Wl,-brtl,-bnoipath,-bexpall -Wl,-blibpath:/usr/lib:/lib
TagsNo tags attached.
Attached Files

 Relationships
duplicate of 0012420closedBrad King CMake fails to identify the compiler 

  Notes
(0029239)
Brad King (manager)
2012-04-19 09:04

This output shows that CMake doesn't know the toolchain in use:

 -- The C compiler identification is unknown
 -- The CXX compiler identification is unknown

so it is not generating proper flags. Please attach the CMakeFiles/CMakeError.log file. It has details about why the compiler id failed.
(0029247)
Jim Hague (reporter)
2012-04-19 09:58

Here's the start of CMakeError.log:


Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /usr/bin/gcc
Build flags:
Id flags:

The output was:
1
CMakeCCompilerId.c:1: error: parse error before '__cplusplus'
CMakeCCompilerId.c:2:3: error: #error "A C++ compiler has been selected for C."
CMakeCCompilerId.c:3:2: error: #endif without #if
CMakeCCompilerId.c:183: error: syntax error before 'char'
CMakeCCompilerId.c:185: error: parse error before 'known'
CMakeCCompilerId.c: In function 'main':
CMakeCCompilerId.c:353: error: 'info_version' undeclared (first use in this func
tion)
CMakeCCompilerId.c:353: error: (Each undeclared identifier is reported only once
CMakeCCompilerId.c:353: error: for each function it appears in.)

And here's the start of CMakeCCompilerId.c:

ifdef __cplusplus
# error "A C++ compiler has been selected for C."
#endif

/* Version number components: V=Version, R=Revision, P=Patch
   Version date components: YYYY=Year, MM=Month, DD=Day */

#if defined(__18CXX)
# define ID_VOID_MAIN
#endif

Note the missing initial '#'. It is present in the .in. This looks like the same issue as 12420.
(0029250)
Brad King (manager)
2012-04-19 10:26

Issue 0012420 proposes addition of random-seeming characters at various points in the file and says they magically fix configuration of the .c and .cpp test files. I'd like to identify the real problem with generation of the files.

They are created here:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeDetermineCompilerId.cmake;hb=v2.8.8#l77 [^]

The implementation works everywhere we test on our dashboard. Something goes wrong with the file(READ) and/or string(CONFIGURE) and/or file(WRITE). I've never had access to a machine where I can reproduce it. Can you add some message() statements in there to debug it?
(0029262)
Jim Hague (reporter)
2012-04-19 14:09

This is a xlC 6.0 bug.

In cmFileCommand::HandleReadCommand(), if you replace

file.seekg(offset);

with either
if ( offset )
  file.seekg(offset);

or

file.seekg(offset, std::ios_base::beg);

then compiler detection works. Otherwise it seems that file.seekg(0) will, in some circumstances, cause the next file.getline() to omit the first character it reads. I've not been able to distill this to a short example.

I guess I could also try compiling cmake with GCC. I'm not sure how to instruct bootstrap to do that, though.
(0029263)
Brad King (manager)
2012-04-19 14:17

Re 0013149:0029262: Thanks for debugging that. I'll look at adjusting HandleReadCommand to avoid that bug.

Meanwhile, you can test bootstrapping with GCC like this:

 bash$ CC=gcc CXX=g++ ./bootstrap
(0029264)
Brad King (manager)
2012-04-19 14:29

I've applied the seekg fix you suggested:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b3c77889 [^]

Thanks!
(0032024)
Robert Maynard (manager)
2013-01-09 10:55

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

 Issue History
Date Modified Username Field Change
2012-04-19 08:32 Jim Hague New Issue
2012-04-19 09:04 Brad King Note Added: 0029239
2012-04-19 09:58 Jim Hague Note Added: 0029247
2012-04-19 10:16 Brad King Relationship added duplicate of 0012420
2012-04-19 10:26 Brad King Note Added: 0029250
2012-04-19 14:09 Jim Hague Note Added: 0029262
2012-04-19 14:17 Brad King Note Added: 0029263
2012-04-19 14:29 Brad King Note Added: 0029264
2012-04-19 14:31 Brad King Status new => resolved
2012-04-19 14:31 Brad King Fixed in Version => CMake 2.8.9
2012-04-19 14:31 Brad King Resolution open => fixed
2012-04-19 14:31 Brad King Assigned To => Brad King
2012-08-09 17:49 David Cole Target Version => CMake 2.8.9
2013-01-09 10:55 Robert Maynard Note Added: 0032024
2013-01-09 10:55 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team