[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] Using R LinkingTo field to access igraph C++ library?

From: Ben Fifield
Subject: [igraph] Using R LinkingTo field to access igraph C++ library?
Date: Mon, 20 Apr 2015 20:53:20 -0400

Hello everyone - 

I am building an R package that makes use of the igraph C++ library to speed up some network operations that I have written in C++. I would like to build the package so that I do not have to include the entire igraph code base in the src folder. 

I understand that using the LinkingTo: field in the DESCRIPTION file (http://cran.r-project.org/doc/manuals/r-release/R-exts.html) allows users to call header files included in other packages. For instance, this is the case for any package relying on Rcpp. What I would like to do is to list the igraph R package in LinkingTo:, as the igraph R package contains the full igraph C++ library in its src folder. 

However, when I have tried doing this with igraph, the igraph.h header isn't found when running R CMD INSTALL. For instance, when I include the igraph.h header in the rcpparma_hello_world.cpp script and run R CMD INSTALL, I get the following error:

clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/igraph/include"   -fPIC  -O3 -pedantic -c rcpparma_hello_world.cpp -o rcpparma_hello_world.o
rcpparma_hello_world.cpp:4:10: fatal error: 'igraph.h' file not found
#include "igraph.h"
1 error generated.

My understanding is that this a consequence of igraph not including its header files in an inst/include folder, as these are all copied to a common location upon package installation, which the compiler can then search for when it detects igraph in LinkingTo.  

Does anyone have advice on how to access these header files without including the entire igraph code base in src, either with or without use of the LinkingTo: field? Any help would be hugely appreciated. 

Best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]