Hello. Applications just want to do '#include <cuda.h>', e.g. ffmpeg or libav: https://github.com/FFmpeg/FFmpeg/blob/n3.2.2/libavutil/hwcontext_cuda.h#L23 https://github.com/libav/libav/blob/v12/libavutil/hwcontext_cuda.h#L23 Please set correct C_INCLUDE_PATH in env.d/99/cuda.
pkgconfig file with correct includedir will do too.
Marius, what do you think?
For my purposes this was not necessary till now, thus I have to dig deeper into it. If only the include it used in these header files and nvcc isn't called for compilation, this might actually be a solution. Since there are no default paths for cuda, another solution might be passing the include path in the appropriate Makefile or rather in the ffmpeg and libav ebuild. I think if we set the C_INCLUDE_PATH in env.d/99/cuda, we might also set CPLUS_INCLUDE_PATH.
In gentoo the path is simple and stable /opt/cuda/include/cuda.h So we don't need anything extra here. Only if upstream is providing this. Just add -I/opt/cuda/include/ to the CPPFLAGS
(In reply to Justin Lecher from comment #4) > In gentoo the path is simple and stable > > /opt/cuda/include/cuda.h Truly simple path is '/usr/include/cuda.h'. > So we don't need anything extra here. Only if upstream is providing this. > Just add -I/opt/cuda/include/ to the CPPFLAGS So every cuda application requires extra steps to be built on Gentoo? Makes perfect sense.
(In reply to Coacher from comment #5) > (In reply to Justin Lecher from comment #4) > > In gentoo the path is simple and stable > > > > /opt/cuda/include/cuda.h > Truly simple path is '/usr/include/cuda.h'. > > > So we don't need anything extra here. Only if upstream is providing this. > > Just add -I/opt/cuda/include/ to the CPPFLAGS > So every cuda application requires extra steps to be built on Gentoo? > Makes perfect sense. If you're using nvcc for comilation "-I/opt/cuda/bin/..//include" is passed to the gcc anyway!
(In reply to Marius Brehler from comment #6) > (In reply to Coacher from comment #5) > > (In reply to Justin Lecher from comment #4) > > > In gentoo the path is simple and stable > > > > > > /opt/cuda/include/cuda.h > > Truly simple path is '/usr/include/cuda.h'. > > > > > So we don't need anything extra here. Only if upstream is providing this. > > > Just add -I/opt/cuda/include/ to the CPPFLAGS > > So every cuda application requires extra steps to be built on Gentoo? > > Makes perfect sense. > > If you're using nvcc for comilation "-I/opt/cuda/bin/..//include" is passed > to the gcc anyway! So you are telling me that anyone who wants to compile ffmpeg or libav with cuda support should switch to nvcc?
(In reply to Coacher from comment #7) > (In reply to Marius Brehler from comment #6) > > (In reply to Coacher from comment #5) > > > (In reply to Justin Lecher from comment #4) > > > > In gentoo the path is simple and stable > > > > > > > > /opt/cuda/include/cuda.h > > > Truly simple path is '/usr/include/cuda.h'. Anyway, /usr/include also is not be the default which the cuda installer chooses. > > > > So we don't need anything extra here. Only if upstream is providing this. > > > > Just add -I/opt/cuda/include/ to the CPPFLAGS > > > So every cuda application requires extra steps to be built on Gentoo? > > > Makes perfect sense. > > > > If you're using nvcc for comilation "-I/opt/cuda/bin/..//include" is passed > > to the gcc anyway! > So you are telling me that anyone who wants to compile ffmpeg or libav with > cuda support should switch to nvcc? No, but you're arguing that 'every cuda application requires extra steps', which is not correct. Following https://developer.nvidia.com/ffmpeg one should pass --extra-cflags to the configure command to set the include path.
(In reply to Marius Brehler from comment #8) > Anyway, /usr/include also is not be the default which the cuda installer > chooses. Are you aiming to make happy Gentoo users or cuda installer? > No, but you're arguing that 'every cuda application requires extra steps', > which is not correct. Following https://developer.nvidia.com/ffmpeg one > should pass --extra-cflags to the configure command to set the include path. Well, this is one extra step. We have pkgconfig to avoid this kind of problems.
(In reply to Coacher from comment #9) > (In reply to Marius Brehler from comment #8) > > Anyway, /usr/include also is not be the default which the cuda installer > > chooses. > Are you aiming to make happy Gentoo users or cuda installer? Please stop here. Gentoo tries to minimize divergence from upstream, which makes Gentoo users happy as they can communicate with upstream. In all cases we diverged from upstream in the past, upstream refused to support Gentoo. So there will be no extra pc file or config helper if not needed. The include path is really simple and stable over version bumps. /opt is the correct location for closed source, binary packages. All the nvidia packages are falling into this category, so we won't place anything into /usr/. > > > No, but you're arguing that 'every cuda application requires extra steps', > > which is not correct. Following https://developer.nvidia.com/ffmpeg one > > should pass --extra-cflags to the configure command to set the include path. > Well, this is one extra step. We have pkgconfig to avoid this kind of > problems. See above.