George
George

Reputation: 5681

pycuda -- error: command 'x86_64-pc-linux-gnu-g++' failed with exit status 1

i installed sabayon linux and i tried to install pycuda but i am receiving the following error when i try

su -c "make install"

In file included from src/cpp/cuda.cpp:1:0: src/cpp/cuda.hpp:12:18: fatal error: cuda.h: No such file or directory compilation terminated. error: command 'x86_64-pc-linux-gnu-g++' failed with exit status 1

I must mention that i can compile with cuda.

The same happens and when i try with

sudo -E sh -c "make install"

My .bashrc is :

# Put your fun stuff here.
export PATH=~/bin:$PATH 
export PATH=$PATH:$HOME/Matlab_2010b/bin 
export PATH=/opt/cuda/bin:$PATH 
export LD_LIBRARY_PATH=/opt/cuda/lib64:$LD_LIBRARY_PATH 
export CUDA_ROOT=/opt/cuda/bin   

(When i do echo $PATH as user it shows me : /opt/cuda/bin but when i try it as root it doesn't show anything and i had to do export PATH...again in order to show.)

Upvotes: 0

Views: 4509

Answers (1)

talonmies
talonmies

Reputation: 72349

You have CUDA installed in a non-standard path and the PyCUDA installer doesn't know how to find the toolkit headers it needs to compile. As per the installation instructions, you need to do something like this:

python configure.py --cuda-root=/opt/cuda  

then

su -c "make install"

this will ensure that the compilation can find the necessary driver API headers to build the support libraries and hardcode all the right paths into the PyCUDA python libraries so that everything works correctly.

Upvotes: 2

Related Questions