簡體   English   中英

為什么在 Z3D945423F8E9496C429A5D8C645B4604FZ 20 上成功安裝 FFTW 3.3.10 后,安裝 R package fftwtools 失敗?

[英]Why does installation of R package fftwtools fail after successful installation of FFTW 3.3.10 on Ubuntu 20.04?

我的目標是在配備 Ubuntu 20.04 作為唯一操作系統的計算機上安裝 R package “fftwtools”。 在閱讀了之前關於stackoverflow的帖子后,我安裝了最新版本的fftw(3.3.10),包括使用的開發版本

sudo apt-get install fftw3-dev

我可以在 /usr/local/lib 中看到庫文件,如下所示:

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

但是,我在嘗試安裝 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
> 

為了響應 Karim 的建議,我從 tarball fftw-3.3.10.tar.gz 構建了 fftw,如下所示:

./configure --enable-threads --enable-openmp --enable-avx
make
make install

這在 /usr/local/lib 中創建了幾個 libfftw3*.* 文件:

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

然后我嘗試從 CRAN 安裝 fftwtools,但這產生了相同的錯誤消息,提示我原來的帖子。

我以前沒有遇到過這個問題,但是已經更新了構建文件以適應多個系統。

您可以嘗試從 tarball 構建 fftw 嗎?

所以刪除 ubuntu 包,然后從 tarball 安裝 fftw,如果你遇到同樣的錯誤,請告訴我。

http://www.fftw.org/download.html

最好的祝願,

c2d4u ("CRAN-to-Deb(ian)-For-Ubuntu") 存儲庫為您提供了一個二進制文件。 CRAN 的 Ubuntu 的自述文件中描述了如何設置它。

我維護了一個特定的 Rocker 容器變體,它連接 R 自己的install.packages以使用那些可用的二進制文件(它依賴於bspm包),它只是由install.packages("fftwtools")請求轉入二進制文件的安裝r-cran-fftwtools_0.9-11-1cran1.2004.0_amd64.deb (適用於 Ubuntu 20.04)——它負責處理所有依賴項。

您可以通過兩個或三個命令復制它(使用 Docker)

docker run --rm -ti rocker/r-bspm:20.04 bash

啟動容器,並啟動bash shell。 然后我更新索引並要求安裝:

apt update -qq
Rscript -e 'install.packages("fftwtools")'

這會照顧一切。 完整日志:

edd@rob:~$ docker run --rm -ti rocker/r-bspm:20.04 bash
root@14a6fb8a9329:/# apt update -qq
31 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@14a6fb8a9329:/# Rscript -e 'install.packages("fftwtools")'
Loading required package: utils
Tracing function "install.packages" in package "utils"
Install system packages as root...
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Hit http://security.ubuntu.com/ubuntu focal-security InRelease                                                                                                                                                    
Hit http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu focal InRelease                                                                                                                                          
Hit http://archive.ubuntu.com/ubuntu focal InRelease                                                                                                                                                              
Hit http://archive.ubuntu.com/ubuntu focal-updates InRelease                                                                                                                                                      
Hit http://ppa.launchpad.net/edd/r-4.0/ubuntu focal InRelease                                                                                                                                                     
Hit http://archive.ubuntu.com/ubuntu focal-backports InRelease                                                                                                                                                    
Hit http://ppa.launchpad.net/marutter/rrutter4.0/ubuntu focal InRelease                                                                                                                                           
Fetched 0 B in 0s (0 B/s)                                                                                                                                                                                         
Reading package lists... Done    
Building dependency tree          
Reading state information... Done
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libfftw3-double3 amd64 3.3.8-2ubuntu1 [728 kB]                                                                                                            
Get:2 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu focal/main amd64 r-cran-fftwtools amd64 0.9-11-1cran1.2004.0 [167 kB]                                                                                  
Fetched 895 kB in 0s (0 B/s)                                                                                                                                                                                      
Selecting previously unselected package libfftw3-double3:amd64.
(Reading database ... 20688 files and directories currently installed.)
Preparing to unpack .../libfftw3-double3_3.3.8-2ubuntu1_amd64.deb ...
Unpacking libfftw3-double3:amd64 (3.3.8-2ubuntu1) ...
Selecting previously unselected package r-cran-fftwtools.
Preparing to unpack .../r-cran-fftwtools_0.9-11-1cran1.2004.0_amd64.deb ...
Unpacking r-cran-fftwtools (0.9-11-1cran1.2004.0) ...
Setting up libfftw3-double3:amd64 (3.3.8-2ubuntu1) ...
Setting up r-cran-fftwtools (0.9-11-1cran1.2004.0) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
root@14a6fb8a9329:/# 

現在,這些都不依賴於 Docker ,我只是將它用作演示。 如果您按照上面鏈接的 README.md 中所述連接“c2d4u.team”存儲庫,則可以執行標准sudo apt install r-cran-fftwtool 如果您願意,您還可以查看bspm以通過install.packages()從 R 訪問它,但這實際上只是額外的。

如有任何具體問題,請在 r-sig-debian 列表中提問。

我有同樣的錯誤,我還不想升級到 R 4。 但是,使用命令sudo apt-get install libfftw3-dev安裝這個庫libfftw3-dev -dev 解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM