Bug 1139077 - Automatic selection of devtoolset for clang
Summary: Automatic selection of devtoolset for clang
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: llvm
Version: el6
Hardware: Unspecified
OS: Linux
Target Milestone: ---
Assignee: Dave Johansen
QA Contact: Fedora Extras Quality Assurance
: 1161334 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2014-09-08 01:28 UTC by Michael Lampe
Modified: 2015-01-24 18:51 UTC (History)
2 users (show)

Fixed In Version: llvm-3.4.2-4.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-11-30 19:18:47 UTC
Type: Bug

Attachments (Terms of Use)
Patch (689 bytes, text/plain)
2014-09-08 01:28 UTC, Michael Lampe
no flags Details

Description Michael Lampe 2014-09-08 01:28:41 UTC
Created attachment 935219 [details]

Clang already tries to find the most recent installation of gcc on the system, but isn't prepared for devtoolset locations. The attached patch changes this. If a version of devtoolset is installed, clang will pick it's C++ headers and runtime for better C++11 support.

Comment 1 Dave Johansen 2014-09-10 04:18:09 UTC
Once this patch is applied, is there a way to select the default headers and runtime when devtoolset is installed?

Comment 2 Michael Lampe 2014-09-10 14:17:24 UTC
Upstream's idea is to select the latest and greatest available at runtime, so there isn't really a default. The patch just makes clang find gccs in devtoolset locations too. clang 3.4.2 supports gcc up to 4.9.x which will be in devtoolset-3.

Comment 3 Dave Johansen 2014-11-07 04:28:56 UTC
*** Bug 1161334 has been marked as a duplicate of this bug. ***

Comment 4 Fedora Update System 2014-11-15 16:50:03 UTC
llvm-3.4.2-2.el6 has been submitted as an update for Fedora EPEL 6.

Comment 5 Fedora Update System 2014-11-16 04:17:33 UTC
Package llvm-3.4.2-2.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing llvm-3.4.2-2.el6'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2014-11-30 19:18:47 UTC
llvm-3.4.2-2.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Dave Johansen 2015-01-02 18:40:02 UTC
This change has caused problems with some users because devtoolset pulls some trickery with glibc and such and it now had to be used when building with clang. I have added a patch from Gregor Jasny that allows the devtoolset to be used by setting the CLANG_DTS_LIST environment variable to a space separated list of the desired devtoolsets in /opt/rh. This allows devtoolset to be installed but not used when the existing patch always required it to be used when it was installed.

He also pointed out that devtoolset can be used through the --gcc-toolchain flag. For example:
clang --gcc-toolchain=/opt/rh/devtoolset-3/root/usr -v

This updated version with runtime selection of devtoolset is being built now and will be available in the testing repo soon.

Comment 8 Michael Lampe 2015-01-02 19:01:45 UTC
"-gcc-toolchain" could always be used, and it can still be used like in 

$ clang -gcc-toolchain /usr -v

to avoid any devtoolset. It's just a question of what should be the default. Going for the latest gcc available is how upstream does it, why invent more elaborate trickery for selection, which also has to be communicated to users? It would be easier to just drop this thing altogether.

Besides, are there any examples for this "trickery with glibc and such"? I didn't quite get it.

Comment 9 Dave Johansen 2015-01-02 20:08:41 UTC
I have heard complaints from a few users since this change was added and it seems that the issue is when using libraries that were built with stock gcc 4.4. I didn't dig into the issue in detail to find what the cause was, but my original desire was that the use of devtoolset could be turned on and off (see comment #1). The previous solution of just adding all the devtoolsets to the search list didn't support that and this one does. I agree that it's a bit annoying to have to "enable" the use of devtoolset but I think that not tying the users hands to always using it is an important use case to continue supporting and well worth the inconvenience.

Also, this method supports any new devtoolsets that are added and not just the list that was in the original patch. For example, if/when a devtoolset 2.1 or 3.1 was added the previous solution would require an updated build to use them. This solution has the advantage that it "just works" any time a new version of the devtoolset is added.

Comment 10 Michael Lampe 2015-01-02 20:45:31 UTC
Then why not simply remove *all* devtoolset patches? "-gcc-toolchain" is clumsy, but does the job. My patch was only about the *default*. A new method for selection isn't necessary, one was built-in from the very beginning. It works now and did so before.

(Newer devtoolsets don't have a minor number anymore, and -3 is the last one that works with clang-3.4.2 which is only compatible with gcc up to 4.9.x. The list can therefore be considered complete.)

Comment 11 Fedora Update System 2015-01-03 01:02:38 UTC
llvm-3.4.2-4.el6 has been submitted as an update for Fedora EPEL 6.

Comment 12 Michael Lampe 2015-01-03 01:15:45 UTC
Just for the fun of it: a lot of people don't use RH's 'scl' command but environment modules instead. But ok, I'm out. You broke more than you fixed.

Comment 13 Fedora Update System 2015-01-03 02:09:07 UTC
llvm-3.4.2-4.el7 has been submitted as an update for Fedora EPEL 7.

Comment 14 Dave Johansen 2015-01-03 02:12:49 UTC
I'm sorry that you feel that way. I understand your concern and the logic that you used when creating the original patch was sound and matches with upstream mentality, but the fact is that users need a way to enable/disable the use of devtoolset with clang. For better or worse, the SCL mechanism is RedHat's way to do that, so this change makes use of that mechanism so that clang's use of devtoolset is more inline with how devtoolset itself is used.

Comment 15 Fedora Update System 2015-01-03 16:53:47 UTC
llvm-3.4.2-5.el7 has been submitted as an update for Fedora EPEL 7.

Comment 16 Fedora Update System 2015-01-24 18:46:48 UTC
llvm-3.4.2-5.el7 has been pushed to the Fedora EPEL 7 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 17 Fedora Update System 2015-01-24 18:51:35 UTC
llvm-3.4.2-4.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.