Theano/Theano — pull request #575 by gwtaylor (2012-03-29 21:46:51+00:00)
Title: Fix for CUDA 4.1 on OS X, prevent -no_pie flag

I updated to CUDA 4.1 today on OSX and found that I could Theano would no longer compile with nvcc.

I get an error like this:

```
ld: unknown option: -no_pie
collect2: ld returned 1 exit status
```

It turns out that the host linker on Mac 10.7 (and 10.6 I guess, because I haven't upgraded to 10.6) passes the -no_pie option to the linker by default. This is a known issue reported in the [NVIDIA CUDA Toolkit Release notes](http://developer.download.nvidia.com/compute/cuda/4_1/rel/toolkit/docs/CUDA_Toolkit_Release_Notes_And_Errata.txt).

Apparently the solution is to pass the option ```-Xlinker -pie``` to nvcc. This patch does just that (only on the darwin platform and when CUDA version is >= 4.1).

It would be good if another Mac user (perhaps on a different CUDA version) tries this and makes sure it doesn't break compiling with nvcc.