Topic: Updating gcc on Ubuntu 12.04 LTS

GunChleoc
Avatar
Topic Opener
Joined: 2013-10-07, 15:56 UTC+2.0
Posts: 3317
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2014-03-04, 11:01 UTC+1.0

I need to update my gcc so I can compile the new functions in trunk. I have run this:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.7 c++-4.7

Still no joy. I suspect that somehow the old gcc is still being used. Any ideas?


Busy indexing nil values

Top Quote
QCS

Joined: 2009-12-29, 22:47 UTC+1.0
Posts: 256
Ranking
Tribe Member
Posted at: 2014-03-04, 11:20 UTC+1.0

Yes, g++-4.6 is still installed and can not be uninstalled without losing vital stuff like build-essential.

So you have g++-4.6 as default, and g++-4.7 additionally, on your system.

To use it with widelands, you basically have two options:

  1. Modify the preferences for the gcc, as written in http://askubuntu.com/questions/113291/how-do-i-install-gcc-4-7 and many other places in the 'web.
  2. insert the parameter -DCMAKE_CXX_COMPILER=/usr/bin/g++-4.7 into the cmake call (please check if /usr/bin/g++-4.7 is really correct).

CMake is evil.

Top Quote
GunChleoc
Avatar
Topic Opener
Joined: 2013-10-07, 15:56 UTC+2.0
Posts: 3317
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2014-03-04, 11:44 UTC+1.0

I modified compile.sh and added the compiler like this:

cmake -DWL_PORTABLE=true .. -DCMAKE_BUILD_TYPE="${var_build_type}" .. -DCMAKE_CXX_COMPILER=/usr/bin/g++-4.7

resulting in the following error:

-- The C compiler identification is unknown
CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found.   Please set CMAKE_C_COMPILER to a valid compiler path or name.

Maybe I have to hack CMakeLists.txt somehow? I don't understand a word in that file though.

I checked /usr/bin/g++-4.7 and the file is there, the Synaptic package manager also lists g++-4.7 as installed.


Busy indexing nil values

Top Quote
Tino

Joined: 2009-02-20, 17:05 UTC+1.0
Posts: 251
Ranking
Tribe Member
Location: Somewhere in Germany...
Posted at: 2014-03-04, 13:10 UTC+1.0

Try

cmake -DWL_PORTABLE=true .. -DCMAKE_BUILD_TYPE="${var_build_type}" .. -DCMAKE_CXX_COMPILER=/usr/bin/g++-4.7 -DCMAKE_C_COMPILER=/usr/bin/gcc-4.7
Edited: 2014-03-04, 13:10 UTC+1.0

Top Quote
QCS

Joined: 2009-12-29, 22:47 UTC+1.0
Posts: 256
Ranking
Tribe Member
Posted at: 2014-03-04, 13:45 UTC+1.0

Tino's edit should do the trick.

However I am not sure on why this happens. I had to do the same for the Ubuntu Precise PPA, and I only added the CMAKE_CXX_COMPILER parameter... maybe you need to remove everything in the build directory because CMAKE_C_COMPILER was available before.


CMake is evil.

Top Quote
GunChleoc
Avatar
Topic Opener
Joined: 2013-10-07, 15:56 UTC+2.0
Posts: 3317
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2014-03-04, 17:36 UTC+1.0

QCS wrote:

Tino's edit should do the trick.

It did, thanks guys face-smile.png


Busy indexing nil values

Top Quote