Невозможно собрать пакет rgdal на amazon linux AMI - PullRequest
0 голосов
/ 12 июня 2018

Я не могу собрать rgdal (см. Вывод в блоке кода ниже) на моем сервере AWS.Из обсуждения здесь и здесь я понимаю, что это как-то связано с отсутствующими библиотеками для geos и gdal, но ни одно из предложенных решений не работает.Если я запускаю sudo yum install libgdal1 libgdal1-dev libgeos libgeos-dev, я получаю следующий вывод:

Загруженные плагины: приоритеты, update-motd, upgrade-helper amzn-main
|2,1 КБ 00:00:00 amzn-updates
|2,5 КБ 00:00:00 1045 пакетов исключено из-за защиты приоритетов репозитория. Пакет libgdal1 недоступен.Пакет libgdal1-dev недоступен.Пакет geos-3.4.2-1.4.amzn1.x86_64 уже установлен и последняя версия Пакет libgeos-dev недоступен.Ничего не поделаешь

Я уже включил EPEL, но это не решает проблему.

К сожалению, я не очень разбираюсь в Linux и не знаю, как двигаться дальше...

R выводится после попытки установить rgdal:

> install.packages("rgdal", type="source")
Installing package into ‘/home/andrea/R/x86_64-redhat-linux-gnu-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/rgdal_1.3-2.tar.gz'
Content type 'application/x-gzip' length 1667049 bytes (1.6 MB)
==================================================
downloaded 1.6 MB

* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: CC: gcc -m64 -std=gnu99
configure: CXX: g++ -m64
configure: rgdal: 1.3-2
checking for /usr/bin/svnversion... no
configure: svn revision: 755
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 g++ -m64 accepts -g... yes
checking whether g++ -m64 supports C++11 features by default... no
checking whether g++ -m64 supports C++11 features with -std=gnu++11... yes
configure: C++11 support available
checking for gdal-config... /usr/local/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.0.0
checking GDAL version >= 1.11.4... yes
checking gdal: linking with --libs only... yes
checking GDAL: /usr/local/share/gdal/pcs.csv readable... yes
checking proj_api.h presence and usability... yes
./configure: line 3395: test: =: unary operator expected
checking PROJ version >= 4.8.0... yes
checking projects.h presence and usability... yes
/tmp/ccV0TCuc.o: In function `main':
/tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/proj_conf_test2.c:14: undefined reference to `pj_get_default_ctx'
/tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/proj_conf_test2.c:20: undefined reference to `pj_ctx_fclose'
collect2: error: ld returned 1 exit status
./configure: line 3511: ./proj_conf_test2: No such file or directory
checking PROJ.4: epsg found and readable... yes
/tmp/cczdLgSd.o: In function `main':
/tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/proj_conf_test3.c:14: undefined reference to `pj_get_default_ctx'
/tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/proj_conf_test3.c:20: undefined reference to `pj_ctx_fclose'
collect2: error: ld returned 1 exit status
./configure: line 3570: ./proj_conf_test3: No such file or directory
checking PROJ.4: conus found and readable... yes
configure: Package CPP flags:  -I/usr/local/include
configure: Package LIBS:  -L/usr/local/lib -lgdal -lproj
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c OGR_write.cpp -o OGR_write.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c gdal-bindings.cpp -o gdal-bindings.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c init.c -o init.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c inverser.c -o inverser.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c local_stubs.c -o local_stubs.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogr_geom.cpp -o ogr_geom.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c ogr_polygons.c -o ogr_polygons.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogr_proj.cpp -o ogr_proj.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogrdrivers.cpp -o ogrdrivers.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogrsource.cpp -o ogrsource.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c projectit.cpp -o projectit.o
g++ -m64 -std=gnu++11 -shared -L/usr/lib64/R/lib -L/usr/local/lib64 -o rgdal.so OGR_write.o gdal-bindings.o init.o inverser.o local_stubs.o ogr_geom.o ogr_polygons.o ogr_proj.o ogrdrivers.o ogrsource.o projectit.o -L/usr/local/lib -lgdal -lproj -L/usr/lib64/R/lib -lR
installing to /home/andrea/R/x86_64-redhat-linux-gnu-library/rgdal/libs
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
  converting help for package ‘rgdal’
    finding HTML links ... done
    CRS-class                               html  
    GDALDataset-class                       html  
    GDALDriver-class                        html  
    GDALMajorObject-class                   html  
    GDALRasterBand-class                    html  
    GDALReadOnlyDataset-class               html  
    GDALReadOnlyDataset-methods             html  
    GDALTransientDataset-class              html  
    GridsDatums                             html  
    RGB2PCT                                 html  
    SGDF2PCT                                html  
    SpatialGDAL-class                       html  
    closeDataset-methods                    html  
    displayDataset                          html  
    llgrid                                  html  
Rd warning: /tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/man/llgrid.Rd:11: missing file link ‘Spatial’
Rd warning: /tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/man/llgrid.Rd:16: missing file link ‘gridat’
Rd warning: /tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/man/llgrid.Rd:17: missing file link ‘gridat’
    make_EPSG                               html  
    nor2k                                   html  
    projInfo                                html  
    project                                 html  
    readGDAL                                html  
Rd warning: /tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/man/readGDAL.Rd:136: missing file link ‘flipVertical’
    readOGR                                 html  
    showWKT                                 html  
    spTransform-methods                     html  
    wrappers                                html  
    writeOGR                                html  
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘rgdal’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/andrea/R/x86_64-redhat-linux-gnu-library/rgdal/libs/rgdal.so':
  libgdal.so.20: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/andrea/R/x86_64-redhat-linux-gnu-library/rgdal’
Warning in install.packages :
  installation of package ‘rgdal’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpnAqQL2/downloaded_packages’

Ответы [ 2 ]

0 голосов
/ 30 сентября 2018

Обновите версию gcc до 5.xx, а затем выполните следующие действия (в зависимости от версии gcc у вас может быть другой файл libstdc ++. So.6.0.25):

cp / usr / local/lib64/libstdc++.so.6.0.25 / lib64 cd / lib64 rm -rf libstdc ++. so.6 ln -s libstdc ++. so.6.0.25 libstdc ++. so.6

0 голосов
/ 16 июня 2018

Проблема в том, что, хотя GDAL правильно собран, rgdal не может найти свои библиотеки.Это связано с тем, что AWS ec2 AMI не включает /usr/local/lib в путь поиска библиотек по умолчанию.Решение предоставлено в ответе на этот вопрос.

Вкратце:

  1. изменить /etc/ld.so.conf, используя sudo vi /etc/ld.so.conf, чтобы оно содержало: include /etc/ld.so.conf.d/*.conf.
  2. Редактировать / создать файл /etc/ld.so.conf.d/libc.conf, чтобы он содержал: /usr/local/lib
  3. Выполнить sudo ldconfig для сохранения изменений

Это делает библиотекивозможность поиска при сборке rgdal.

...