パッケージ(package)やライブラリー(library)の実体のパス(場所)を見つける

.find.package()関数を使う.

> library("RSQLite")
要求されたパッケージ DBI をロード中です
> .find.package()
[1] "/home/xxxx/R/x86_64-unknown-linux-gnu-library/2.15/RSQLite"
[2] "/home/xxxx/R/x86_64-unknown-linux-gnu-library/2.15/DBI"
[3] "/usr/local/lib64/R/library/stats"
[4] "/usr/local/lib64/R/library/graphics"
[5] "/usr/local/lib64/R/library/grDevices"
[6] "/usr/local/lib64/R/library/utils"
[7] "/usr/local/lib64/R/library/datasets"
[8] "/usr/local/lib64/R/library/methods"
[9] "/usr/local/lib64/R/library/base"

http://www.is.titech.ac.jp/~mase/mase/html.jp/temp/library.jp.v15.html

CGI等やWEBベースで使っているときにPATHが通らない問題を回避できる.

自分のローカルでなく共有するときにRSQLiteをおく
remove.packages("RSQLite")
install.packages("RSQLite",lib="/usr/local/lib64/R/library/")

いかのように怒られる.
ERROR: lazy loading failed for package ‘RSQLite’


以下のを参照に
http://seqanswers.com/forums/showthread.php?p=154972

旧版ソースをおとし
wget http://pkgs.fedoraproject.org/repo/pkgs/R-RSQLite/RSQLite_0.11.4.tar.gz/c2a1a8fca2146a910e9e13879a88cbc9/RSQLite_0.11.4.tar.gz


ソースからダウンロード
install.packages("RSQLite_0.11.4.tar.gz",lib="/usr/local/lib64/R/library/")


できた!まだ、DBIの位置が変だけど
> library("RSQLite")
要求されたパッケージ DBI をロード中です
> .find.package()
[1] "/usr/local/lib64/R/library/RSQLite"
[2] "/home/xxxx/R/x86_64-unknown-linux-gnu-library/2.15/DBI"
[3] "/usr/local/lib64/R/library/stats"
[4] "/usr/local/lib64/R/library/graphics"
[5] "/usr/local/lib64/R/library/grDevices"
[6] "/usr/local/lib64/R/library/utils"
[7] "/usr/local/lib64/R/library/datasets"
[8] "/usr/local/lib64/R/library/methods"
[9] "/usr/local/lib64/R/library/base"


> .find.package()
[1] "/usr/local/lib64/R/library/RSQLite"
[2] "/usr/local/lib64/R/library/DBI"
[3] "/usr/local/lib64/R/library/stats"
[4] "/usr/local/lib64/R/library/graphics"
[5] "/usr/local/lib64/R/library/grDevices"
[6] "/usr/local/lib64/R/library/utils"
[7] "/usr/local/lib64/R/library/datasets"
[8] "/usr/local/lib64/R/library/methods"
[9] "/usr/local/lib64/R/library/base"


ソースいれなくても入った

wget http://pkgs.fedoraproject.org/repo/extras/R-DBI/DBI_0.2-7.tar.gz/2ccd3a95e7acf29dd09ff7e23878cb9b/DBI_0.2-7.tar.gz

install.packages("DBI_0.2-7.tar.gz",lib="/usr/local/lib64/R/library/")

install.packages("DBI.zip",lib="/usr/local/lib64/R/library/")




libstdc++6-4.1-dev depends on g++-4.1 (= 4.1.2-27ubuntu1); however:
Package g++-4.1 is not configured yet.
dpkg: error processing libstdc++6-4.1-dev (--install):


CentOS 5.8 with gcc 4.4.7 links against libstdc++ 6.0.8. How is it possible?
http://unix.stackexchange.com/questions/77805/centos-5-8-with-gcc-4-4-7-links-against-libstdc-6-0-8-how-is-it-possible

Rで、
install.packages("RcppArmadillo.tar.gz",lib="/usr/local/lib64/R/library/")

ディレクトリで怒られるので、
/usr/local/lib64/R/library/... 内のRcppArmadillo関連を削除

まだ、ライブラリがないと怒られる。
Error in dyn.load(file, DLLpath = DLLpath, ...) :
共有ライブラリ '/usr/local/lib64/R/library/RcppArmadillo/libs/RcppArmadillo.so' を読み込めません:
/usr/local/lib64/R/library/RcppArmadillo/libs/RcppArmadillo.so: undefined symbol: _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l



ソースの中のsrcにいって以下を実行。
途中で、.hがないというので、名前の似たファイルがあるので、.hにリネーム。
g++44 -I/usr/local/lib64/R/include -DNDEBUG -I/usr/local/include -I"/usr/local/lib64/R/library/Rcpp/include" -I../inst/include -fpic -g -O2 -c RcppArmadillo.cpp -o RcppArmadillo.o
g++44 -I/usr/local/lib64/R/include -DNDEBUG -I/usr/local/include -I"/usr/local/lib64/R/library/Rcpp/include" -I../inst/include -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o
g++44 -I/usr/local/lib64/R/include -DNDEBUG -I/usr/local/include -I"/usr/local/lib64/R/library/Rcpp/include" -I../inst/include -fpic -g -O2 -c fastLm.cpp -o fastLm.o
g++44 -shared -L/usr/local/lib64 -o RcppArmadillo.so RcppArmadillo.o RcppExports.o fastLm.o -L/usr/local/lib64/R/lib -lRlapack -L/usr/local/lib64/R/lib -lRblas -L/usr/lib/gcc/x86_64-redhat-linux/4.1.1 -lgfortran -lm

次にリンク構造を解析。。
libstdc++.so.6があやしいという。。





$ ldd RcppArmadillo.so
linux-vdso.so.1 => (0x00007fffe23fd000)
libRlapack.so => /usr/lib64/R/lib/libRlapack.so (0x00002b14b223e000)
libRblas.so => not found
libgfortran.so.1 => /usr/lib64/libgfortran.so.1 (0x00002b14b266c000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002b14b2903000)
libm.so.6 => /lib64/libm.so.6 (0x00002b14b2c03000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b14b2e87000)
libc.so.6 => /lib64/libc.so.6 (0x00002b14b3095000)
libblas.so.3 => /usr/lib64/libblas.so.3 (0x00002b14b33ee000)
libgomp.so.1 => /usr/lib64/libgomp.so.1 (0x00002b14b3644000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b14b3852000)
/lib64/ld-linux-x86-64.so.2 (0x000000308a800000)
librt.so.1 => /lib64/librt.so.1 (0x00002b14b3a6f000)


さらに、
http://lists.osgeo.org/pipermail/gdal-dev/2012-September/034097.html
を参考に
ldd -r RcppArmadillo.so
undefined symbol: R_ClassSymbol (./RcppArmadillo.so)
undefined symbol: R_NilValue (./RcppArmadillo.so)
undefined symbol: R_DimSymbol (./RcppArmadillo.so)
linux-vdso.so.1 => (0x00007fff0a551000)
libRlapack.so => /usr/lib64/R/lib/libRlapack.so (0x00002aca8dbaf000)
libRblas.so => not found
libgfortran.so.1 => /usr/lib64/libgfortran.so.1 (0x00002aca8dfdd000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002aca8e274000)
libm.so.6 => /lib64/libm.so.6 (0x00002aca8e574000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002aca8e7f8000)
libc.so.6 => /lib64/libc.so.6 (0x00002aca8ea06000)
libblas.so.3 => /usr/lib64/libblas.so.3 (0x00002aca8ed5f000)
libgomp.so.1 => /usr/lib64/libgomp.so.1 (0x00002aca8efb5000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aca8f1c3000)
/lib64/ld-linux-x86-64.so.2 (0x000000308a800000)
librt.so.1 => /lib64/librt.so.1 (0x00002aca8f3e0000)
undefined symbol: R_NamesSymbol (./RcppArmadillo.so)
undefined symbol: R_GlobalEnv (./RcppArmadillo.so)
undefined symbol: Rf_eval (./RcppArmadillo.so)
undefined symbol: Rf_lang2 (./RcppArmadillo.so)
undefined symbol: Rf_unprotect (./RcppArmadillo.so)
undefined symbol: R_FlushConsole (./RcppArmadillo.so)
undefined symbol: R_GetCCallable (./RcppArmadillo.so)
undefined symbol: Rf_onintr (./RcppArmadillo.so)
undefined symbol: Rf_mkChar (./RcppArmadillo.so)
undefined symbol: Rf_coerceVector (./RcppArmadillo.so)
undefined symbol: Rf_lang1 (./RcppArmadillo.so)
undefined symbol: Rf_setAttrib (./RcppArmadillo.so)
undefined symbol: Rf_xlength (./RcppArmadillo.so)
undefined symbol: Rf_mkString (./RcppArmadillo.so)
undefined symbol: SET_STRING_ELT (./RcppArmadillo.so)
undefined symbol: REprintf (./RcppArmadillo.so)
undefined symbol: INTEGER (./RcppArmadillo.so)
undefined symbol: Rprintf (./RcppArmadillo.so)
undefined symbol: CDR (./RcppArmadillo.so)
undefined symbol: Rf_warning (./RcppArmadillo.so)
undefined symbol: Rf_length (./RcppArmadillo.so)
undefined symbol: Rf_install (./RcppArmadillo.so)
undefined symbol: Rf_getAttrib (./RcppArmadillo.so)
undefined symbol: R_PreserveObject (./RcppArmadillo.so)
undefined symbol: Rf_protect (./RcppArmadillo.so)
undefined symbol: Rf_isNull (./RcppArmadillo.so)
undefined symbol: _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l (./RcppArmadillo.so)
undefined symbol: Rf_allocVector (./RcppArmadillo.so)
undefined symbol: SET_VECTOR_ELT (./RcppArmadillo.so)
undefined symbol: _ZNSo9_M_insertImEERSoT_ (./RcppArmadillo.so)
undefined symbol: CAR (./RcppArmadillo.so)
undefined symbol: TYPEOF (./RcppArmadillo.so)
undefined symbol: R_ReleaseObject (./RcppArmadillo.so)
undefined symbol: Rf_isMatrix (./RcppArmadillo.so)

gccのバージョンの問題らしい
http://soup-dev.websitetoolbox.com/post/New-Version-Error-with-Linux-5510673


libstdc++.so.6内のHow do i tell my gcc/g++ to compile/link against an older version of GLIBXX so that my users dont get this error? があやしいらしい。
http://stackoverflow.com/questions/10176997/how-to-get-rid-of-glibcxx-3-4-9-not-found-error

strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_FORCE_NEW

strings /usr/lib64/libstdc++.so.6.0.8 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_FORCE_NEW

たしかに、3.4.9はないが…

You are building for GLIBCXX_3.4.9, hence your users also need to have at least GLIBCXX_3.4.9.

shareimprove this answer
answered Apr 16 '12 at 19:56

jørgensen
6,5021816
1
i know. thing is most of my users dont. so i need to know how to tell gcc to build against a lower version. does that entail just passing extra arguments or installing a whole bew, old version of linux? – pdeva

犯人は特定されてきた。。
http://soup-dev.websitetoolbox.com/post/New-Version-Error-with-Linux-5510673

I am using g++ 4.1.2 and Boost 1.53 on Red Hat Linux rel 5.5. There is an issue during the linking process which is unclear to me. I get the error msg:

/usr/local/boost_1_53_0/stage/lib/libboost_thread.so:
undefined reference to `std::bad_exception::what() const@GLIBCXX_3.4.9'

/usr/local/boost_1_53_0/stage/lib/libboost_thread.so:
undefined reference to `std::bad_alloc::what() const@GLIBCXX_3.4.9'

collect2: ld returned 1 exit status
There seems to be a problem related to the libstdc++.so file version I'm linking with. If I alternate hiding and revealing this file I can get my program to link. However, I would like to be able to 'make' in one step as I did before I introduced the Boost libraries and concurrent threading.

Please help shed some light on this issue if you have any insight.

c++ linux boost redhat
shareimprove this question
edited May 16 '13 at 14:15

taocp
15.9k52243
asked May 16 '13 at 14:11

cookinbag
1
1
Can you show your linker command line? – Timo Geusch May 16 '13 at 14:13
add a comment
2 Answers
activeoldestvotes
up vote
0
down vote
Please try to install via yum.

yum install boost You will not encouter such issues.

Try to include rpmforge and epel yum repositories.

shareimprove this answer
answered May 16 '13 at 14:20

Jyotir Bhandari
6916

You won't get Boost 1.53 from yum – Jonathan Wakely May 16 '13 at 14:41
add a comment

up vote
0
down vote
http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning shows that GLIBCXX_3.4.9 is the symbol version used by the libstdc++.so from GCC 4.2.0, so if the Boost library wants that version then it means it was compiled with GCC 4.2.x

That means you can't use the library with a program linked by GCC 4.1.2, you need to link with GCC 4.2.0 or later

libstdc++.so is backward compatible but not forwards compatible, so you can compile a program with one version and link it to a newer version, but you can't compile with a newer version and link to an older version.

shareimprove this answer
answered May 16 '13 at 14:46

Jonathan Wakely
80.5k4121235

I attempted to link with version 4.2.4 of gcc only to experience the same issue. Does anyone have any ideas? – cookinbag May 16 '13 at 18:38

You must be doing it wrong. If you link correctly with GCC 4.2 then you will get the GLIBCXX_3.4.9 symbol versions. – Jonathan Wakely May 16 '13 at 22:30

アップデートの豊富
https://www.saintsouth.net/blog/update-libstdcpp-on-centos6/

lnでシンボリックリンクすればよい。
http://e-words.jp/w/%E3%82%B7%E3%83%B3%E3%83%9C%E3%83%AA%E3%83%83%E3%82%AF%E3%83%AA%E3%83%B3%E3%82%AF.html

新しい、libstdc++を作る。
http://server-setting.info/centos/centos_gcc_versionup.html

wget http://core.ring.gr.jp/pub/GNU/gcc/gcc-4.4.7/gcc-4.4.7.tar.gz


$ gzip -d gcc*4.4.7.tar.gz