##############################################################################
##############################################################################
###
### Running command:
###
###   rm -rf scmap.buildbin-libdir && mkdir scmap.buildbin-libdir && /Users/biocbuild/BBS/utils/build-universal.sh scmap_1.22.3.tar.gz /Library/Frameworks/R.framework/Resources/bin/R scmap.buildbin-libdir
###
##############################################################################
##############################################################################


>>>>>>> 
>>>>>>> INSTALLATION WITH 'R CMD INSTALL --preclean --no-multiarch --library=scmap.buildbin-libdir scmap_1.22.3.tar.gz'
>>>>>>> 

* installing *source* package ‘scmap’ ...
** using staged installation
** libs
using C++ compiler: ‘Apple clang version 14.0.0 (clang-1400.0.29.202)’
using SDK: ‘MacOSX11.3.sdk’
clang++ -arch arm64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/RcppArmadillo/include' -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
clang++ -arch arm64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/RcppArmadillo/include' -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c scmap.cpp -o scmap.o
clang++ -arch arm64 -std=gnu++17 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o scmap.so RcppExports.o scmap.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0 -L/opt/gfortran/lib -lgfortran -lemutls_w -lquadmath -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: could not create compact unwind for ___emutls_get_address: registers 23 and 24 not saved contiguously in frame
installing to /Users/biocbuild/bbs-3.17-bioc-mac-arm64/meat/scmap.buildbin-libdir/00LOCK-scmap/00new/scmap/libs
** R
** data
*** moving datasets to lazyload DB
** 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
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (scmap)


>>>>>>> 
>>>>>>> FIXING PATHS TO DYNAMIC LIBRARIES FOR scmap.buildbin-libdir/scmap/libs/scmap.so
>>>>>>> 

>>>>>>> Paths before fix:
scmap.buildbin-libdir/scmap/libs/scmap.so:
	scmap.so (compatibility version 0.0.0, current version 0.0.0)
	/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib (compatibility version 4.3.0, current version 4.3.1)
	/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
	/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libR.dylib (compatibility version 4.3.0, current version 4.3.1)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1775.118.101)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 905.6.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)

>>>>>>> Fix with install_name_tool:
install_name_tool -change "/usr/local/lib/libgcc_s.1.1.dylib" "/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libgcc_s.1.1.dylib" "scmap.buildbin-libdir/scmap/libs/scmap.so"
install_name_tool -change "/usr/local/lib/libgfortran.5.dylib" "/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libgfortran.5.dylib" "scmap.buildbin-libdir/scmap/libs/scmap.so"
install_name_tool -change "/usr/local/lib/libquadmath.0.dylib" "/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libquadmath.0.dylib" "scmap.buildbin-libdir/scmap/libs/scmap.so"
install_name_tool -change "/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib" "/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libgfortran.5.dylib" "scmap.buildbin-libdir/scmap/libs/scmap.so"
install_name_tool -change "/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libquadmath.0.dylib" "/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libquadmath.0.dylib" "scmap.buildbin-libdir/scmap/libs/scmap.so"

>>>>>>> Paths after fix:

scmap.buildbin-libdir/scmap/libs/scmap.so:
	scmap.so (compatibility version 0.0.0, current version 0.0.0)
	/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib (compatibility version 4.3.0, current version 4.3.1)
	/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
	/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libR.dylib (compatibility version 4.3.0, current version 4.3.1)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1775.118.101)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 905.6.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)