MantisBT - CMake
View Issue Details
0013280CMakeCMakepublic2012-06-07 15:442013-03-04 08:38
Alex Herrmann 
 
lowmajoralways
closedunable to reproduce 
LinuxUbuntu12.04
CMake 2.8.7 
 
0013280: CMake does not detect multi-arch library architecture from hand-built gcc 4.7
Hello, I just built gcc-4.7 in my /opt/ directory, and I would like to cmake to compile using those binaries. However, whenever I specify the C and CXX compiler with -D or set() commands, it always complains about it not being able to find anything.
Specify CMAKE_C_COMPILER and CMAKE_CXX_COMPILER, and try to find() something. More specifically for me include(FindPNG) or include(FindJPEG), nothing like this works.
I have a feeling this isn't a bug, and I've tried setting just about variable I can think to right this, but until this is fixed, my software is much less portable.
No tags attached.
related to 0012037closed Brad King support multiarch lib paths for Debian/Ubuntu 
gz build.tar.gz (1,075) 2012-06-15 13:34
https://public.kitware.com/Bug/file/4356/build.tar.gz
gz cmakebuild.tar.gz (15,448) 2012-06-16 14:36
https://public.kitware.com/Bug/file/4358/cmakebuild.tar.gz
Issue History
2012-06-07 15:44Alex HerrmannNew Issue
2012-06-07 17:06Brad KingNote Added: 0029640
2012-06-07 17:51Alex HerrmannNote Added: 0029641
2012-06-08 08:02Brad KingNote Added: 0029645
2012-06-08 16:23Alex HerrmannNote Added: 0029655
2012-06-11 09:02Brad KingNote Added: 0029658
2012-06-13 17:40Alex HerrmannNote Added: 0029691
2012-06-13 17:40Alex HerrmannNote Deleted: 0029691
2012-06-15 13:34Alex HerrmannFile Added: build.tar.gz
2012-06-15 13:35Alex HerrmannNote Added: 0029706
2012-06-15 13:49Brad KingNote Added: 0029707
2012-06-16 14:36Alex HerrmannFile Added: cmakebuild.tar.gz
2012-06-16 14:36Alex HerrmannNote Added: 0029710
2012-06-16 14:37Alex HerrmannNote Edited: 0029710bug_revision_view_page.php?bugnote_id=29710#r680
2012-06-18 08:12Brad KingNote Added: 0029714
2012-06-18 08:13Brad KingSummarysetting CMAKE_C_COMPILER and CMAKE_CXX_COMPILER breaks find_package => CMake does not detect multi-arch library architecture from hand-built gcc 4.7
2012-06-18 08:14Brad KingRelationship addedrelated to 0012037
2012-06-18 18:07Alex HerrmannNote Added: 0029736
2012-06-19 09:06Brad KingNote Added: 0029741
2012-06-19 09:06Brad KingStatusnew => resolved
2012-06-19 09:06Brad KingResolutionopen => unable to reproduce
2013-03-04 08:38Robert MaynardNote Added: 0032437
2013-03-04 08:38Robert MaynardStatusresolved => closed

Notes
(0029640)
Brad King   
2012-06-07 17:06   
What is your full cmake command line and what is its full output?

If ABI detection fails then CMake does not know where to search in Ubuntu's multi-arch /usr/lib/<arch> layout. Look at CMakeFiles/CMakeError.log for details on why it fails.
(0029641)
Alex Herrmann   
2012-06-07 17:51   
It doesn't error out, the cmake file has a check for the _FOUND variable, and gracefully selects included source for the libraries, but I would like to use system libraries. But in LLVM, it does the same thing, but once it starts building it complains about not being able to find files which are obviously there. Is there a variable to skip ABI checks?
(0029645)
Brad King   
2012-06-08 08:02   
Phrases like "complains about it not being able to find anything" and "not being able to find files which are obviously there" are far too general to help us diagnose the problem. We really need to see the full cmake command line you're running and its output, please.
(0029655)
Alex Herrmann   
2012-06-08 16:23   
here is the output with cmake .. &> normal.log :
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found ZLIB: /usr/lib/i386-linux-gnu/libz.so (found version "1.2.3.4")
-- Boost version: 1.49.0
-- Found the following Boost libraries:
-- iostreams
-- Configuring done
-- Generating done
-- Build files have been written to: /home/alex/repo/mine/herrmanncode/codez/c++/boosty/build

here it is with cmake ../ -DCMAKE_C_COMPILER=/opt/gcc-4.7/bin/gcc -DCMAKE_CXX_COMPILER=/opt/gcc-4.7/bin/g++ &> mycompiler.log :

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /opt/gcc-4.7/bin/gcc
-- Check for working C compiler: /opt/gcc-4.7/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /opt/gcc-4.7/bin/g++
-- Check for working CXX compiler: /opt/gcc-4.7/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.3.4")
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindZLIB.cmake:85 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:4 (find_package)


-- Configuring incomplete, errors occurred!
(0029658)
Brad King   
2012-06-11 09:02   
Thanks. Please also attach a tarball of the CMakeFiles subdirectory from the top of the build tree in the case that fails.
(0029706)
Alex Herrmann   
2012-06-15 13:35   
Alright, It's up, you just need to specify your own compiler. I did build gcc-4.7 with some wierd multi-arch stuff, would that change anything?
(0029707)
Brad King   
2012-06-15 13:49   
Re 0013280:0029706: Thanks for the minimal source tree, but that is not what I asked for. If you create a build tree in a fresh directory using this source tree, there will be a subdirectory created named literally "CMakeFiles". That directory is what I'd like to see in a tarball.
(0029710)
Alex Herrmann   
2012-06-16 14:36   
(edited on: 2012-06-16 14:37)
There you go, sorry about the confusion (I'm kind of a CMake Noob). At least CMake is easy to learn & use!

(0029714)
Brad King   
2012-06-18 08:12   
Re 0013280:0029710: Thanks. The CMakeFiles/CMakeOutput.log contains a section headed "Detecting C compiler ABI info compiled with the following output" and below that information about the options the compiler front-end passes to the linker under the hood. The results are reported in CMakeFiles/CMakeCCompiler.cmake, and yours has:

  SET(CMAKE_LIBRARY_ARCHITECTURE "")
  SET(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/opt/gcc-4.7/lib/gcc/i686-pc-linux-gnu/4.7.0;/opt/gcc-4.7/lib")

On multi-arch systems CMake depends on the implicit link directories to detect the library architecture. None of the directories configured for this compiler refers to any "/usr/lib/<arch>" so CMake fails to detect the library architecture in use. Once that fails it has no way to know where to look for libraries that match the target architecture.

How was this gcc 4.7 built?
(0029736)
Alex Herrmann   
2012-06-18 18:07   
It originally didn't build because of the Multi-Arch stuff, because of the way it was layed out, It couldn't find the include files it needed for the build, so being the super smart guy I am, I just said: "well hey! why not symlink i386-linux-gnu to i686-linux-gnu" I should't run in to any problems right? wrong...... That's probably the reason I'm screwed up right now huh?
(0029741)
Brad King   
2012-06-19 09:06   
Re 0013280:0029736: I suspect adding the symlink only covered up one symptom of an incorrectly configured compiler installation. Please visit an Ubuntu, GCC, or other appropriate mailing list for help installing gcc 4.7 on a multiarch system.
(0032437)
Robert Maynard   
2013-03-04 08:38   
Closing resolved issues that have not been updated in more than 4 months.