statnet / ergm

Fit, Simulate and Diagnose Exponential-Family Models for Networks
Other
94 stars 36 forks source link

Error installing ergm due to lpSolveAPI compilation error #558

Closed alexcaldarone closed 2 months ago

alexcaldarone commented 2 months ago

Hi, I am trying to install the package ergm, but I keep getting an error (I believe this is due to the dependency lpSolveAPI) not being compiled correctly. I have tried searching some fixes but nothing seems to work so far.

Here is the error I get:

> install.packages("ergm", dependencies = TRUE)
Installing package into ‘/home/alex/R/x86_64-pc-linux-gnu-library/4.3’
(as ‘lib’ is unspecified)
also installing the dependencies ‘lpSolveAPI’, ‘ergm.count’, ‘Rglpk’, ‘slam’

trying URL 'https://cloud.r-project.org/src/contrib/lpSolveAPI_5.5.2.0-17.11.tar.gz'
Content type 'application/x-gzip' length 492377 bytes (480 KB)
==================================================
downloaded 480 KB

trying URL 'https://cloud.r-project.org/src/contrib/ergm.count_4.1.1.tar.gz'
Content type 'application/x-gzip' length 1376945 bytes (1.3 MB)
==================================================
downloaded 1.3 MB

trying URL 'https://cloud.r-project.org/src/contrib/Rglpk_0.6-5.1.tar.gz'
Content type 'application/x-gzip' length 22100 bytes (21 KB)
==================================================
downloaded 21 KB

trying URL 'https://cloud.r-project.org/src/contrib/slam_0.1-50.tar.gz'
Content type 'application/x-gzip' length 53641 bytes (52 KB)
==================================================
downloaded 52 KB

trying URL 'https://cloud.r-project.org/src/contrib/ergm_4.6.0.tar.gz'
Content type 'application/x-gzip' length 3198102 bytes (3.0 MB)
==================================================
downloaded 3.0 MB

* installing *source* package ‘lpSolveAPI’ ...
** package ‘lpSolveAPI’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
gcc -I"/usr/share/R/include" -DNDEBUG -I../inst/include      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c RlpSolve.c -o RlpSolve.o
gcc -I"/usr/share/R/include" -DNDEBUG -I../inst/include      -fpic  -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c RlpSolveLink.c -o RlpSolveLink.o
make[1]: Entering directory '/tmp/RtmpfHTKoS/R.INSTALL4baa7b040c6e/lpSolveAPI/src/lp_solve'
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c colamd.c -o colamd.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_MDO.c -o lp_MDO.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_mipbb.c -o lp_mipbb.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_rlp.c -o lp_rlp.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c mmio.c -o mmio.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c commonlib.c -o commonlib.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_MPS.c -o lp_MPS.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_params.c -o lp_params.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_scale.c -o lp_scale.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_SOS.c -o lp_SOS.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_presolve.c -o lp_presolve.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_simplex.c -o lp_simplex.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c yacc_read.c -o yacc_read.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c ini.c -o ini.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_crash.c -o lp_crash.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_price.c -o lp_price.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_utils.c -o lp_utils.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_Hash.c -o lp_Hash.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_lib.c -o lp_lib.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_pricePSE.c -o lp_pricePSE.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_wlp.c -o lp_wlp.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_LUSOL.c -o lp_LUSOL.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_matrix.c -o lp_matrix.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lp_report.c -o lp_report.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c lusol.c -o lusol.o
gcc -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fpic  -I../../inst/include -I/usr/share/R/include -DYY_NO_INPUT -DR_EMBEDDED_LPSOLVE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c myblas.c -o myblas.o
ar rc liblp_solve.a colamd.o lp_MDO.o lp_mipbb.o lp_rlp.o mmio.o commonlib.o lp_MPS.o lp_params.o lp_scale.o lp_SOS.o lp_presolve.o lp_simplex.o yacc_read.o ini.o lp_crash.o lp_price.o lp_utils.o lp_Hash.o lp_lib.o lp_pricePSE.o lp_wlp.o lp_LUSOL.o lp_matrix.o lp_report.o lusol.o myblas.o && ranlib liblp_solve.a
make[1]: Leaving directory '/tmp/RtmpfHTKoS/R.INSTALL4baa7b040c6e/lpSolveAPI/src/lp_solve'
gcc -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o lpSolveAPI.so RlpSolve.o RlpSolveLink.o -Llp_solve -llp_solve -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -llapack: No such file or directory
/usr/bin/ld: cannot find -lblas: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: lpSolveAPI.so] Error 1
ERROR: compilation failed for package ‘lpSolveAPI’
* removing ‘/home/alex/R/x86_64-pc-linux-gnu-library/4.3/lpSolveAPI’
Warning in install.packages :
  installation of package ‘lpSolveAPI’ had non-zero exit status
* installing *source* package ‘slam’ ...
** package ‘slam’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c apply.c -o apply.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c dll.c -o dll.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c grouped.c -o grouped.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c sparse.c -o sparse.o
gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -ffile-prefix-map=/build/r-base-14Q6vq/r-base-4.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c util.c -o util.o
gcc -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o slam.so apply.o dll.o grouped.o sparse.o util.o -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lblas: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: slam.so] Error 1
ERROR: compilation failed for package ‘slam’
* removing ‘/home/alex/R/x86_64-pc-linux-gnu-library/4.3/slam’
Warning in install.packages :
  installation of package ‘slam’ had non-zero exit status
ERROR: dependency ‘slam’ is not available for package ‘Rglpk’
* removing ‘/home/alex/R/x86_64-pc-linux-gnu-library/4.3/Rglpk’
Warning in install.packages :
  installation of package ‘Rglpk’ had non-zero exit status
ERROR: dependency ‘lpSolveAPI’ is not available for package ‘ergm’
* removing ‘/home/alex/R/x86_64-pc-linux-gnu-library/4.3/ergm’
Warning in install.packages :
  installation of package ‘ergm’ had non-zero exit status
ERROR: dependency ‘ergm’ is not available for package ‘ergm.count’
* removing ‘/home/alex/R/x86_64-pc-linux-gnu-library/4.3/ergm.count’
Warning in install.packages :
  installation of package ‘ergm.count’ had non-zero exit status

In particular, here is the error relating to the compilation of lpSolveAPI:

/usr/bin/ld: cannot find -llapack: No such file or directory
/usr/bin/ld: cannot find -lblas: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: lpSolveAPI.so] Error 1
ERROR: compilation failed for package ‘lpSolveAPI’
* removing ‘/home/alex/R/x86_64-pc-linux-gnu-library/4.3/lpSolveAPI’
Warning in install.packages :
  installation of package ‘lpSolveAPI’ had non-zero exit status

Thank you very much for your help!

alexcaldarone commented 2 months ago

I have solved the problem. It seems to have been caused by the libraries LAPACK and BLAS not being installed.

For future reference, I have solved the issue by running

sudo apt-get update
sudo apt-get install liblapack-dev libblas-dev

and then

install.packages("ergm", dependencies = TRUE)