我尝试了很多方法,但还是出现这个错误。当我尝试安装 RMariaDB 和 RMysql 时,情况类似。
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RMariaDB.so DbConnection.o DbResult.o MariaBinding.o MariaResultImpl.o MariaResultPrep.o MariaResultSimple.o MariaRow.o MariaTypes.o MariaUtils.o RcppExports.o connection.o driver.o result.o -L/usr/lib/x86_64-linux-gnu/ -lmariadb -lz -ldl -lm -lpthread -lssl -lcrypto -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'RMariaDB.so' failed
make: *** [RMariaDB.so] Error 1
ERROR: compilation failed for package ‘RMariaDB’
* removing ‘/home/panos/R/x86_64-pc-linux-gnu-library/3.6/RMariaDB’
Warning in install.packages :
installation of package ‘RMariaDB’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmppKrDU5/downloaded_packages’
答案1
根据您的错误信息
/usr/bin/ld: cannot find -lz
缺少 zlib 库的开发文件。使用
sudo apt-get install zlib1g-dev
安装缺少的文件。