Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 540232 - dev-util/nvidia-cuda-sdk-6.5.19 should not inject tc-get* output into Makefile
Summary: dev-util/nvidia-cuda-sdk-6.5.19 should not inject tc-get* output into Makefile
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Science Related Packages
Keywords: PATCH
Depends on:
Reported: 2015-02-15 21:45 UTC by kevinmbecause
Modified: 2018-04-28 09:36 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---

nvidia-cuda-sdk-6.5.19.ebuild (nvidia-cuda-sdk-6.5.19.ebuild,3.93 KB, text/plain)
2015-02-15 21:45 UTC, kevinmbecause

Note You need to log in before you can comment on or make changes to this bug.
Description kevinmbecause 2015-02-15 21:45:42 UTC
Created attachment 396566 [details]

Building 0_simple/simpleMPI fails due to mpicxx -v output not containing the string x86_64-pc-linux-gnu-gcc as it only contains x86_64-pc-linux-gnu and gcc as seperate strings. There was a patch to fix the issue that was removed in bug #516020 but that patch was not the proper fix. The problem is that the ebuild does a large sed command on all of the Makefiles that replaces "gcc" with the output of tc-getCC() for lines that contain "CC" which also includes lines that contain MPI_GCC. A recursive grep of the Makefiles shows that the only instance of "gcc" is in the 0_simple/simpleMPI Makefile in the line which tests mpicxx -v to see if it contains the text "gcc". I created a modified ebuild which removes the find and replace of gcc. The updated ebuild compiles on my system.
Comment 1 kevinmbecause 2015-02-15 21:46:45 UTC
Portage 2.2.14 (python 3.3.5-final-0, default/linux/amd64/13.0/desktop/kde, gcc-4.7.3, glibc-2.19-r1, 3.14.14-gentoo x86_64)
System uname: Linux-3.14.14-gentoo-x86_64-Intel-R-_Core-TM-_i5-2500K_CPU_@_3.30GHz-with-gentoo-2.2
KiB Mem:     8163524 total,   1595272 free
KiB Swap:    8337392 total,   1523008 free
Timestamp of tree: Sat, 14 Feb 2015 11:45:01 +0000
ld GNU ld (Gentoo 2.24 p1.4) 2.24
ccache version 3.1.9 [disabled]
app-shells/bash:          4.2_p53
dev-java/java-config:     2.2.0
dev-lang/perl:            5.18.2-r1
dev-lang/python:          2.7.7, 3.2.5-r6, 3.3.5-r1
dev-util/ccache:          3.1.9-r4
dev-util/pkgconfig:       0.28-r1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6, 1.13.4
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.7.3-r1, 4.8.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.4
sys-devel/make:           4.0-r1
sys-kernel/linux-headers: 3.13 (virtual/os-headers)
sys-libs/glibc:           2.19-r1
Repositories: gentoo x-portage v-fox furikake gamerlay
CFLAGS="-march=native -Os -pipe"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -Os -pipe"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs candy config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/usr/local/portage /var/lib/layman/v-fox /var/lib/layman/furikake /var/lib/layman/gamerlay"
USE="3dnow 3dnowext X Xaw3d a52 aac aacs acpi alsa amd64 amrr ansi apng ass avx bash-completion bazaar bcmath berkdb bidi bitmap-fonts bittorrent blas bluetooth bluray branding bzip2 cairo cdda cddb cdio cdr cec chardet cli clisp collada consolekit coreavc cracklib crypt css cuda cue cups curl curlwrappers cvs cxx dbus debugger declarative dga dia dio directfb divx dlloader doc dot double-precision dri dssi dts dvd dvdnav dvdr dvdread eclipse editor emacs emboss emerald encode epson examples exif expert-mode extensions extra-cardsets fam fame fat fbcon ffmpeg fftw file-attr firefox flac fluidsynth fontconfig fortran fortran95 fpm ftdi ftp fts3 g3dvl gcj gd gdbm gflags ggi gif gimp gimpprint ginac git glamor glibc-omitfp glitz glut gmedia gmp gmplayer gphoto2 gpm gs gstreamer gtk gtk2 gtk3 gudev hardware-carrier hdf5 hwdb iconv id3tag idea imagemagick imap imlib injection insecure-savers int64 ipv6 jack jadetex java java5 java6 javascript jce jpeg jpeg2k kde kdenlive kipi kpathsea kqemu ladspa lame lapack lash latex lcms ldap libcaca libkms libnotify libsamplerate lm_sensors lzma lzo mad maps matroska md5sum melt mercurial messages midi minizip mjpeg mmap mmx mmxext mng modules mozdevelop mozilla mp3 mp4 mpeg mplayer multilib musepack musicbrainz mythtv na_dd na_dtv na_icons ncurses network nfs nlpsolver nocd nptl nptlonly nsplugin ntfs ntlm nvidia objc objc++ objc-gc ocaml octave odk offensive ogg oggvorbis openal opencl openexr opengl openmp openssl oss pam pango pcre pdf pdfimport perl pipelight plotutils png policykit posix postscript povray ppds private-headers projectm python qhull qt3 qt3support qt4 quicktime rar raw rdesktop readline real realmedia reiserfs rtc rtmp samba scanner schroedinger sdk sdl session sftp shorten shout smp sndfile snmp soundtouch sox speex spell sql sqlite srt sse sse2 sse3 sse4 sse4_1 sse4_2 ssh ssl ssse3 startup-notification subversion svg symlink szip taglib tcpd templates theora threads thumbnail tiff timidity tinfo tk tools transcode transmitter truetype truetype-fonts twolame type1-fonts udev udisks unicode unzip usb uvm v4l v4l2 vaapi vdpau videos vnc vorbis vpx wavpack webinterface webkit webp webserver wifi win32codecs winbind wma wmf wmp wxwidgets wxwindows x264 x265 xanim xcb xcomposite xinerama xiph xml xorg xpm xscreensaver xulrunner xv xvid xvmc zip zlib" ABI_X86="64 32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-32 efi-64 multiboot pc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_US en" LIRC_DEVICES="all" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="nvidia v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Comment 2 Jeroen Roovers gentoo-dev 2015-02-16 09:46:42 UTC
Comment on attachment 396566 [details]

--- nvidia-cuda-sdk-6.5.19.ebuild
+++ nvidia-cuda-sdk-6.5.19.ebuild
@@ -68,9 +68,7 @@
        sed \
                -e 's:-O2::g' \
                -e 's:-O3::g' \
-               -e "/LINK/s:gcc:$(tc-getCC) ${LDFLAGS}:g" \
                -e "/LINK/s:g++:$(tc-getCXX) ${LDFLAGS}:g" \
-               -e "/CC/s:gcc:$(tc-getCC):g" \
                -e "/GCC/s:g++:$(tc-getCXX):g" \
                -e "/NVCC /s|\(:=\).*|:= ${EPREFIX}/opt/cuda/bin/nvcc|g" \
                -e "/ CFLAGS/s|\(:=\)|\1 ${CFLAGS}|g" \
Comment 3 Jeroen Roovers gentoo-dev 2015-02-16 09:54:24 UTC
I don't know what your patch tries to accomplish. Replacing "gcc" with something better is probably the way to go. I'm pretty sure /removing/ that substitution is wrong, and I'm certain that injecting the output of tc-getCC/tc-getCXX everywhere is wrong: the replacment should be $(CC)/$(CXX) and then those variables should be set in the make environment.

In fact the ebuild shouldn't inject variable values into Makefile at all.
Comment 4 kevinmbecause 2015-02-17 05:00:07 UTC
I agree. I am proposing a better patch which provides the compiler and flags as options to make instead of injecting them into the Makefiles. It is possible to specify EXTRA_LDFLAGS in a similar way, but it fails if any of the options have commas in them (like -Wl options.)

--- nvidia-cuda-sdk-6.5.19.ebuild
+++ nvidia-cuda-sdk-6.5.19.ebuild
@@ -68,14 +68,6 @@
        sed \
                -e 's:-O2::g' \
                -e 's:-O3::g' \
-               -e "/LINK/s:gcc:$(tc-getCC) ${LDFLAGS}:g" \
-               -e "/LINK/s:g++:$(tc-getCXX) ${LDFLAGS}:g" \
-               -e "/CC/s:gcc:$(tc-getCC):g" \
-               -e "/GCC/s:g++:$(tc-getCXX):g" \
-               -e "/NVCC /s|\(:=\).*|:= ${EPREFIX}/opt/cuda/bin/nvcc|g" \
-               -e "/ CFLAGS/s|\(:=\)|\1 ${CFLAGS}|g" \
-               -e "/ CXXFLAGS/s|\(:=\)|\1 ${CXXFLAGS}|g" \
-               -e "/NVCCFLAGS/s|\(:=\)|\1 ${NVCCFLAGS} |g" \
                -e 's:-Wimplicit::g' \
                -e "s|../../common/lib/linux/\$(OS_ARCH)/libGLEW.a|$(pkg-config --libs glew)|g" \
                -e "s|../../common/lib/\$(OSLOWER)/libGLEW.a|$(pkg-config --libs glew)|g" \
@@ -96,6 +88,9 @@
                cuda-install="${EPREFIX}/opt/cuda" \
                CUDA_PATH="${EPREFIX}/opt/cuda/" \
                MPI_GCC=10 \
+               GCC="$(cuda_gccdir)/$(tc-getCXX)" \
+               EXTRA_NVCCFLAGS="`echo $NVCCFLAGS | sed 's/--compiler-bindir=[^ ]*//'`" \
+               EXTRA_CCFLAGS="${CXXFLAGS}" \
                ${myopts} ${verbose}