[Rcpp-devel] Trouble linking with Rcpp

Jonathon Love jon at thon.cc
Tue Jul 8 15:58:04 CEST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

thanks for your speedy response dirk!

> | I have an R install which I can link my application against, and
> that | all works fine, but whenever I try and use a new R
> installation, | linking against Rcpp always fails. (I guess I
> fluked it the first time)
> 
> Please define "try and use a new R installation".

i prepare a special directory containing R (and all the packages)
which gets bundled with my application. ( http://jasp-stats.org if you
were wondering)

i have a bundle which i've been using for the last 12 months or so,
which i apparently fluked getting it into a configuration that will
link (remarkably, i fluked both osx and windows versions early on, and
haven't been able to repeat the trick on either platform since)

> See above. Your hunch is good.  If you build everything with the
> same compiler it should work.

i can confirm that i'm using the same compiler :/, below are the
installing of RInside and the compilation of my program which links
against RInside and Rcpp.

> | I thought that perhaps it had to do with link flags, but on my |
> machine, Rcpp::RcppLdFlags() always returns an empty string.
> 
> See the release notes for 0.11.0. This changed, and is easier now.
> We no longer use an external library, so this helper function no
> longer provides link instructions for one.

i'm not sure this is relevant, but Rcpp:::RcppLdFlags() returns an
empty string when i use 0.10.6 (i would like to use 0.11.x series, but
i get compile errors and haven't been able to produce a minimal
example which reproduces it.)

is there something you would recommend trying next?

with thanks


here is the output:


compilers

clang++ --version
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)

and

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
- --version
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)

compiling my application:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
- -headerpad_max_install_names
-
-Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
- -mmacosx-version-min=10.6 -o ../JASPEngine main.o engine.o
rcppbridge.o   -L.. -lJASP-Common
-
-L/Users/jonathon/Documents/build-JASP-Desktop_Qt_5_3_clang_64bit-Debug/JASP-Engine/../../Frameworks/R.framework/Versions/3.0/Resources/library/RInside/lib
- -lRInside
-
-L/Users/jonathon/Documents/build-JASP-Desktop_Qt_5_3_clang_64bit-Debug/JASP-Engine/../../Frameworks/R.framework/Versions/3.0/Resources/lib
- -lR
-
-L/Users/jonathon/Documents/build-JASP-Desktop_Qt_5_3_clang_64bit-Debug/JASP-Engine/../../Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/lib
- -lRcpp
Undefined symbols for architecture x86_64:
  "demangle(std::string const&)", referenced from:
      std::string
Rcpp::get_return_type_dispatch<Rcpp::DataFrame>(Rcpp::traits::integral_constant<bool,
false>) in rcppbridge.o
  "Rcpp::Environment::operator[](std::string const&)", referenced from:
      Rcpp::InternalFunction::set(SEXPREC*) in rcppbridge.o
  "RInside::parseEvalQNT(std::string const&)", referenced from:
      RcppBridge::RcppBridge() in rcppbridge.o
  "RInside::parseEval(std::string const&, SEXPREC*&)", referenced from:
      RcppBridge::init(std::string const&, Json::Value const&) in
rcppbridge.o
      RcppBridge::run(std::string const&, Json::Value const&,
boost::function<int (Json::Value)>) in rcppbridge.o
  "RInside::operator[](std::string const&)", referenced from:
      RcppBridge::RcppBridge() in rcppbridge.o
      RcppBridge::init(std::string const&, Json::Value const&) in
rcppbridge.o
      RcppBridge::run(std::string const&, Json::Value const&,
boost::function<int (Json::Value)>) in rcppbridge.o

.....

installing RInside:

* installing *source* package ‘RInside’ ...
** package ‘RInside’ successfully unpacked and MD5 sums checked
** libs
about to run R CMD SHLIB -o RInside.so MemBuf.cpp RInside.cpp
/Library/Frameworks/R.framework/Resources/bin/Rscript
tools/RInsideAutoloads.r > RInsideAutoloads.h
/Library/Frameworks/R.framework/Resources/bin/Rscript
tools/RInsideEnvVars.r   > RInsideEnvVars.h
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
- -I. -I../inst/include/ -I/usr/local/include
-
-I"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include"
  -fPIC  -mtune=core2 -g -O2  -c MemBuf.cpp -o MemBuf.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
- -I. -I../inst/include/ -I/usr/local/include
-
-I"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include"
  -fPIC  -mtune=core2 -g -O2  -c RInside.cpp -o RInside.o
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined
dynamic_lookup -single_module -multiply_defined suppress
- -L/usr/local/lib -L/usr/local/lib -o RInside.so MemBuf.o RInside.o
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/lib/libRcpp.a
- -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
- -Wl,CoreFoundation
clang++ -o libRInside.dylib MemBuf.o RInside.o -dynamiclib
- -Wl,-headerpad_max_install_names  -undefined dynamic_lookup
- -single_module -multiply_defined suppress
`/Library/Frameworks/R.framework/Resources/bin/Rscript -e
"Rcpp:::LdFlags()"`  -F/Library/Frameworks/R.framework/.. -framework R
- -Wl,-framework -Wl,CoreFoundation
ar qc libRInside.a MemBuf.o RInside.o
cp libRInside.dylib ../inst/lib
cp libRInside.a ../inst/lib
rm libRInside.dylib libRInside.a
installing to
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RInside/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
sh: /usr/bin/gnutar: No such file or directory
gzip: can't stat:
/Users/jonathon/Documents/Frameworks/R.framework/Versions/3.0/Resources/RInside_0.2.10_R_x86_64-apple-darwin10.8.0.tar
(/Users/jonathon/Documents/Frameworks/R.framework/Versions/3.0/Resources/RInside_0.2.10_R_x86_64-apple-darwin10.8.0.tar):
No such file or directory
Warning in file.rename(file.path(startdir, filename),
file.path(startdir,  :
  cannot rename file
'/Users/jonathon/Documents/Frameworks/R.framework/Versions/3.0/Resources/RInside_0.2.10_R_x86_64-apple-darwin10.8.0.tar.gz'
to
'/Users/jonathon/Documents/Frameworks/R.framework/Versions/3.0/Resources/RInside_0.2.10.tgz',
reason 'No such file or directory'
packaged installation of ‘RInside’ as ‘RInside_0.2.10.tgz’
* DONE (RInside)



> 
> Dirk
> 
> | If anyone could help me understand what's going on, I would
> appreciate | that. | | with thanks | | Jonathon | | | | | Undefined
> symbols for architecture x86_64: |   "demangle(std::string
> const&)", referenced from: |       std::string |
> Rcpp::get_return_type_dispatch<Rcpp::DataFrame>(Rcpp::traits::integral_constant<bool,
>
> 
| false>) in rcppbridge.o
> |   "Rcpp::Environment::operator[](std::string const&)", referenced
> from: |       Rcpp::InternalFunction::set(SEXPREC*) in
> rcppbridge.o |   "Rcpp::Environment::get(std::string const&)
> const", referenced from: |
> Rcpp::Environment::Binding::operator |
> Rcpp::Function<Rcpp::Function>() const in rcppbridge.o |
> "Rcpp::Environment::assign(std::string const&, SEXPREC*) const", |
> referenced from: |       bool
> Rcpp::Environment::assign<std::string>(std::string const&, |
> std::string const&) const in rcppbridge.o |       bool
> Rcpp::Environment::assign<Rcpp::Vector<19> >(std::string | const&,
> Rcpp::Vector<19> const&) const in rcppbridge.o |       bool |
> Rcpp::Environment::assign<Rcpp::InternalFunction>(std::string
> const&, | Rcpp::InternalFunction const&) const in rcppbridge.o |
> "Rcpp::RObject::attr(std::string const&) const", referenced from: |
> RcppBridge::readDataSet(std::map<std::string, | Column::ColumnType,
> std::less<std::string>, | std::allocator<std::pair<std::string
> const, Column::ColumnType> > > | const&) in rcppbridge.o |
> RcppBridge::makeFactor(Rcpp::Vector<13>&, Labels const&, bool) | in
> rcppbridge.o |       RcppBridge::makeFactor(Rcpp::Vector<13>&, |
> std::vector<std::string, std::allocator<std::string> > const&,
> bool) | in rcppbridge.o |
> RcppBridge::readDataSetHeader(std::map<std::string, |
> Column::ColumnType, std::less<std::string>, |
> std::allocator<std::pair<std::string const, Column::ColumnType> >
> > | const&) in rcppbridge.o |
> Rcpp::Vector<16>::push_back__impl(SEXPREC* const&, |
> Rcpp::traits::integral_constant<bool, true>) in rcppbridge.o | ld:
> symbol(s) not found for architecture x86_64 | | | | - -- | | How
> happy is he born and taught, | That serveth not another's will; |
> Whose armour is his honest thought, | And simple truth his utmost
> skill | | This man is freed from servile bands | Of hope to rise,
> or fear to fall: | Lord of himself, though not of lands, | And,
> having nothing, yet hath all. | |   -- Sir Henry Wotton | | | | | |
> -----BEGIN PGP SIGNATURE----- | Version: GnuPG/MacGPG2 v2.0.20
> (Darwin) | Comment: GPGTools - https://gpgtools.org | Comment:
> Using GnuPG with Thunderbird - http://www.enigmail.net/ | |
> iQIcBAEBCgAGBQJTu7+4AAoJEH277gjmPGDYb+0QALPkRVvmqk+WcWKlTRLzti43 |
> djVInafGyrNjnVsv4Yz29WGE/dRM/MVfU8xf9ovkEEE7i2QQ5S2oHnoYxJH8d7o6 |
> 50o/LjFehJ0KoWyXXHr90xEtYaSaxFTgoCJ5WsbruNYKGxktsxiZt+3O798M97ws |
> 92iV9u3hrqMngvTN3Bkqky3S8IFg4fJWALgozFTY/IocjvbRgokT/hM6RfIbFITs |
> +VneRdXHMzLCEI39wk2bZtbXcttZquuShkTSj3Y3+z5tNOMuvd8NnaHBppaLjDsV |
> rVZXWYPeNZuJY9TnW94OojrXlRlyanKOMVYG2G0cvNLC7PjA6NCb8qu0oBUU/YN6 |
> DaXqNBrawHGM7OjF8gOiYaaMleZO04WGY8ByngyOx8iOlZ/NEdWI+ZlEqRVnlU16 |
> Ou7Ioo4jbau3YbZi/jpqiaPFdnlYvqCeO+ykvae858NDASqx3pcWBkbfFOapo5v8 |
> KJk5jGtD9WzxfEQ7fcIppHPcMXnqD3/NogdwDIecXo8I9ZTUG9LHpKJJchBkhBbM |
> 02eYjQbqJmr+3WWDxpIQkLegnYn6RzkVvTXALcrodVlfotubURZJv0J5C9tgnsfT |
> cCGtSnZgZO6R8KeNrqAShbYBqSPYd+nohCxNc4gbcaZy7ZI6cfcFSa7WVTOBLYUA |
> JWf2mub/jtyAdG9/2fja | =qWw7 | -----END PGP SIGNATURE----- |
> _______________________________________________ | Rcpp-devel
> mailing list | Rcpp-devel at lists.r-forge.r-project.org |
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
> 
- -- 

How happy is he born and taught,
That serveth not another's will;
Whose armour is his honest thought,
And simple truth his utmost skill

This man is freed from servile bands
Of hope to rise, or fear to fall:
Lord of himself, though not of lands,
And, having nothing, yet hath all.

  -- Sir Henry Wotton





-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.20 (Darwin)
Comment: GPGTools - https://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCgAGBQJTu/jsAAoJEH277gjmPGDYoqsP/Axtsd3vXx8E4BoGOQBApMi+
vw1xrxplWAly2QT4/Z1TcAI7FUjQl6+6qLg6kwOjar8zb77Mnhj1/erCZ1QqcALw
ymLqQmPTfxcjSW8t8gL5UXuOn+NQmR24kmXQb7hntIiMD30RRl2pYMvN839B0dAR
U/q9zFGTPVu0tOlwIDyWv9SIJzJSZm2u20KOkmpr7RFfEvHyGgMYvJwUv0Gat5yJ
2X1A+QtyGBeNpiLxDxEgDob3OJzQMOQn593a4UFJoo7HBtirzDVBRYgM9Xybkm4h
RZc3dsGQRkJMoDUYPArDGLbJLjdR7JyBkQvo3gt9AEuYw9U/3Y4e7xF4bAafQzyf
UmZmcrXN/a8HmrE5Ycum24WcBdo66AM1l9jmH4mcDnUqa7TI2PT+GEy9ypG8LH7l
MHgoBfjFqTDWnrcjdtT/QKiUwGvCdGga2dKxf7rbz7y5GaPMdi3QjyyfhYXIZjJi
9dkB7XLpengiRmUDHCdp/hnPgXVcEYXyXqZ9hbsVBpkSczUZhzFbieCwxXSm3oVU
rZ0swaWTVzoN2FwX/ezWpL6pPwoaHsU3qz7hYSxGMX+J0daaBCPkSqQZwqwoBbJr
tl9WOFR66wMF+1Dc/Zz+tgFeI4PTXNTDkjnaG0T/JZ+tqcFm1s7+TkpbFsgVt7tY
jcr+ZVPRWdiHpBjaoBYT
=zCFn
-----END PGP SIGNATURE-----


More information about the Rcpp-devel mailing list