'Why does installation of R package fftwtools fail after successful installation of FFTW 3.3.10 on Ubuntu 20.04?
My goal is to install R package "fftwtools" on my computer equipped with Ubuntu 20.04 as the only OS. After reading previous postings on stackoverflow, I installed the latest version of fftw (3.3.10), including the development version using
sudo apt-get install fftw3-dev
I can see the library files in /usr/local/lib as follows:
dorazio@toucan:/usr/local/lib$ ls -la
total 3640
drwxr-xr-x 7 root root 4096 Feb 27 10:53 .
drwxr-xr-x 10 root root 4096 Apr 27 2018 ..
drwxr-xr-x 3 root root 4096 Feb 27 10:52 cmake
-rw-r--r-- 1 root root 3581658 Feb 27 10:52 libfftw3.a
-rwxr-xr-x 1 root root 888 Feb 27 10:52 libfftw3.la
-rw-r--r-- 1 root root 46990 Feb 27 10:53 libfftw3_omp.a
-rwxr-xr-x 1 root root 936 Feb 27 10:53 libfftw3_omp.la
-rw-r--r-- 1 root root 52098 Feb 27 10:53 libfftw3_threads.a
-rwxr-xr-x 1 root root 948 Feb 27 10:53 libfftw3_threads.la
drwxr-xr-x 2 root root 4096 Feb 27 10:52 pkgconfig
drwxrwsr-x 4 root staff 4096 Mar 13 2021 python2.7
drwxrwsr-x 3 root staff 4096 Aug 3 2020 python3.8
drwxrwsr-x 3 root staff 4096 May 26 2018 R
However, I get the following error message when attempting to install R package fftwtools:
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
>
> install.packages('fftwtools')
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/fftwtools_0.9-11.tar.gz'
Content type 'application/x-gzip' length 174321 bytes (170 KB)
==================================================
downloaded 170 KB
* installing *source* package ‘fftwtools’ ...
** package ‘fftwtools’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... gcc -std=gnu99 -std=gnu11
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 -std=gnu11 accepts -g... yes
checking for gcc -std=gnu99 -std=gnu11 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -std=gnu11 -E
checking for gcc... (cached) gcc -std=gnu99 -std=gnu11
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc -std=gnu99 -std=gnu11 accepts -g... (cached) yes
checking for gcc -std=gnu99 -std=gnu11 option to accept ISO C89... (cached) none needed
checking for pkg-config... yes
configure: creating ./config.status
config.status: creating src/Makevars
fftwtools 0.9-10
================
compiler flags: -I/usr/local/include
link argument: -L/usr/local/lib -lfftw3
** libs
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -fdebug-prefix-map=/build/r-base-i2PIHO/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c fftwtools.c -o fftwtools.o
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -fdebug-prefix-map=/build/r-base-i2PIHO/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c fftwtools_init.c -o fftwtools_init.o
gcc -std=gnu99 -std=gnu11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o fftwtools.so fftwtools.o fftwtools_init.o -L/usr/local/lib -lfftw3 -L/usr/lib/R/lib -lR
/usr/bin/ld: /usr/local/lib/libfftw3.a(assert.o): relocation R_X86_64_PC32 against symbol `stdout@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: fftwtools.so] Error 1
ERROR: compilation failed for package ‘fftwtools’
* removing ‘/usr/local/lib/R/site-library/fftwtools’
The downloaded source packages are in
‘/tmp/Rtmp4FsjOe/downloaded_packages’
Warning message:
In install.packages("fftwtools") :
installation of package ‘fftwtools’ had non-zero exit status
>
In response to Karim's suggestion, I built the fftw from tarball fftw-3.3.10.tar.gz as follows:
./configure --enable-threads --enable-openmp --enable-avx
make
make install
This created several libfftw3*.* files in /usr/local/lib :
drwxr-xr-x 7 root root 4096 Feb 27 10:53 .
drwxr-xr-x 10 root root 4096 Apr 27 2018 ..
drwxr-xr-x 3 root root 4096 Feb 27 10:52 cmake
-rw-r--r-- 1 root root 3581658 Feb 27 10:52 libfftw3.a
-rwxr-xr-x 1 root root 888 Feb 27 10:52 libfftw3.la
-rw-r--r-- 1 root root 46990 Feb 27 10:53 libfftw3_omp.a
-rwxr-xr-x 1 root root 936 Feb 27 10:53 libfftw3_omp.la
-rw-r--r-- 1 root root 52098 Feb 27 10:53 libfftw3_threads.a
-rwxr-xr-x 1 root root 948 Feb 27 10:53 libfftw3_threads.la
drwxr-xr-x 2 root root 4096 Feb 27 10:52 pkgconfig
drwxrwsr-x 4 root staff 4096 Mar 13 2021 python2.7
drwxrwsr-x 3 root staff 4096 Aug 3 2020 python3.8
drwxrwsr-x 3 root staff 4096 May 26 2018 R
Then I attempted to install fftwtools from CRAN, but this produced the same error messaged that prompted my original posting.
Solution 1:[1]
I have not come across this problem before, but the build file has been updated in attempt to accomodate multiple systems.
Can you try building fftw from the tarball?
So remove the ubuntu packages, then install fftw from the tarball, and let me know if you get the same error.
http://www.fftw.org/download.html
Best wishes,
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Karim |
