library not found for -lX11
But those paths should not be used unconditionally (as you have). They are not right for most x86_64 Linux, Solaris, ... and they might not even be right on Mac OS X (depending on the X installation). And PKG_CPPFLAGS was correct: that means flags for cpp, the C pre-processor, not for C++ (which is macro PKG_CXXFLAGS). See 'Writing R Extensions'.
On 29/11/2012 12:39, Jakson Alves de Aquino wrote:
On Thu, Nov 29, 2012 at 8:43 AM, jochen laubrock <jochen.laubrock at gmail.com> wrote:
Works for me after additionally setting PKG_CPPFLAGS to point to the headers in Makevars PKG_LIBS=-L/usr/X11/lib -lX11 PKG_CPPFLAGS=-I/usr/X11/include On Nov 29, 2012, at 12:18 , Jakson Alves de Aquino <jalvesaq at gmail.com> wrote:
On Wed, Nov 28, 2012 at 9:38 PM, Jakson Alves de Aquino <jalvesaq at gmail.com> wrote:
I submitted a package to CRAN: http://cran.r-project.org/web/packages/vimcom/index.html It builds on Linux without warnings, but there is the following error on Mac OS X: ld: library not found for -lX11 collect2: ld returned 1 exit status make: *** [vimcom.so] Error 1 ERROR: compilation failed for package 'vimcom' The complete log is here: http://www.r-project.org/nosvn/R.check/r-release-macosx-ix86/vimcom-00install.html I know that I have to edit the src/Makevars file, but I don't know what I should put there and I don't have access to any machine running Mac OS X to make tests. Any help will be appreciated.
I've found this: http://stackoverflow.com/questions/5841008/problem-in-linking-x11-in-mac-os-x So, it seems that a Makevars file with the following content would solve the problem: PKG_LIBS=-L/usr/X11/lib -lX11 I would be grateful if someone could try to build the package with the above change in the src/Makevars since, as I have said, I can't make tests.
I added PKG_CFLAGS because the code is in C. I'm grateful to Jochen Laubrock for finding the solution and for Federico Calboli for doing additional tests. The updated code is available at: https://github.com/jalvesaq/VimCom Best regards,
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595