Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 348663 - gcc-config messes up cmake
Summary: gcc-config messes up cmake
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-13 22:47 UTC by Chris Bruner
Modified: 2010-12-14 16:05 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Bruner 2010-12-13 22:47:17 UTC
My gcc-config is as follows
gcc-config -l
 [1] arm-elf-4.3.4 *

 [2] x86_64-pc-linux-gnu-3.4.6 
 [3] x86_64-pc-linux-gnu-3.4.6-hardened
 [4] x86_64-pc-linux-gnu-3.4.6-hardenednopie
 [5] x86_64-pc-linux-gnu-3.4.6-hardenednopiessp
 [6] x86_64-pc-linux-gnu-3.4.6-hardenednossp
 [7] x86_64-pc-linux-gnu-4.4.5
 [8] x86_64-pc-linux-gnu-4.5.1 *

I have to be able to compile for an external system and will set the gcc-config to be like:
gcc-config -l
 [1] arm-elf-4.3.4 *

 [2] x86_64-pc-linux-gnu-3.4.6 *
 [3] x86_64-pc-linux-gnu-3.4.6-hardened
 [4] x86_64-pc-linux-gnu-3.4.6-hardenednopie
 [5] x86_64-pc-linux-gnu-3.4.6-hardenednopiessp
 [6] x86_64-pc-linux-gnu-3.4.6-hardenednossp
 [7] x86_64-pc-linux-gnu-4.4.5
 [8] x86_64-pc-linux-gnu-4.5.1

make works fine for this, but cmake returns
/usr/bin/cmake: /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/bin/cmake)
/usr/bin/cmake: /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /usr/bin/cmake)


emerging cmake with -static doesn't make a difference.


Reproducible: Always

Steps to Reproduce:
1.sudo gcc-config 2   (in my case to switch to an older compiler)
2.make project         (project created using cmake)
3.see error
Comment 1 Chris Bruner 2010-12-13 23:25:21 UTC
an even easier test case.
gcc_config 2 (or whatever you need to switch to an older compiler)
cmake  
error appears.
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2010-12-14 01:40:56 UTC
What if you forgot about changing the system compiler and just ran:
# eval $(gcc-config -E 2)

instead?
Comment 3 Chris Bruner 2010-12-14 08:14:33 UTC
I don't follow how using eval $(gcc-config -E 2)
on a makefile that uses cmake is going to help this.  Could you explain further please?

Does your system have the 3.4.6 compiler on it? 
I find that I can't even build cmake with this older compiler.

I've also found other programs have a hard time with it. (MPlayer for instance).  I thought gcc-config was only to switch which compiler and libraries the were to be used in compiling and linking. 

Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2010-12-14 16:05:14 UTC
(In reply to comment #3)
> I don't follow how using eval $(gcc-config -E 2)
> on a makefile that uses cmake is going to help this.  Could you explain further
> please?

Setting `gcc-config 2' sets your system compiler, and it seems that this isn't what you wanted to do: you appear to try to use a different compiler for a specific purpose in a specific shell. Your Steps To Reproduce in the Description do not mention setting the system compiler (`gcc-config 2') and then executing `source /etc/profile', which is the second required step if you're going to run make from the command line to build a package.

However, running `eval $(gcc-config -E 2) in a shell will give you the correct paths to the compiler you chose, just in that shell, immediately, without switching all kinds of symlinks that changing the system compiler would entail.

Running gcc-config without options would give you this information:

Usage: gcc-config [options] [CC Profile]
Change the current cc/gcc profile, or give info about profiles.

Options:
  -C, --nocolor              Disable color output
  -O, --use-old              Use the old profile if one was selected.
  -f, --force                Make sure all config files are regenerated.
  -P, --use-portage-chost    Only set to given profile if its CHOST is the
                             same as that set for portage in /etc/make.conf
                             (or one of other portage config files...).
  -c, --get-current-profile  Print current used gcc profile.
  -l, --list-profiles        Print a list of available profiles.
  -S, --split-profile        Split profiles into their components
  -E, --print-environ        Print environment that can be used to setup the
                             current gcc profile, or a specified one.
  -B, --get-bin-path         Print path where binaries of the given/current
                             profile are located.
  -L, --get-lib-path         Print path where libraries of the given/current
                             profile are located.
  -X, --get-stdcxx-incdir    Print path where g++ include files of the
                             given/current profile are located.

Profile names are of the form:  <CHOST>-<gcc version>
For example:                    i686-pc-linux-gnu-3.2.1

If you need more support, try our forums at <http://forums.gentoo.org/> or our IRC channel at <irc://chat.freenode.net/#gentoo>. If you then find a real bug, instead of a mere puzzle, feel free to report a new bug.