title: Compile FFTW with pgcc, undefined reference
body: <p>For other software I need fftw-2.1.5 with <code>--enable-mpi --enable-type-prefix --enable-float</code> installed. It should be compiled with <code>pgcc</code></p>
  
  <p>PGCC, etc. are installed under the <code>/home</code> directory. For this post I have shortend it with <code>path-to</code>.</p>
  
  <p>I do:</p>
  
  <pre>./configure --prefix=/path-to/fftw --enable-mpi --enable-type-prefix --enable-float CC=path-to/pgcc CXX=path-to/pgc++ F77=path-to/pgf77 FC=path-to/pgfortran
  
  make`</pre>
  
  <p><code>./configure</code> finishes successful, during <code>make</code> I get this error message:</p>
  
  <pre>/usr/bin/ld: ../fftw/.libs/libsfftw.a(malloc.o): relocation R_X86_64_32 against .rodata' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: ../fftw/.libs/libsfftw.a(putils.o): relocation R_X86_64_32 against .rodata' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: ../fftw/.libs/libsfftw.a(twiddle.o): relocation R_X86_64_32 against .data' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: final link failed: Nonrepresentable section on output
  collect2: error: ld returned 1 exit status
  </pre>
  
  <p>I tried to recompile with the <code>-fPIC</code> flag:</p>
  
  <pre>
  make clean
  make CFLAGS="-fPIC"
  </pre>
  
  <p>Then I get:</p>
  
  <pre>
  ../fftw/.libs/libsfftw.a(twiddle.o): In function `fftw_compute_twiddle':
  /home/daniel/fftw-test/fftw-2.1.5/fftw/./twiddle.c:92: undefined reference to `__fd_sincos_1'
  /home/daniel/fftw-test/fftw-2.1.5/fftw/./twiddle.c:126: undefined reference to `__fd_sincos_1'
  ../fftw/.libs/libsfftw.a(twiddle.o): In function `fftw_compute_rader_twiddle':
  /home/daniel/fftw-test/fftw-2.1.5/fftw/./twiddle.c:65: undefined reference to `__fd_sincos_1'
  collect2: error: ld returned 1 exit status
  </pre>
  
  <p>I've now tried to find a solution to why this happens for hours but I cannot figure it out.</p>
  
  <p>When I configure it to use the gcc compiler (system default) everything works perfectly:</p>
  
  <pre>./configure --prefix=/fftw --enable-mpi --enable-type-prefix --enable-float
  make
  make install</pre>
  
  <p>EDIT, more information:</p>
  
  <ul>
  <li><p>The program for which I need fftw, needs pgcc. I though it would be best if I compile everything with it as it was recommended on some forum sites. </p></li>
  <li><p>In twiddle.c there is not a single mention of <code>__fd_sincos_1</code>. For example line 92 is simply
  <code>for (i = 0; i &lt; n; ++i) {</code></p></li>
  <li><p>When I drop the <code>--enable-type-prefix</code> nothing changes. Still the same error.</p></li>
  </ul>