[R] Build R package with libjpeg - Symbol not found: _jpeg_CreateCompress

DcInfSys1 p.quiz at web.de
Wed May 15 18:39:47 CEST 2013


I am trying to build an /Image Processing Package/, which has in the src-
folder a jpeg.c file which uses the libjpeg for reading/writing jpeg files.
I think this causes an error if i try to check my package. 

After the execution of "R CMD INSTALL ImagePackage"
i get the ImagePackage.tar.gz file,
with this i try "R CMD CHECK ImagePackage.tar.gz", 
Then i get the following error:

checking installed package size ... OK
* checking package directory ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* loading checks for arch ‘i386’
** checking whether the package can be loaded ... ERROR
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
 can not load shared object ‘/Users/work/
ImagePackage.Rcheck/ImagePackage/libs/i386/ImagePackage.so’ :
6): Symbol not found: _jpeg_CreateCompress
  Referenced from: /Users/work/
  Expected in: flat namespace
 in /Users/work/ ImagePackage.Rcheck/ImagePackage/libs/i386/ImagePackage.so
Error while loading the package/namespace for 'ImagePackage'
Execution halted

In the src-folder, i have a *Makevars* where i put the path to the

PKG_CPPFLAGS = -I/opt/local/include
PKG_LIBS = -L/opt/local/lib -ljpeg -lpng

#PKG_CPPFLAGS = -I/usr/include
#PKG_LIBS = -L/usr/lib64 -ljpeg -lpng

So i suppose that the linker knows where he can find the jpeg-library. 

My *namespace-file* has the content:

The *beginning of my c-file * is:
#include <R.h>
#include <Rinternals.h>
#include <jpeglib.h>
#include <jerror.h>

So i tried to compile directly my jpeg.c file with R CMD SHLIB, and this is
working. So i am confused why he can not find the jpeg_createCompress

Can anybody help? :-)

View this message in context: http://r.789695.n4.nabble.com/Build-R-package-with-libjpeg-Symbol-not-found-jpeg-CreateCompress-tp4667129.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list