SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I recently installed Slackware (x64) current via alien bob’s ISO. I wanted to go with 14.2 but my hardware is too new to be supported by 14.2’s kernel.
I want to install nvidia CUDA9 for running computations on the GPU. The problem is that CUDA9 only supports gcc version 6 and lower (there must be a lower bound on the GCC version as well — but I know that 5 and 6 should work, based on reading CUDA docs). Current ships GCC 8.2.
I understand I could build GCC6 from source and instruct CUDA to use that. I’m not averse to doing that, but I am posting to see whether there is another less manual option available.
I see that alien bob has gcc5 packaged for -current; however its README says it is to be co-installed with gcc7.
Generally, I’m wondering if there is a way to use older versions of GCC with current — perhaps a package is available somewhere, given that current had GCC6 in the past? Or is building GCC6 manually the best way forward?
Distribution: Slackware 64 -current multilib from AlienBob's LiveSlak MATE
Posts: 1,061
Rep:
I'm no gcc expert, but apparently it's possible to have multiple versions of gcc installed. See https://gcc.gnu.org/faq.html#multiple
So you should be able to install AlienBob's gcc-5 package. Then it's about finding a way of getting CUDA9 to use the correct version, with symlinks or whatever, but I guess that it's possible to find a solution via google, there must be other CUDA9 users facing the same issue.
I see that alien bob has gcc5 packaged for -current; however its README says it is to be co-installed with gcc7.
I wrote that because at the time, Slackware-current was indeed shipping GCC-7.
Now that it has GCC-8 you can still 'installpkg' my gcc5 package and then it is co-installed with GCC-8. No big deal, works just fine. Be sure to source the "/etc/profile.d/gcc5.sh" script if you actually want to use the gcc5 compiler.
Also note that this "gcc5" package only contains C, C++ and Java compilers. I left out the Fortran, Go etc compilers. I kept Java because that compiler is no longer offered since gcc-7 and it still has its uses for some.
If there isn't a particular reason to use CUDA 9 specifically, you're better with latest CUDA 9.2, that supports GCC 7 (however, beware that CUDA doesn't work with NVIDIA drivers past 396.24, as discussed in this thread here on forum). Furthermore, I think indeed that installing GCC from source is the best approach. There are number of pages explaining how to do it, so that should be easy for you. And when you have it installed, it's just about pointing your build system to use these compilers, also don't forget to specifically set CUDA host compiler to the same GCC version.
Btw, it's indeed very annoying that there are so much issues when GCC 8 used with CUDA. It was similar with GCC 7 and previous CUDA version, but this time issues are even much more complicated. Previously, it was simply enough to comment out code line checking compiler version in corresponding CUDA header file, and everything would work fine.
Thanks for the help everyone! I ended up compiling GCC 7.3 from source and using that for CUDA 9.2. (I originally chose CUDA 9 since that's the version used by Tensorflow in the provided binaries, but since I needed to install Tensorflow from source anyway I went with CUDA 9.2). Thanks @cgorac for the pointer regarding the Nvidia driver (also thanks to alien bob for providing the -current ISO in the first place!).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.