Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to specify the compiler to use for a specific package ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
wichtounet
Tux's lil' helper
Tux's lil' helper


Joined: 17 Mar 2012
Posts: 122

PostPosted: Fri Dec 14, 2012 6:20 pm    Post subject: How to specify the compiler to use for a specific package ? Reply with quote

Hi,

I installed a system with two compilers: GCC 4.7.2 and GCC 4.5.4.

I know that some package, grub for instance, do not work when compiled with GCC 4.7.2.

Is this possible to specifiy that a specific package should be compiled with a specific version of GCC ? I want all packages to be compiled with 4.7.2, but grub with 4.5.4.

Thank you

Baptiste
Back to top
View user's profile Send private message
aCOSwt
Bodhisattva
Bodhisattva


Joined: 19 Oct 2007
Posts: 2537
Location: Hilbert space

PostPosted: Fri Dec 14, 2012 9:41 pm    Post subject: Reply with quote

I don't know if it will work, I did not test !

I don't in anyway pretend that this is best practice :

However, spontaneously, I would answer to :

a/ create a /etc/portage/env/sys-boot directory
b/ edit a file named grub so that it contents :
Code:

pre_pkg_setup () {
        gcc-config The_ID_of_your_gcc_4_5_as_displayed_with_gcc-config-l
}

post_pkg_postinst () {
        gcc-config The_ID_of_your_gcc_4_7_as_displayed_with_gcc-config-l
}

_________________
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21605

PostPosted: Sat Dec 15, 2012 1:51 am    Post subject: Reply with quote

aCOSwt: please test before you propose solutions that are unnecessarily invasive. It should be sufficient to set $CC to the compiler you wish to use. If the build system respects $CC, it will call the chosen compiler. If the build system does not respect $CC, then the build system has a bug and needs to be fixed to respect $CC.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Sat Dec 15, 2012 1:57 am    Post subject: Reply with quote

Going back to initial post. I've legacy GRUB built with gcc-4.7.2 and it works.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
dol-sen
Retired Dev
Retired Dev


Joined: 30 Jun 2002
Posts: 2805
Location: Richmond, BC, Canada

PostPosted: Sat Dec 15, 2012 2:01 am    Post subject: Reply with quote

For automatic repeatable behavior, you can also use /etc/portage/package.env...

Quote:
package.env
Per-package environment variable settings. Entries refer to environment files that are placed in the /etc/portage/env/ directory and have the same format as make.conf(5).


see the manpage for more detail
_________________
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Back to top
View user's profile Send private message
wichtounet
Tux's lil' helper
Tux's lil' helper


Joined: 17 Mar 2012
Posts: 122

PostPosted: Tue Dec 18, 2012 7:07 pm    Post subject: Reply with quote

Thank you all for your answers :)

I added CC=XXX in a new env and set it in package.env

@Jaglover: Thanks for the feedback, but I don't want to take any risk :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum