LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-10-2018, 11:28 AM   #1
eduardr
Member
 
Registered: Sep 2011
Distribution: Slackware64 14.2+ (-current)
Posts: 106

Rep: Reputation: Disabled
Nvidia CUDA req gcc7 but -current provides gcc8


I ran into a compilation issue with a tool that uses cuda and problem appears to be that cuda only supports up to gcc7. I modified the cuda source file that implements that restriction but later ran into other build issues that could also be due to gcc8.

I've found some info on running two different versions of gcc side-by-side. I'm unable to download the gcc7 Slackbuilds though, because -current has moved to gcc8. I'm not aware of any repo/archive that stores older versions/snapshots of the -current tree.

I'll probably try to use the gcc8 Slackbuilds with gcc7 source and hopefully that will work.

Thanks in advance for any other suggestions!
 
Old 12-10-2018, 11:54 AM   #2
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,950

Rep: Reputation: Disabled
Complain to NVIDIA is my suggestion.
 
1 members found this post helpful.
Old 12-10-2018, 11:57 AM   #3
eduardr
Member
 
Registered: Sep 2011
Distribution: Slackware64 14.2+ (-current)
Posts: 106

Original Poster
Rep: Reputation: Disabled
They pick up my calls!

Quote:
Originally Posted by orbea View Post
Complain to NVIDIA is my suggestion.
Fair point but not going to help - they're historically always behind on gcc support. The only thing that would help is if I were to buy a few thousand of their now unneeded coin mining cards - maybe then they'd listen.
 
Old 12-10-2018, 12:32 PM   #4
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Be happy. I am stuck with webkit2gtk-2.20.5 for Slint-14.2.1.2 based on Slackware-14.2, because more recent versions need GCC6. It's hard to please everybody...

As an aside this could be a concern as that prevents to benefit of further security fixes. But as long as we ship it only as a (private) dependency of yelp and not of a web browser that's OK, I think.
 
Old 12-10-2018, 02:38 PM   #5
RadicalDreamer
Senior Member
 
Registered: Jul 2016
Location: USA
Distribution: Slackware64-Current
Posts: 1,816

Rep: Reputation: 981Reputation: 981Reputation: 981Reputation: 981Reputation: 981Reputation: 981Reputation: 981Reputation: 981
Quote:
Originally Posted by eduardr View Post
I'll probably try to use the gcc8 Slackbuilds with gcc7 source and hopefully that will work.
That would be a good start. The program you want to use may have an official binary that has working CUDA built in. For example, Blender's binary has working CUDA.
 
Old 12-10-2018, 02:56 PM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,222

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Can you use clang?
 
1 members found this post helpful.
Old 12-10-2018, 07:21 PM   #7
eduardr
Member
 
Registered: Sep 2011
Distribution: Slackware64 14.2+ (-current)
Posts: 106

Original Poster
Rep: Reputation: Disabled
Thanks for the suggestions.

In the end I did a search for the older gcc 7.3.0 build 3 binary packages and found two sites that store older versions (I neither guarantee nor endorse them but it worked for me ).

http://slackmirror.cbpf.br/pub/slackware/
http://ftp.pieskovisko.sk/slackware/

Downloaded and downgraded to these older packages:

gcc-7.3.0-x86_64-3.txz
gcc-brig-7.3.0-x86_64-3.txz
gcc-g++-7.3.0-x86_64-3.txz
gcc-gfortran-7.3.0-x86_64-3.txz
gcc-gnat-7.3.0-x86_64-3.txz
gcc-go-7.3.0-x86_64-3.txz
gcc-objc-7.3.0-x86_64-3.txz

Things seem to work fine for me now as far as the things I need to compile that don't work with gcc8.

After I'm done compiling, I may upgrade back to the gcc 8 packages.
 
Old 12-11-2018, 12:08 PM   #8
cgorac
Member
 
Registered: Oct 2009
Posts: 146

Rep: Reputation: 87
It may be easier for you to just install GCC 7.3 from source. After downloading the source tarball, there is a script in-there to download prerequisites, and then I build it from source using following commands:
Code:
./configure -v --build=x86_64-linux-gnu --host=x86_64-linux-gnu \            
    --target=x86_64-linux-gnu --prefix=/opt/gcc-7.3 \                
    --enable-checking=release --enable-languages=c,c++,fortran \     
    --disable-multilib --program-suffix=-7.3
Then you need to point to this version of GCC when compiling CUDA code. For example, if your project is using CMake, then following commands, before CMake run, will do:
Code:
CC=/opt/gcc-7.3/bin/gcc-7.3
CXX=/opt/gcc-7.3/bin/g++-7.3
CUDAHOSTCXX=$CXX
export CC CXX CUDAHOSTCXX
Note that you need to specifically tell CUDA to use this version of GCC as its so-called host compiler (the CUDAHOSTCXX line).

The advantage of this approach is that this way you don't mess with your system-wide GCC installation - you have parallel GCC 7 installation, that you could use only when needed.

NVIDIA is indeed usually slow to enable latest GCC version. Previously, it was typically enough just to comment out corresponding #ifdef in specific CUDA header file to make it possible to use latest version of GCC, but with GCC 7 and GCC 8 things get more complicated. For GCC 7, there was a patch in ciruculation that will make CUDA work, but with GCC 8, there is no such thing, as far as I know, so the only way is to use GCC 7. Alike for LLVM, the highest clang version supported is 6, while Slackware switched to clang version 7. Next CUDA version will certainly fix this, as many important distributions switched to GCC 8, and in particular upcoming RHEL 8 should come with GCC 8 too. I expect new CUDA version certainly at the next GTC conference, in March 2019, and maybe earlier.
 
2 members found this post helpful.
Old 12-11-2018, 09:23 PM   #9
eduardr
Member
 
Registered: Sep 2011
Distribution: Slackware64 14.2+ (-current)
Posts: 106

Original Poster
Rep: Reputation: Disabled
@cgorac Thanks for the detailed guide! That looks like a promising approach. Compiling gcc 7.4.0 right now and will see how the CUDA piece works out once gcc is ready.

I did try downgrading the system gcc to 7.3.0 but that caused issues when I compiled the latest the Nvidia kernel modules (gcc mismatch with gcc 8 used to compile the kernel). So this parallel gcc 7 setup in /opt looks like a better way to go.
 
Old 12-12-2018, 10:27 AM   #10
eduardr
Member
 
Registered: Sep 2011
Distribution: Slackware64 14.2+ (-current)
Posts: 106

Original Poster
Rep: Reputation: Disabled
Thumbs up

Made good progress so far.

Compiled and installed gcc

Notes:
  • I downloaded the entire gcc source tree (3.4GB). I'm sure there's a better way to get just the v7 branch
  • gcc svn repo wasn't working so used the github gcc mirror.
  • I used -j32 when make'ing for the number of cores/hyperthreads my machine has - much faster build
  • I used the fetch-from-svn-and-prep-tarball.sh script to make sure the tarball is assembled according to the Slackware standard, "just in case"

Code:
# mkdir /usr/local/src/gcc 
# cd /usr/local/src/gcc
# git clone https://github.com/gcc-mirror/gcc.git
# ln -s gcc.git gcc
# wget http://slackware.cs.utah.edu/pub/sla...rep-tarball.sh
# chmod a+x fetch-from-svn-and-prep-tarball.sh
# ./fetch-from-svn-and-prep-tarball.sh
# tar xvf gcc-7.4.1_20181211_r267043.tar.lz
# cd gcc-7.4.1_20181211_r267043
# mkdir -p /opt/gcc/gcc-7.4
# ./configure -v --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --prefix=/opt/gcc/gcc-7.4 --enable-checking=release --enable-languages=c,c++,fortran --disable-multilib --program-suffix=-7.4
# make -j32
# make install
Installed latest cuda toolkit

Downloaded latest cuda 9.2 and cudnn packages (Ubuntu->installer runfile):
  • cuda_9.2.148_396.37_linux.run
  • cuda_9.2.148.1_linux.run
  • cudnn-9.2-linux-x64-v7.4.1.5.tgz

Symlink for gcc binary:
Code:
# cd /opt/gcc/gcc-7.4/bin
# ln -s gcc-7.4 gcc
Run cuda toolkit and patch installers (I chose /opt/nvidia/cuda as destination when running installers):
Code:
# PATH="/opt/gcc/gcc-7.4/bin:${PATH}" ./cuda_9.2.148_396.37_linux.run
# PATH="/opt/gcc/gcc-7.4/bin:${PATH}" ./cuda_9.2.148.1_linux.run
Manually extracted files from cudnn-9.2-linux-x64-v7.4.1.5.tgz and moved them to the appropriate directories in /opt/nvidia/cuda/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] GCC8.2-Chapter6 LFS test check lfs1121 Linux From Scratch 5 12-03-2022 03:55 PM
[SOLVED] unable to rebuild llvm-4.0 on slackware-current with gcc7/glibc-2.25 nobodino Slackware 4 06-03-2017 01:46 AM
XFS FS Access issue grants access for req 1, denies for req 2 rsheikh Linux - Server 0 06-28-2011 03:03 PM
Ubuntu Nvidia / CUDA driver installation gourox Linux - Hardware 1 08-14-2009 12:36 AM
Anyone tried nvidia CUDA toolkit sniff Programming 0 02-28-2007 05:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration