title: R data.table compiled installation failing: Error: shared object ‘datatable.so’ not found
body: <p>I'm installing R on a new laptop (no migration from a previous laptop or OS version).
  R 4.0.1 installed fine.</p>
  <pre><code>&gt; sessionInfo()
  R version 4.0.1 (2020-06-06)
  Platform: x86_64-apple-darwin17.0 (64-bit)
  Running under: macOS Catalina 10.15.5
  
  Matrix products: default
  BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
  LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
  
  locale:
  [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  loaded via a namespace (and not attached):
  [1] compiler_4.0.1 tools_4.0.1  
  </code></pre>
  <p>Then I move on to install data.table:</p>
  <pre><code>&gt; install.packages(&quot;data.table&quot;)
  trying URL 'https://cran.revolutionanalytics.com/bin/macosx/contrib/4.0/data.table_1.12.8.tgz'
  Content type 'application/octet-stream' length 2070859 bytes (2.0 MB)
  ==================================================
  downloaded 2.0 MB
  
  
  The downloaded binary packages are in
      /var/folders/tg/5sw17w2n28g_2n1c_cs0ydlw0000gn/T//RtmpU0QnBY/downloaded_packages
  </code></pre>
  <p>Seems fine. But when I load it:</p>
  <pre><code>&gt; library(data.table)
  data.table 1.12.8 using 1 threads (see ?getDTthreads).  Latest news: r-datatable.com
  **********
  This installation of data.table has not detected OpenMP support. It should still work but in single-threaded mode. If this is a Mac, please ensure you are using R&gt;=3.4.0 and have followed our Mac instructions here: https://github.com/Rdatatable/data.table/wiki/Installation. This warning message should not occur on Windows or Linux. If it does, please file a GitHub issue.
  **********
  </code></pre>
  <p>I want to use multiple cores so I go to the suggested web page above and follow instructions there. I do all three steps and they all seem to work (no error messages).</p>
  <ol>
  <li>install command line tools with &quot;xcode-select --install&quot;</li>
  <li>install Brew and then &quot;brew update &amp;&amp; brew install llvm&quot;</li>
  <li>finally create and edit &quot;~/.R/Makevars&quot; as suggested.</li>
  </ol>
  <p>At this point I go back and try installing data.table and compiling it with:</p>
  <pre><code>&gt; install.packages(&quot;data.table&quot;, type = &quot;source&quot;,
  +     repos = &quot;https://Rdatatable.gitlab.io/data.table&quot;)
  trying URL 'https://Rdatatable.gitlab.io/data.table/src/contrib/data.table_1.12.9.tar.gz'
  Content type 'application/gzip' length 5207555 bytes (5.0 MB)
  ==================================================
  downloaded 5.0 MB
  
  * installing *source* package ‘data.table’ ...
  ** using staged installation
  *** pkg-config is not installed.
  *** Compilation will now be attempted and if it works you can ignore this message. However,
  *** if compilation fails, try 'locate zlib.h zconf.h' and ensure the zlib development library
  *** is installed :
  ***   deb: zlib1g-dev (Debian, Ubuntu, ...)
  ***   rpm: zlib-devel (Fedora, EPEL, ...)
  ***   brew: zlib (OSX)
  *** Note that zlib is required to compile R itself so you may find the advice in the R-admin
  *** guide helpful regarding zlib. On Debian/Ubuntu, zlib1g-dev is a dependency of r-base as
  *** shown by 'apt-cache showsrc r-base | grep ^Build-Depends | grep zlib', and therefore
  *** 'sudo apt-get build-dep r-base' should be sufficient too.
  *** To silence this message, please ensure that :
  ***   1) 'pkg-config --exists zlib' succeeds (i.e. $? -eq 0)
  ***   2) 'pkg-config --libs zlib' contains -lz
  *** Compilation will now be attempted ...
  ** libs
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c assign.c -o assign.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c between.c -o between.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c bmerge.c -o bmerge.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c chmatch.c -o chmatch.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c cj.c -o cj.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c coalesce.c -o coalesce.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c dogroups.c -o dogroups.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fastmean.c -o fastmean.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fcast.c -o fcast.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fifelse.c -o fifelse.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fmelt.c -o fmelt.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c forder.c -o forder.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c frank.c -o frank.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fread.c -o fread.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c freadR.c -o freadR.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c froll.c -o froll.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c frollR.c -o frollR.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c frolladaptive.c -o frolladaptive.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fsort.c -o fsort.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fwrite.c -o fwrite.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fwriteR.c -o fwriteR.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c gsumm.c -o gsumm.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c ijoin.c -o ijoin.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c init.c -o init.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c inrange.c -o inrange.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c nafill.c -o nafill.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c nqrecreateindices.c -o nqrecreateindices.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c openmp-utils.c -o openmp-utils.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c quickselect.c -o quickselect.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c rbindlist.c -o rbindlist.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c reorder.c -o reorder.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c shift.c -o shift.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c snprintf.c -o snprintf.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c subset.c -o subset.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c transpose.c -o transpose.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c types.c -o types.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c uniqlist.c -o uniqlist.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c utils.c -o utils.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c vecseq.c -o vecseq.o
  /usr/local/opt/llvm/bin/clang -fopenmp -I&quot;/Library/Frameworks/R.framework/Resources/include&quot; -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c wrappers.c -o wrappers.o
  /usr/local/opt/llvm/bin/clang -fopenmp -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -o data.table.so assign.o between.o bmerge.o chmatch.o cj.o coalesce.o dogroups.o fastmean.o fcast.o fifelse.o fmelt.o forder.o frank.o fread.o freadR.o froll.o frollR.o frolladaptive.o fsort.o fwrite.o fwriteR.o gsumm.o ijoin.o init.o inrange.o nafill.o nqrecreateindices.o openmp-utils.o quickselect.o rbindlist.o reorder.o shift.o snprintf.o subset.o transpose.o types.o uniqlist.o utils.o vecseq.o wrappers.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
  installing to /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-data.table/00new/data.table/libs
  ** R
  ** inst
  ** byte-compile and prepare package for lazy loading
  ** help
  *** installing help indices
  ** building package indices
  ** installing vignettes
  ** testing if installed package can be loaded from temporary location
  Error: package or namespace load failed for ‘data.table’ in library.dynam(lib, package, package.lib):
   shared object ‘datatable.so’ not found
  Error: loading failed
  Execution halted
  ERROR: loading failed
  * removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/data.table’
  
  The downloaded source packages are in
      ‘/private/var/folders/tg/5sw17w2n28g_2n1c_cs0ydlw0000gn/T/RtmpU0QnBY/downloaded_packages’
  Warning message:
  In install.packages(&quot;data.table&quot;, type = &quot;source&quot;, repos = &quot;https://Rdatatable.gitlab.io/data.table&quot;) :
    installation of package ‘data.table’ had non-zero exit status
  </code></pre>
  <p>Didn't work.</p>
  <p>What does the error message mean &quot;Error: package or namespace load failed for ‘data.table’ in library.dynam(lib, package, package.lib):
  shared object ‘datatable.so’ not found&quot; ???</p>