Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 582810 - dev-util/nvidia-cuda-sdk-7.5.18 - x86_64-pc-linux-gnu-gcc-4.9.3: /usr/include/string.h: In function ‘void* __mempcpy_inline(void*, const void*, size_t)’: /usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope
Summary: dev-util/nvidia-cuda-sdk-7.5.18 - x86_64-pc-linux-gnu-gcc-4.9.3: /usr/include...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Science Related Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-12 07:26 UTC by PetaMem R&D
Modified: 2021-05-25 18:39 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 PetaMem R&D 2016-05-12 07:26:34 UTC
Trying to build tensorflow from source, so I need cuda-sdk and not just cuda-toolkit (which emerges fine). Trying this on a fairly fresh install with plenty of new versions, kernel 4.5.3, GCC 5.3.0 (see emerge --info below)


The compilation starts to fail with errors of "memcpy" not being declared, like that:


....
#$ ptxas  -arch=sm_50 -m64  "/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_00005695_00000000-9_template.compute_50.ptx"  -o "/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_00005695_00000000-56_template.compute_50.cubin" 
#$ "/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.3"/gcc -E -x c++ -D__CUDACC__ -D__NVCC__  -march=core-avx2 -O2 -pipe -O2 -I"../../common/inc" "-I/opt/cuda/bin/..//include"   -D"__CUDACC_VER__=70517" -D"__CUDACC_VER_BUILD__=17" -D"__CUDACC_VER_MINOR__=5" -D"__CUDACC_VER_MAJOR__=7" -include "cuda_runtime.h" -m64 "template.cu" > "/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_00005695_00000000-5_template.cpp4.ii" 
#$ "/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.3"/gcc -c -x c++ -march=core-avx2 -O2 -pipe -O2 -I"../../common/inc" "-I/opt/cuda/bin/..//include"   -fpreprocessed -m64 -o "simpleOccupancy.o" "/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_00005654_00000000-59_simpleOccupancy.compute_20.ii" 
#$ ptxas  -arch=sm_52 -m64  "/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-6_template_runtime.compute_52.ptx"  -o "/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-58_template_runtime.compute_52.sm_52.cubin" 
#$ fatbinary --create="/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-2_template_runtime.fatbin" -64 --key="daf96aab079599b2" "--image=profile=sm_20@compute_20,file=/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-48_template_runtime.compute_20.cubin" "--image=profile=sm_30@compute_30,file=/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-50_template_runtime.compute_30.cubin" "--image=profile=sm_35@compute_35,file=/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-52_template_runtime.compute_35.cubin" "--image=profile=sm_37@compute_37,file=/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-54_template_runtime.compute_37.cubin" "--image=profile=sm_50@compute_50,file=/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-56_template_runtime.compute_50.cubin" "--image=profile=compute_52,file=/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-6_template_runtime.compute_52.ptx" "--image=profile=sm_52@compute_52,file=/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-58_template_runtime.compute_52.sm_52.cubin" --embedded-fatbin="/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-2_template_runtime.fatbin.c" --cuda
#$ rm /tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-2_template_runtime.fatbin
#$ "/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.3"/gcc -D__CUDA_ARCH__=200 -E -x c++        -DCUDA_DOUBLE_MATH_FUNCTIONS   -march=core-avx2 -O2 -pipe -O2 -D__CUDA_PREC_DIV -D__CUDA_PREC_SQRT -I"../../common/inc" "-I/opt/cuda/bin/..//include"   -m64 "/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-19_template_runtime.compute_20.cudafe1.cpp" > "/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-59_template_runtime.compute_20.ii" 
/usr/include/string.h: In function ‘void* __mempcpy_inline(void*, const void*, size_t)’:
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope
   return (char *) memcpy (__dest, __src, __n) + __n;
                                          ^
#$ "/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.3"/gcc -c -x c++ -march=core-avx2 -O2 -pipe -O2 -I"../../common/inc" "-I/opt/cuda/bin/..//include"   -fpreprocessed -m64 -o "template_runtime.o" "/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_0000564b_00000000-59_template_runtime.compute_20.ii" 
#$ cudafe++ --allow_managed --m64 --gnu_version=40903 --parse_templates  --gen_c_file_name "/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_00005695_00000000-4_template.compute_52.cudafe1.cpp" --stub_file_name "tmpxft_00005695_00000000-4_template.compute_52.cudafe1.stub.c" --module_id_file_name "/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_00005695_00000000-3_template.module_id" "/tmp/portage/dev-util/nvidia-cuda-sdk-7.5.18/temp/tmpxft_00005695_00000000-5_template.cpp4.ii" 
/usr/include/string.h: In function ‘void* __mempcpy_inline(void*, const void*, size_t)’:
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope
   return (char *) memcpy (__dest, __src, __n) + __n;
                                          ^
....


There are no other errors before that, no problems in config run etc.

What seems weird, is that I do have gcc 5.3.0 enabled, yet the build seems to force 4.9.3 hard. Not sure if I interpret the CLI right, but it seems to use the CFLAGS (-march=core-avx2 -O2) I've set in make.conf also for 4.9.3, which I am not sure is a good thing and it might trigger all kind of problems.





Reproducible: Always




$ emerge --info
Portage 2.2.28 (python 3.4.3-final-0, default/linux/amd64/13.0, gcc-5.3.0, glibc-2.23-r2, 4.5.3-gentoo x86_64)
=================================================================
System uname: Linux-4.5.3-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E3-1505M_v5_@_2.80GHz-with-gentoo-2.2
KiB Mem:    16366416 total,   8080468 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Wed, 11 May 2016 09:15:01 +0000
sh bash 4.3_p42-r2
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p42-r2::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.22.2::gentoo
dev-lang/python:          2.7.11-r2::gentoo, 3.4.3-r7::gentoo
dev-util/cmake:           3.5.2::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.20.5::gentoo
sys-apps/sandbox:         2.10-r2::gentoo
sys-devel/autoconf:       2.69-r2::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.12.6-r1::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.3::gentoo, 5.3.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.5::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.cz.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-vcs-ignore: true

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core-avx2 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /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=core-avx2 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=3 --keep-going --with-bdeps=y --quiet-build=y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
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 --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X acl alsa alsa-plugin amd64 berkdb bzip2 cairo cleartype cli corefonts cracklib crypt cups cxx dbus dri fontforge fortran gdbm iconv icu ipv6 jpeg libxml2 lock mmx mmxext modules multilib ncurses nls nptl nvidia openmp pam pcre png python qt4 readline seccomp session sse sse2 ssl startup-notification subversion svg tcpd thinkpad thunar tiff truetype udev unicode vaapi xattr xml xorg xscreensaver xterm xv zlib" ABI_X86="64 32" ALSA_CARDS="hda-intel" 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 avx2 fma3 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" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="pdfimport" LINGUAS="de en cs" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="intel i965 nvidia" 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"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 PetaMem R&D 2016-05-14 12:15:46 UTC
Ticket can be closed.

* cuda-sdk is not necessary
* solution for the memcpy problem - see
https://groups.google.com/forum/#!topic/torch7/mtNfCLlQNSU


provide

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES")

at the very top of every single "CMakeLists.txt".
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2016-06-29 06:14:50 UTC
(In reply to PetaMem R&D from comment #1)
> Ticket can be closed.

The bug hasn't been fixed.

> * cuda-sdk is not necessary
> * solution for the memcpy problem - see
> https://groups.google.com/forum/#!topic/torch7/mtNfCLlQNSU

This website tracks bugs - it is not a support forum. We find solutions here to problems that affect everyone in the same way - the bug tracker is not intended to track or find personal solutions to localised problems.
Comment 3 PetaMem R&D 2016-06-29 06:42:27 UTC
AFAICS the bug has been fixed.

It was not a problem of CUDA, but of Tensorflow and there it is fixed.
As tensorflow is not even part of portage, I do not see how the problem could be possibly "more fixed" than it is now.
Comment 4 Alex Orange 2017-04-10 16:33:54 UTC
PetaMem R&D: You have discovered an actual bug. You can't install nvidia-cuda-sdk without the fix you have linked to (which by the way, I'm not exactly sure how to apply). I'm confused by your saying it's not a problem with CUDA given that your log is taken straight from the nvidia-cuda-sdk build (I have basically the same problem, different file, but same error). I write this post because your last comment confused me into thinking this bug was closed or about to be closed.

For anyone else reading, I got this fix from fedeliallalinea: https://forums.gentoo.org/viewtopic-p-8015230.html?sid=cb6a3f6b3904b1029dbf0bb43f56d254#8015230 (tweaked based on his later post) and it works for me.

# echo -e 'CFLAGS="${CFLAGS} -D_FORCE_INLINES"\nCXXFLAGS="${CXXFLAGS} -D_FORCE_INLINES"' > /etc/portage/env/force-inlines.conf 
# echo "=dev-util/nvidia-cuda-sdk-7.5.18 force-inlines.conf" >> /etc/portage/package.env 
# emerge nvidia-cuda-sdk