rmacosinstall.packages

Package installation not working MacBook air M2


I'm trying to install the package mnormt, and I get the error below:

I can't figure out the problem.

code I run

install.packages("mnormt")

Complete Messages, warning and errors I get


  There is a binary version available but the source version is later:
       binary source needs_compilation
mnormt  2.1.0  2.1.1              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘mnormt’

trying URL 'https://cran.rstudio.com/src/contrib/mnormt_2.1.1.tar.gz'
Content type 'application/x-gzip' length 65806 bytes (64 KB)
==================================================
downloaded 64 KB

* installing *source* package ‘mnormt’ ...
** package ‘mnormt’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c biv-nt.f -o biv-nt.o
biv-nt.f:371:11:

  371 |       hs = sign( one, dh - r*dk )
      |           1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
biv-nt.f:372:11:

  372 |       ks = sign( one, dk - r*dh )
      |           1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c mnormt_init.c -o mnormt_init.o
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c rtmng.f -o rtmng.o
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c sadmvnt.f -o sadmvnt.o
sadmvnt.f:977:3:

  977 |  10      END DO
      |   1
Warning: Label 10 at (1) defined but not used [-Wunused-label]
sadmvnt.f:81:15:

   81 |       INFORM = MVNNIT( N, CORREL, LOWER, UPPER, INFIN, INFIS, D, E )
      |               1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
sadmvnt.f:218:38:

  218 |         IF ( MINCLS .LT. 0 ) SBRGNS = WORK(LENWRK)
      |                                      1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
sadmvnt.f:276:21:

  276 |             RGNCLS = RGNCLS*(MESH(DIVAXN)+1)/MESH(DIVAXN)
      |                     1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
sadmvnt.f:277:21:

  277 |             NWRGNS = NWRGNS*(MESH(DIVAXN)+1)/MESH(DIVAXN)
      |                     1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
sadmvnt.f:1275:24:

 1275 |                POINTS = PONTRS(SUBTMP)
      |                        1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
sadmvnt.f:1276:24:

 1276 |                POINTP = PONTRS(SUBTMP+1)
      |                        1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
sadmvnt.f:1284:21:

 1284 |             POINTS = PONTRS(SUBTMP)
      |                     1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
sadmvnt.f:1304:21:

 1304 |             POINTS = PONTRS(SUBTMP)
      |                     1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
sadmvnt.f:325:15:

  325 |          TOP = PONTRS(1)
      |               1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
sadmvnt.f:332:21:

  332 |             RGNCLS = RGNCLS*MESH(I)
      |                     1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
sadmvnt.f:337:18:

  337 |          RGNCLS = RGNCLS*(MESH(DIVAXN)+1)/MESH(DIVAXN)
      |                  1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
sadmvnt.f:1586:3:

 1586 |  10      END DO
      |   1
Warning: Label 10 at (1) defined but not used [-Wunused-label]
sadmvnt.f:1433:15:

 1433 |       INFORM = MVTNIT( N, NU, CORREL, LOWER, UPPER, INFIN, INFIS, D, E )
      |               1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
sadmvnt.f:1128:31:

 1128 |       INTEGER S, IXCHNG, LXCHNG, I, L
      |                               ^
Warning: 'lxchng' may be used uninitialized [-Wmaybe-uninitialized]
sadmvnt.f:805:72:

  805 |       END
      |                                                                        ^
Warning: '__result_bvn' may be used uninitialized [-Wmaybe-uninitialized]
sadmvnt.f:763:35:

  763 |       DOUBLE PRECISION FUNCTION BVN ( LOWER, UPPER, INFIN, CORREL )
      |                                   ^
note: '__result_bvn' was declared here
sadmvnt.f:1042:72:

 1042 |                   IF ( INFI(I) .NE. 1 ) YU = -EXP( -BMIN**2/2 )/SQTWPI
      |                                                                        ^
Warning: 'bmin' may be used uninitialized [-Wmaybe-uninitialized]
sadmvnt.f:939:41:

  939 |       DOUBLE PRECISION CVDIAG, AMIN, BMIN, DMIN, EMIN, YL, YU
      |                                         ^
note: 'bmin' was declared here
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c tvpack.f -o tvpack.o
tvpack.f:459:14:

  459 |          HS = SIGN( ONE, DH - R*DK )
      |              1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
tvpack.f:460:14:

  460 |          KS = SIGN( ONE, DK - R*DH )
      |              1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
tvpack.f:126:52:

  126 |       DOUBLE PRECISION ONE, ZRO, EPS, ZROS(3), HS(3), TVT
      |                                                    1
Warning: Unused variable 'hs' declared at (1) [-Wunused-variable]
tvpack.f:126:45:

  126 |       DOUBLE PRECISION ONE, ZRO, EPS, ZROS(3), HS(3), TVT
      |                                             1
Warning: Unused variable 'zros' declared at (1) [-Wunused-variable]
tvpack.f:286:72:

  286 |       END
      |                                                                        ^
Warning: 'fin' may be used uninitialized [-Wmaybe-uninitialized]
tvpack.f:262:58:

  262 |       DOUBLE PRECISION EI(NL), AI(NL), BI(NL), FI(NL), FIN, ERR, KRNRDT
      |                                                          ^
note: 'fin' was declared here
clang -mmacosx-version-min=10.13 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o mnormt.so biv-nt.o mnormt_init.o rtmng.o sadmvnt.o tvpack.o -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: ignoring file biv-nt.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file tvpack.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /usr/local/gfortran/lib/libquadmath.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /usr/local/gfortran/lib/libgfortran.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file rtmng.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file sadmvnt.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
installing to /Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-mnormt/00new/mnormt/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘mnormt’:
 .onLoad failed in loadNamespace() for 'mnormt', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-mnormt/00new/mnormt/libs/mnormt.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-mnormt/00new/mnormt/libs/mnormt.so, 0x0006): symbol not found in flat namespace (_rtmng_)
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/mnormt’
Warning in install.packages :
  installation of package ‘mnormt’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/hk/q08x2zts3vs0cs7rvt111_4r0000gn/T/RtmpIh1wlH/downloaded_packages’

R version

platform       x86_64-apple-darwin17.0     
arch           x86_64                      
os             darwin17.0                  
system         x86_64, darwin17.0          
status                                     
major          4                           
minor          2.1                         
year           2022                        
month          06                          
day            23                          
svn rev        82513                       
language       R                           
version.string R version 4.2.1 (2022-06-23)
nickname       Funny-Looking Kid

Machine

Macbook Air M2


Solution

  • Following @Ben Bolker comment,

    The problem was solved by selecting no for the question

      There is a binary version available but the source version is later:
           binary source needs_compilation
    mnormt  2.1.0  2.1.1              TRUE
    
    Do you want to install from sources the package which needs compilation? (Yes/no/cancel) 
    

    I'm still unsure why that happened. But problem fixed!