mysql - Trying to get RmySQL to work but not understanding bash's export or filesystem conventions -
i trying install rmysql on mac (mavericks) , errors out when try build source, saying:
configuration error: not find mysql installation include and/or library directories. manually specify location of mysql libraries , header files , re-run r cmd install.
instructions:
define , export 2 shell variables pkg_cppflags , pkg_libs include directory header files (*.h) , libraries, example (using bourne shell syntax):
export pkg_cppflags="-i" export pkg_libs="-l -lmysqlclient" re-run r install command:
r cmd install rmysql_.tar.gz
i tried follow instructions entering:
export pkg_cppflags="-i/usr/local/mysql/include" export pkg_libs="-l/usr/local/mysql/lib -lmysqlclient"
but when re-run rmysql still doesn't work. moreover, if type
$pkg_libs
to see variable holds,
-bash: -l/usr/local/mysql/lib: no such file or directory'
i know /usr/local/mysql/lib exists , contain mysql header. misunderstanding instructions?
i'm asking here after lot of effort find solutions and/or work arounds. sucks being noob sometimes.
i going assume you're trying rmysql run on r 3.1.0 on mavericks? rather worry exporting variables etc, here simple clean solution should avoid headaches.
the rmysql install link pascal provided above solution. you're stumbling on syntax, or getting things work terminal.
even if you're "noob", should able working. i'll try offer "dummy's guide" walk through here, bet there many others have problem too, after trying read rmysql installation readme.
i bet high confidence problem aren't specifying correctly locations of library , header folders compiling. read errors when try compile... errors tell file/header missing, or .so file (shared object) missing.
one simple way compile rmysql source on r 3.1.0, mavericks follows (this not require set environmental variables, no editing of renviron file, etc):
does mysql work itself? i.e. can open/run no problems? if not, fix first.
find precise location of mysql installation. me, on mavericks, see mysql installed @ /usr/local/mysql-5.6.17-osx10.7-x86_64 (your version number may different). there folder /usr/local/mysql alias /usr/local/mysql-5.6.17-osx10.7-x86_64 (/usr/local/mysql finds current version of mysql using, if multiple mysql file folders exist, think). in directory, see 2 sub directories (among many) called "include" , "lib". take look; "include" contain header files (include in #include , etc, in simple c++ programs). "lib" folder contains compiled source code of mysql library.
an easy way compile , install rmysql doesn't follow suggested way in installation guide this. note doing same thing in installation guide, little easier it's 1 command line terminal, once know mysql install folder is. go terminal, , type following exactly, 1 space between each chunk (with mysql folder name adjusted appropriately version number):
pkg_cppflags="-i/usr/local/mysql/include/" pkg_libs="-l/usr/local/mysql/lib/ -lmysqlclient" r cmd install rmysql_0.9-3.tar.gz
or (the same thing, more typing)
pkg_cppflags="-i/usr/local/mysql-5.6.17-osx10.7-x86_64/include/" pkg_libs="-l/usr/local/mysql-5.6.17-osx10.7-x86_64/lib/ -lmysqlclient" r cmd install rmysql_0.9-3.tar.gz
note dummies: make sure when run command, doing terminal in directory contains rmysql_0.9-3.tar.gz file (or whatever name of folder contains rmysql source code)
and rmysql compiles!
don't afraid trying compile source code -- it's not 'compiled language programmers' or 'computer science graduates'. of time when compiling fails it's because files "missing" (there no corruption on source code) -- user hasn't specified locations of header , libraries (shared objects). pull big boy/girl panties , .... it's easy.
notes people clueless compiling source code packages in r:
a) pay special attention spacing in above, otherwise may not work. not have spaces between = , variable/file names (e.g. don't try , have in above pkg_cppflags ="-i/usr/local/mysql/include/" won't work)
b) when compiling, want specify locations of header files , library files , "-i/ .... " , "-l/ ...." doing. -i directory specifies location of header files, , -l location of library files. library files require -l[name of library] extension (the -l short -lib in library object names).
c) note in directory /usr/local/mysql-5.6.17-osx10.7-x86_64/lib/ not see file called "lmysqlclient", or "libmysqlclient", see files named (among others) "libmysqlclient.a" , "libmysqlclient.18.dylib". don't worry mysql installation not being correct if don't see file called "libmysqlclient" in lib folder.
Comments
Post a Comment