Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 911178 - ruby-fakegem.eclass: CC=$(tc-getCC) is ignored.
Summary: ruby-fakegem.eclass: CC=$(tc-getCC) is ignored.
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-25 00:02 UTC by konsolebox
Modified: 2023-07-26 04:09 UTC (History)
1 user (show)

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 konsolebox 2023-07-25 00:02:33 UTC
Specifying `CC=$(tc-getCC)` before `${RUBY} --disable=did_you_mean -C ${extension%/*} ${extension##*/} --with-cflags="${CFLAGS}" --with-ldflags="${LDFLAGS}" ${RUBY_FAKEGEM_EXTENSION_OPTIONS}` does nothing as the Makefile will always be generated to a constant `CC = (whatever RbConfig::MAKEFILE_CONFIG['CC'] evaluates to)`.  It should be done in emake instead:

emake CC="$(tc-getCC)" V=1 -C ${extension%/*}

Also better quote that `${extension%/*}` as well.

This of course applies to extensions that use 'mkmf.rb' only.  Also, mkmf.rb has been like this since at least 2.2.10 which existed in ::gentoo before extension building support was added in ruby-fakegem.eclass.
Comment 1 konsolebox 2023-07-25 00:34:45 UTC
Come to think of it, only specifying CC in emake is wrong or is not enough since an extension may call try_compile or one of its variants during configuration. try_compile needs to use the same compiler specified to emake.

The problem is ENV['CC'] is ignored by mkmf.rb and this can be reproduced by:

$ CC=clang ruby -e 'puts RbConfig::expand("$(CC)")'
gcc

This can be hacked with the following command instead:

$ CC=clang ruby -e 'RbConfig::CONFIG["CC"] = ENV["CC"]; puts RbConfig::expand("$(CC)")'
clang

Which I think is just plain illegal.