You are not logged in.

#1 2017-05-03 14:51:45

maximusk
Member
Registered: 2017-05-03
Posts: 5

[SOLVED] Set CC and CXX

Hi everyone,

I am trying to build a Yocto based distro on my archlinux. Unfortunately, I got a recipe that won't build using GCC 6, so I installed GCC 5.

I have already done it on a Kubuntu, using update-alternatives to change the default GCC and G++ versions, but i can't do it on arch. I tried to export CC and CXX, but it does not work.

Is there a clean way to change the default compiler (by clean I mean not replacing the binary or symlinking in /usr/bin) ?

Last edited by maximusk (2017-05-04 08:16:24)

Offline

#2 2017-05-03 15:08:31

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [SOLVED] Set CC and CXX

Just to confirm, you already installed the gcc5package, correct? And now you're looking for a way to use GCC 5 when compiling a specific program?

Offline

#3 2017-05-03 15:14:38

maximusk
Member
Registered: 2017-05-03
Posts: 5

Re: [SOLVED] Set CC and CXX

Exactly. Except I'm not trying to compile a specific program, but a whole Yocto image. And this is the problem, because I can't just edit a makefile, or use gcc-5 on command line.

Offline

#4 2017-05-03 18:42:20

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [SOLVED] Set CC and CXX

I'd try creating a directory with a collection of links to the gcc5 programs, then would try to add this to the front of $PATH while building the stuff that needs gcc5.

You get a list of the programs in the gcc5 package like this:

pacman -Qlq gcc5 | grep -E "usr/bin/.+"

This here should print a bunch of "ln -s" command lines where the "-5" gets chopped off from the names for the links:

for x in $(pacman -Qlq gcc5 | grep -E 'usr/bin/.+'); do y="${x##*/}"; y="${y%-5}"; echo ln -s "/$x" "$y"; done

Last edited by Ropid (2017-05-03 18:44:02)

Offline

#5 2017-05-04 07:57:44

maximusk
Member
Registered: 2017-05-03
Posts: 5

Re: [SOLVED] Set CC and CXX

I tried it, but it's not working. Bitbake and make still use /usr/bin/gcc which is GCC 6.

EDIT : My bad, I didn't check correctly, it uses GCC 5... but the build it still failing.

Last edited by maximusk (2017-05-04 08:07:38)

Offline

#6 2017-05-04 08:15:43

maximusk
Member
Registered: 2017-05-03
Posts: 5

Re: [SOLVED] Set CC and CXX

Finally managed to fix it. The problem was because the thing i'm trying to build is an old version and it is not compatible with the recent glibc versions (some macros were moved). I found a patch to fix it.

Offline

Board footer

Powered by FluxBB