Skip to content
August 2, 2013 / Karthikeyan Natarajan

Passing arguments (options) to linker in nvcc compiler

Sometimes we need to pass some parameters to linker. In gcc, we use -Wl. This does not work with nvcc and it gives following error.

$  nvcc randomgen.cu -L/usr/local/cuda/lib -lcurand -Wl,-rpath,/usr/local/cuda/lib

nvcc fatal   : Unknown option ‘Wl,-rpath,/usr/local/cuda/lib’

There is alternatives to solve this.  Instead of -Wl, use –linker-options=   or -Xlinker=

Both will work well.

Eg: $  nvcc randomgen.cu -lcurand –linker-options=-rpath,/usr/local/cuda/lib

      $  nvcc randomgen.cu -lcurand -Xlinker=-rpath,/usr/local/cuda/lib

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: