[R-SIG-Mac] C extension, Makevars ignores PKG_LIBS

Simon Urbanek simon.urbanek at r-project.org
Tue Nov 8 18:50:13 CET 2011


Tyler,

what you claim is certainly not true:

leotest:AA urbanek$ cat src/Makevars 
PKG_CFLAGS = -ImyCFLAGS
PKG_LIBS = -LmyLIBS

leotest:AA urbanek$ ls src
Makevars	foo.c

leotest:AA urbanek$ R CMD INSTALL --build .
* installing to library ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library’
* installing *source* package ‘AA’ ...
** Creating default NAMESPACE file
** libs
*** arch - i386
gcc-4.2 -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386  -I/usr/local/include   -ImyCFLAGS -fPIC  -g -O2 -c foo.c -o foo.o
gcc-4.2 -arch i386 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o AA.so foo.o -LmyLIBS -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-LmyLIBS'
installing to /Library/Frameworks/R.framework/Versions/2.14/Resources/library/AA/libs/i386
*** arch - x86_64
gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64  -I/usr/local/include   -ImyCFLAGS -fPIC  -g -O2 -c foo.c -o foo.o
gcc-4.2 -arch x86_64 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o AA.so foo.o -LmyLIBS -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-LmyLIBS'
installing to /Library/Frameworks/R.framework/Versions/2.14/Resources/library/AA/libs/x86_64
** help
No man pages found in package  ‘AA’ 
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
packaged installation of ‘AA’ as ‘AA_0.1-1.tgz’

* DONE (AA)

so can you supply a bit more, such as your actual package and actual output?

Cheers,
Simon


On Nov 8, 2011, at 12:21 PM, Tyler Pirtle wrote:

> Hi there,
> 
> I've got a sample C project I'm trying to get built correctly, but as
> you may have guessed from the subject
> line, the compilation is missing some things.
> 
> 
> rtp-macbookpro:foo rtp$ R CMD INSTALL --build .
> * installing to library
> ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library’
> * installing *source* package ‘foo’ ...
> ** Creating default NAMESPACE file
> ** libs
> *** arch - i386
> gcc-4.2 -arch i386 -std=gnu99
> -I/Library/Frameworks/R.framework/Resources/include
> -I/Library/Frameworks/R.framework/Resources/include/i386
> -I/usr/local/include    -fPIC  -g -O2 -c foo.c -o foo.o
> foo.c:1:17: error: some_library.h: No such file or directory
> ...
> 
> Where foo.c includes some_library.h.
> 
> My makevars:
> PKG_CFLAGS = -I/usr/include/some/library
> PKG_LIBS = -lsomelib -L/usr/local/lib/somelib
> 
> As you can see from the gcc args that were constructed, my PKG_*
> definitions are nowhere to be found. I thought it might have been
> a problem with just my setup, but as it turns out I've not been able
> to build _any_ C extensions for R packages on the mac at all.
> 
> What am I missing? ;)
> Thanks,
> 
> 
> Tyler
> 
> _______________________________________________
> 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