Cannot compile libFFTW in root 6.18.00 (-fPIC ?)

ROOT Version: 6.18.00
Platform: Ubuntu 16.04.7 LTS
Compiler: cmake

I get an error when compiling the root 6.18.00 distribution. I compile it with “cmake --build . – -j1”.
The error occurs in the “root/rootbuild/math/fftw” module.
The error is the following.

[100%] Linking CXX shared library ../../lib/
/usr/bin/ld: /usr/local/lib/libfftw3.a(apiplan.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libfftw3.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
math/fftw/CMakeFiles/FFTW.dir/build.make:188: recipe for target 'lib/' failed
gmake[2]: *** [lib/] Error 1
CMakeFiles/Makefile2:20630: recipe for target 'math/fftw/CMakeFiles/FFTW.dir/all' failed
gmake[1]: *** [math/fftw/CMakeFiles/FFTW.dir/all] Error 2
Makefile:170: recipe for target 'all' failed
gmake: *** [all] Error 2

I am not allowed to attach the build.make file to this post but anyway, it’s the one that comes with the package, I didn’t change anything.
How do I fix this? It seems I have to add the “-fPIC” flag somewhere, but where?

Best regards,

Machiel Kolstein

Okay. I figured it out. I had to download FFTW again and recompile the libfftw.a and library again ( and
One has to to compile and install it in the following way:

./configure --enable-shared
sudo make CFLAGS=-fPIC
sudo make install


Thanks for posting the solution!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.