Opt icon indicating copy to clipboard operation
Opt copied to clipboard

Runtime compilation doesn't respect environment variables for include paths

Open lakinwecker opened this issue 6 years ago • 5 comments

The image warping example builds just fine, but it won't run. It has this error: I updated ../shared/make_template.inc to point to my install of CUDA and I updated LD_LIBRARY_PATH, and C_INCLUDE_PATH and CPLUS_INCLUDE_PATH to point to the CUDA includes and library directories respectively, but the example doesn't run:

~➜ ./image_warping 
width 512, height 512
numActivePixels: 101406
<buffer>:5:10: fatal error: 'cuda_runtime.h' file not found
#include <cuda_runtime.h>
         ^
compilation of included c code failed

It's probably not running clang with any of the environment variables I have set, and it's also not respecting the makefile.inc settings. How do I tell it where to find cuda during runtime?

lakinwecker avatar Nov 07 '18 17:11 lakinwecker

Hi @lakinwecker have you found a way to overcome this problem? I've got exact the same problem as the installed path of cuda is not standard. I've tried to change all <cuda_runtime.h> to "cuda_runtime.h" but still no luck.

lhoangan avatar Dec 08 '18 12:12 lhoangan

@lhoangan No. I never did successfully work around it. I gave up trying to use Opt some time ago. It depends on too many things that are too old and I didn't feel like manually compiling old compilers to get it working.

lakinwecker avatar Dec 08 '18 16:12 lakinwecker

The issue happens when the installed version of cuda is different than 7.5. Opt.lib seems to have hard-coded the path to cuda 7.5, however, and this is not configurable hence the error.

I found a workaround by making a hard symlink to the installed version of cuda, i.e. run "cmd" with admin provileges and then write: mklink /J "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1"

(note change 10.1 to the version that you have currently installed; also the second path may slightly change on your system, so double-check it)

mfratarcangeli avatar Sep 05 '19 12:09 mfratarcangeli

For future reference, update $CUDA_HOME (for Linux) and $CUDA_PATH (for Windows) works for me

lhoangan avatar Sep 05 '19 19:09 lhoangan

Good to know.

lakinwecker avatar Sep 05 '19 23:09 lakinwecker