Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 604178 - dev-util/nvidia-cuda-toolkit - doesn't set C_INCLUDE_PATH in /etc/env.d/99cuda
Summary: dev-util/nvidia-cuda-toolkit - doesn't set C_INCLUDE_PATH in /etc/env.d/99cuda
Status: RESOLVED WORKSFORME
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-12-30 19:53 UTC by Coacher
Modified: 2017-01-04 12:04 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 Coacher 2016-12-30 19:53:43 UTC
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.
Comment 1 Coacher 2016-12-30 20:16:24 UTC
pkgconfig file with correct includedir will do too.
Comment 2 Justin Lecher (RETIRED) gentoo-dev 2017-01-02 21:42:23 UTC
Marius, what do you think?
Comment 3 Marius Brehler 2017-01-02 22:20:56 UTC
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.
Comment 4 Justin Lecher (RETIRED) gentoo-dev 2017-01-02 22:27:28 UTC
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
Comment 5 Coacher 2017-01-03 09:15:59 UTC
(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.
Comment 6 Marius Brehler 2017-01-03 09:19:32 UTC
(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!
Comment 7 Coacher 2017-01-03 09:34:37 UTC
(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?
Comment 8 Marius Brehler 2017-01-03 10:19:46 UTC
(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.
Comment 9 Coacher 2017-01-03 10:43:29 UTC
(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.
Comment 10 Justin Lecher (RETIRED) gentoo-dev 2017-01-04 12:04:41 UTC
(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.