[R-SIG-Mac] R 3.0.1 build from sources: Wrong library paths

Simon Zehnder szehnder at uni-bonn.de
Thu Sep 12 17:16:12 CEST 2013


Simon,

thanks for the help. This did make the work. I wonder why the --bindir and --sbindir options during configure did not let that happen. 

R runs on my system and here is what I precisely did:

1. Install XCode (newest version)
2. Install Command Line Tools (in XCode) 
3. On the shell I used sudo xcodebuild -license
4. I installed MacTex and MacPorts
5. In MacPorts I installed the ports: gcc48 (GCC 4-8-1 Compiler), valgrind-devel, gettext
6. I had to remove /usr/local/bin and /usr/local/sbin from my PATH variable, as these folders do not exist.
7. I had to add /usr/texbin to the PATH variable for R to find the pdflatex command. 
8. Then I installed the Oracle JDK and added this to the config.site file in the R-3.0.1 folder: 
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/HomeJAVA_CPPFLAGS="-I/${JAVA_HOME}/include -I/${JAVA_HOME}/include/darwin"
JAVA_LD_LIBRARY_PATH="${JAVA_HOME}/jre/lib/server"
JAVA_LIBS="-L/${JAVA_HOME}/jre/lib/server -ljvm"
9. On the shell I used:
export LANG=en_US.UTF-8
export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/usr/lib/pkgconfig
10. In a '~/Downloads/build' folder run:
../R-3.0.1/configure --bindir=/usr/bin --sbindir=/usr/bin --with-system-zlib --enable-memory-profiling --with-blas="-framework Accelerate" --with-lapack --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib --with-valgrind-instrumentation=2 OBJC="clang" LDFLAGS=-L/opt/local/lib CPPFLAGS=-I/opt/local/include
11. make && make check && sudo make install 
12. I run on the shell (do not know why --bindir and --sbindir didn't make it) 
sudo ln -s /Library/Frameworks/R.framework/Resources/bin/R /usr/bin/R
13. I had to add 
export LANG=en_US.UTF-8 in .profile
(defaults write org.R-project.R force.LANG en_US.UTF-8 did not work, did it several times with reopening the terminal)

All seemed to work fine. I installed the package nloptr (which did not install in my last R app) and it did compile without a hassle (that's great!). But then with Rcpp I got the error: ld: library not found for -lintl. I looked into the files of the gcc48 of MacPorts under /opt/local/lib and I have three libraries in there: libintl.8.dylib, libintl.a, libintl.la. I do not know though if this error wrong linking via R's environment variables or I miss an export in my .profile. 

I also have now a warning when using MacPorts, which is already reported: http://openradar.appspot.com/11894054

Here is my config.log

https://gist.github.com/anonymous/6539093

and here the output from Sys.getenv():

https://gist.github.com/anonymous/6539133

So, I cannot tell, if this should be considered a stable build on the Mac. But maybe everything can be solved quite easily. 


Best

Simon


On Sep 12, 2013, at 2:54 PM, Simon Urbanek <simon.urbanek at r-project.org> wrote:

> 
> On Sep 12, 2013, at 5:50 AM, Simon Zehnder wrote:
> 
>> I compiled R and made a check-all without errors (only for the PDF manuals - but this is ok). Then I used
>> 
>> sudo make install 
>> 
>> to install it to the R.framework. Now, when I want to use R on the shell no command can be found, as the installation has not installed the binaries in /usr/bin. If I try to change my PATH variable and add /Library/Frameworks/R.framework/Ressources/bin it does not change a thing, I still get the error: -bash: R: command not found. The only thing to make it work is to go into the folder /Libraries/Frameworks/R.framework/Ressources/bin/ and start it via ./R.
>> 
> 
> What the CRAN installer does is essentially
> 
> sudo ln -s /Library/Frameworks/R.framework/Resources/bin/R /usr/bin/R
> 
> Obviously, changing the PATH works as well  - make sure you check the value of PATH in the session you're running (bash uses a cached lookup, but recent versions should have no trouble re-trying after PATH changes) -- assuming running
> /Libraries/Frameworks/R.framework/Ressources/bin/R
> works. If it doesn't then maybe check the version symlinks.
> 
> Re you earlier post - FSF builds of gcc don't support ObjC with Apple runtime, so you have to use Apple's clang (as you did). In my tests few months ago gcc 4.7/4.8 was too unreliable - it was miscompiling R so things were breaking randomly at run-time. If your build seems reliable, please share with use the exact version and settings.
> 
> Thanks,
> Simon
> 
> 
>> I remember no such behaviour for prior builds of R. It seems Mac has changed something since my last compilation of R sources. 
>> 
>> Can anyone help?
>> 
>> Best
>> 
>> Simon
>> 
>> On Sep 12, 2013, at 10:49 AM, Simon Zehnder <szehnder at uni-bonn.de> wrote:
>> 
>>> I did some progress on my problem: 
>>> 
>>> Using LDFLAGS and CPPFLAGS on the shell instead of in the config.site file changes the directories and make can find all the libraries. 
>>> 
>>> The next thing that came up, was the Mac-specific Cocoa issue. When I compile R sources with OBJC="gcc -arch x86_64" I get the following outputs: 
>>> 
>>> config.log: https://gist.github.com/anonymous/6534550
>>> 
>>> make.log: https://gist.github.com/anonymous/6534560
>>> 
>>> with errors starting in line 883 of the make.log. So it seems the gcc cannot handle the .m files properly. 
>>> 
>>> Then I used OBJC="clang" and I get the following output:
>>> 
>>> config.log: https://gist.github.com/anonymous/6534614
>>> 
>>> make.log: https://gist.github.com/anonymous/6534606
>>> 
>>> Here I get (see line 879 in the make.log) some weird warning. I know these are only warnings, they do not influence the way R works later on, but I am interested why gcc cannot handle the Cocoa files at all and clang has these warnings.
>>> 
>>> 
>>> Best
>>> 
>>> Simon
>>> 
>>> 
>>> On Sep 11, 2013, at 11:08 PM, Simon Zehnder <szehnder at uni-bonn.de> wrote:
>>> 
>>>> Dear R-Users and R-Devels,
>>>> 
>>>> I made a brand new install of Mac OS X Mountain Lion 10.8.4 on a new hard drive and want to build R from sources. As I use OpenMP 3.1 in my C++ extensions I used MacPorts to get the gcc48 compiler collection. Installation run without a hassle and I set the mp-gcc48 active. 
>>>> 
>>>> I downloaded the R-3.0.1 tar.gz and extracted it. Then I changed the config.site to the following:
>>>> 
>>>> https://gist.github.com/anonymous/6529767
>>>> 
>>>> Furthermore I had to change my PATH variable in the .profile as it included /usr/local/bin:/usr/local/sbin and I have not such a folder in my /usr. 
>>>> 
>>>> Now when I run configure I get the following config.log
>>>> 
>>>> https://gist.github.com/anonymous/6529743
>>>> 
>>>> with the warning:  "ld: warning: directory not found for option '-L/usr/local/lib' "on line 217. This warning becomes an error if running the make command. I still see the C linker using -L/usr/local/lib which does not exist. I changed the LDFLAGS in the config.site to -L/opt/local/lib but Rs configure script seems to be very resistant to my new proposal. 
>>>> 
>>>> I need some help. How should I proceed? Which FLAGS can change the directory the make script searches for libraries? What configure options should be used with R-3.0.1 on OS X 10.8.4 using gcc-4.8.1?    
>>>> 
>>>> 
>>>> Best
>>>> 
>>>> Simon
>>>> 
>>>> _______________________________________________
>>>> R-SIG-Mac mailing list
>>>> R-SIG-Mac at r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>> 
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>> 
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>> 
>> 
> 



More information about the R-SIG-Mac mailing list