title: Error undefined reference to `cutCreateTimer'
body: <p>I have the cuda 4.0 toolkit installed in my Ubuntu 12.04 server. When I am trying to build a cuda code present in Rodinia benchmark suite. I was  getting the following error. i.e, after running the make command </p>
  
  <pre><code>ncclab@slave13:~/Downloads/rodinia_2.4$ make
  cd cuda/cfd;            make;   cp euler3d euler3d_double pre_euler3d pre_euler3d_double /home/ncclab/Downloads/rodinia_2.4/bin/linux/cuda  
  make[1]: Entering directory `/home/ncclab/Downloads/rodinia_2.4/cuda/cfd'
  nvcc  -O2 -Xptxas -v --gpu-architecture=compute_20 --gpu-code=compute_20 euler3d.cu -o euler3d -I/if10/kw5na/NVIDIA_GPU_Computing_SDK4/C/common/inc  -L/if10/kw5na/NVIDIA_GPU_Computing_SDK4/C/lib 
  euler3d.cu:35: warning: #warning "the kernels may fail too launch on some systems if the block length is too large"
  euler3d.cu:35: warning: #warning "the kernels may fail too launch on some systems if the block length is too large"
  </code></pre>
  
  <p>By here the euler3d was built</p>
  
  <pre><code>nvcc -Xptxas -v -O3 --gpu-architecture=compute_20 --gpu-code=compute_20 euler3d_double.cu -o euler3d_double -I/if10/kw5na/NVIDIA_GPU_Computing_SDK4/C/common/inc  -L/if10/kw5na/NVIDIA_GPU_Computing_SDK4/C/lib 
  /tmp/tmpxft_0000532d_00000000-12_euler3d_double.o: In function `main':
  tmpxft_0000532d_00000000-1_euler3d_double.cudafe1.cpp:(.text+0x22d9): undefined reference to `cutCreateTimer'
  tmpxft_0000532d_00000000-1_euler3d_double.cudafe1.cpp:(.text+0x22f7): undefined reference to `cutStartTimer'
  tmpxft_0000532d_00000000-1_euler3d_double.cudafe1.cpp:(.text+0x2457): undefined reference to `cutStopTimer'
  tmpxft_0000532d_00000000-1_euler3d_double.cudafe1.cpp:(.text+0x246c): undefined reference to `cutGetAverageTimerValue'
  
  collect2: ld returned 1 exit status
  make[1]: *** [euler3d_double] Error 1
  make[1]: Leaving directory `/home/ncclab/Downloads/rodinia_2.4/cuda/cfd'
  cp: cannot stat `euler3d_double': No such file or directory
  cp: cannot stat `pre_euler3d': No such file or directory
  cp: cannot stat `pre_euler3d_double': No such file or directory
  make: *** [CUDA] Error 1
  </code></pre>
  
  <p>By searching I came to  know that there may be a problem with libcutil
  But I had the libcutil_x86_64.a in ~/NVIDIA_GPU_Computing_SDK/C/lib</p>
  
  <p>Edit: The contents of various folders are
  ncclab@slave13:~/NVIDIA_GPU_Computing_SDK/C/lib$ ls</p>
  
  <pre><code>libcutil_x86_64.a  libparamgl_x86_64.a  librendercheckgl_x86_64.a
  </code></pre>
  
  <p>~/Downloads/rodinia_2.4/cuda/cfd$ ls</p>
  
  <pre><code>euler3d     euler3d_double.cu  Makefile~        pre_euler3d.cu         README
  euler3d.cu  Makefile           Makefile_nvidia  pre_euler3d_double.cu  run
  </code></pre>
  
  <p>ncclab@slave13:~/NVIDIA_GPU_Computing_SDK/C/common/inc$ ls</p>
  
  <pre><code>bank_checker.h              cutil_inline.h          GL                nvVector.h           stopwatch_base.h
  cmd_arg_reader.h            cutil_inline_runtime.h  multithreading.h  nvWidgets.h          stopwatch_base.inl
  cuda_drvapi_dynlink.c       cutil_math.h            nvGlutWidgets.h   paramgl.h            stopwatch.h
  cutil_gl_error.h            dynlink                 nvGLWidgets.h     param.h              stopwatch_linux.h
  cutil_gl_inline.h           dynlink_d3d10.h         nvMath.h          rendercheck_d3d10.h
  cutil.h                     dynlink_d3d11.h         nvMatrix.h        rendercheck_d3d11.h
  cutil_inline_bankchecker.h  error_checker.h         nvQuaternion.h    rendercheck_d3d9.h
  cutil_inline_drvapi.h       exception.h             nvShaderUtils.h   rendercheck_gl.h
  </code></pre>
  
  <p>the partial contents of the makefile are</p>
  
  <pre><code>all: euler3d euler3d_double pre_euler3d pre_euler3d_double
  
  euler3d: euler3d.cu
      nvcc  -O2 -Xptxas -v --gpu-architecture=compute_20 --gpu-code=compute_20 euler3d.cu -o euler3d -I$(CUDA_SDK_PATH)/common/inc  -L$(CUDA_SDK_PATH)/lib $(CUTIL_LIB)
  
  euler3d_double: euler3d_double.cu
      nvcc -Xptxas -v -O3 --gpu-architecture=compute_20 --gpu-code=compute_20 euler3d_double.cu -o euler3d_double -I$(CUDA_SDK_PATH)/common/inc  -L$(CUDA_SDK_PATH)/lib $(CUTIL_LIB)
  
  
  pre_euler3d: pre_euler3d.cu
      nvcc -Xptxas -v -O3 --gpu-architecture=compute_20 --gpu-code=compute_20 pre_euler3d.cu -o pre_euler3d -I$(CUDA_SDK_PATH)/common/inc  -L$(CUDA_SDK_PATH)/lib $(CUTIL_LIB)
  
  pre_euler3d_double: pre_euler3d_double.cu
      nvcc -Xptxas -v -O3 --gpu-architecture=compute_20 --gpu-code=compute_20 pre_euler3d_double.cu -o pre_euler3d_double -I$(CUDA_SDK_PATH)/common/inc  -L$(CUDA_SDK_PATH)/lib $(CUTIL_LIB)
  </code></pre>
  
  <p>The euler3d has been successfully built. The errors are occurring for all the remaining three files.So I don't think there is any problems in the directories they are referring to</p>
  
  <p>I really don't understand why the undefined reference to `cutCreateTimer' and others are occurring. But searching in SE I came to know that when there is any problem with cutil.h or libcutil these problems exits. I was a newbie of linux environment. So please help me</p>
  
  <p>Edit 2: In a include file named make.config the following lines were present</p>
  
  <pre><code># CUDA SDK installation path
  #SDK_DIR = $(HOME)/NVIDIA_GPU_Computing_SDK/C
  SDK_DIR =/if10/kw5na/NVIDIA_GPU_Computing_SDK4/C
  #SDK_DIR =/if10/kw5na/NVIDIA_CUDA_Computing_SDK4/C
  </code></pre>
  
  <p>Here by default the 2nd option was selected and the euler3d was built. So I thought there may be a problem because of this. But changing it does not change the problem I was facing </p>
  
  <p>and about cutil library present in make file</p>
  
  <pre><code>CUDA_SDK_PATH := $(SDK_DIR)
  
  # Determine the correct version of the cutil library
  CUTIL_LIB = # -lcutil
  ifeq ($(shell uname -m), x86_64)
      ifeq ($(shell if test -e $(SDK_DIR)/lib/libcutil_x86_64.a; then echo T; else echo F; fi), T)
          CUTIL_LIB = #-lcutil_x86_64
       endif
  endif
  </code></pre>
  
  <p>Which I think was correct</p>