Skip to content
Prev 10868 / 21312 Next

[Bioc-devel] xps build problem on veracruz2

Hi Christian,

So I installed ROOT 5 from source on veracruz2. It's in
/usr/local/root.

However, Apple's SIP (System Integrity Protection, new and
enabled by default on El Capitan) is getting in the way when
trying to install xps. That's because xps configure and build
process relies on DYLD_LIBRARY_PATH. Problem is that this
environment variable (and any other variables that control
dynamic loading) is not inherited by child processes when SIP
is on:

veracruz2:~ biocbuild$ if test "${DYLD_LIBRARY_PATH}"; then echo 'yep!'; 
else echo 'nope!'; fi
yep!

veracruz2:~ biocbuild$ sh
sh-3.2$ if test "${DYLD_LIBRARY_PATH}"; then echo 'yep!'; else echo 
'nope!'; fi
nope!

That breaks xps configure script:

veracruz2:~ biocbuild$ export LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH

veracruz2:~ biocbuild$ echo $LD_LIBRARY_PATH
/usr/local/mysql/lib:/usr/local/root/lib/root:/ImageMagick-7.0.5/lib:/usr/local/ensembl-vep/htslib

veracruz2:~ biocbuild$ R CMD INSTALL xps
* installing to library 
?/Library/Frameworks/R.framework/Versions/3.4/Resources/library?
* installing *source* package ?xps? ...
checking for gcc... clang
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ANSI C... none needed
checking how to run the C preprocessor... clang -E
checking for gcc... (cached) clang
checking whether we are using the GNU C compiler... (cached) yes
checking whether clang accepts -g... (cached) yes
checking for clang option to accept ANSI C... (cached) none needed
found ROOT version 5.34/36 in directory /usr/local/root

xps configuration error:

    You must set the shell variable LD_LIBRARY_PATH to the
    directory where ROOT resides and re-run R CMD INSTALL
    e.g., (using Bourne shell syntax):

       export "LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH"
       R CMD INSTALL xps

    Please consult the README file for more information

ERROR: configuration failed for package ?xps?
* removing 
?/Library/Frameworks/R.framework/Versions/3.4/Resources/library/xps?
* restoring previous 
?/Library/Frameworks/R.framework/Versions/3.4/Resources/library/xps?

That also breaks the dynlib mechanism because, after I managed to
produce xps.so, it turns out that this shared object is linked to
the ROOT libraries via the @rpath mechanism:

veracruz2:src biocbuild$ otool -L xps.so
xps.so:
	xps.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libGui.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCore.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCint.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libRIO.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libNet.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHist.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libGraf.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libGraf3d.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libGpad.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libTree.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libRint.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libPostscript.so (compatibility version 0.0.0, current version 
0.0.0)
	@rpath/libMatrix.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libPhysics.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libMathCore.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libThread.so (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 1226.10.1)
	@rpath/libGed.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libTreePlayer.so (compatibility version 0.0.0, current version 
0.0.0)
	@rpath/libTreeViewer.so (compatibility version 0.0.0, current version 
0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 
120.1.0)

so it can't be loaded in R:

 > dyn.load("xps.so")
Error in dyn.load("xps.so") :
   unable to load shared object 
'/Users/biocbuild/bbs-3.5-bioc/xps/src/xps.so':
   dlopen(/Users/biocbuild/bbs-3.5-bioc/xps/src/xps.so, 6): Library not 
loaded: @rpath/libGui.so
   Referenced from: /Users/biocbuild/bbs-3.5-bioc/xps/src/xps.so
   Reason: image not found

because R has no access to DYLD_LIBRARY_PATH:

 > Sys.getenv("DYLD_LIBRARY_PATH")
[1] ""

This can be addressed by adding the following flag when linking:

   -rpath $(shell $(ROOTCONFIG) --prefix)/lib

Do you think you can revisit xps configure and build process? Make sure
you test it on a machine where SIP is enabled.

Thanks,
H.
On 03/24/2017 12:14 PM, cstrato wrote: