FPC IDE: Can't find unit system - freepascal

I just installed FPC 3.2.0 (on Linux Mint 19.3) and trying to use FPC IDE. I launched the IDE from the bin installation subfolder as ./fp, written a simplest program in IDE
program hello;
begin
writeln('hello');
end.
saved the program as hello.pas and when I compile it I get
(3,1) Fatal: Can't find unit system used by hello
(0) Fatal: Compilation aborted
This is strange because system is the compiler's unit, not a user's unit.
I tried to google the issue, found several posts in different forums, one question was dated back to 2007 year, and none of the questions was answered.
Is where a way to solve the issue or FPC IDE is dead for about 15 years?

Check the unit directories in options->directories -> unit directories.
The package configuration should have put a line like
/usr/lib/fpc/$FPCVERSION/units/$FPCTARGET/*
The dollar values are builtins (respectively 3.2.0 and i386-linux or x86_64-linux). Please verify that the directories with prebuilt .ppu .o are there.

Try to fix your installation of FPC or you can fix it manually by calling fpcmkcfg
fpcmkcfg -d "basepath=path/to/fpc/3.3" -o path/to/fpc.cfg
For instance, if the compiler is in /usr/local/bin, it will look in
/usr/local/etc.

Had the same problem on Ubuntu 20.04. To solve it, I had to create the file fp.cfg in my project's folder with the following content:
-Fu/usr/lib/x86_64-linux-gnu/fpc/$fpcversion/units/$fpctarget
-Fu/usr/lib/x86_64-linux-gnu/fpc/$fpcversion/units/$fpctarget/*
If this will not work, it means unit path on your system is different. You may use something like
dpkg -L fp-units-base-3.0.4 | grep .ppu
to find out where units are actually stored. Replace 3.0.4 with your actual Free Pascal version. If you do not know exact version, use
sudo apt install apt-show-versions
apt-show-versions fpc
It will show something like
fpc:all/focal 3.0.4+dfsg-23 uptodate
3.0.4 is the version number you need.
Another way of getting needed paths is running this command:
cat /etc/fpc.cfg | grep -- -Fu | head -2
So you may just run
cat /etc/fpc.cfg | grep -- -Fu | head -2 > fp.cfg
in your project's folder to have the problem solved.

How to use Free Pascal (Lazarus) on Linux - no install solution:
If not already installed, install "GNU binutils" (sudo apt-get install binutils)
Dowload the latest version of Free Pascal (Lazarus): from the Downloads section of the Lazarus Home page (Lazarus is a professional open-source cross platform IDE powered by Free Pascal):
2.1. In case of a Debian based Linux system (such as Ubuntu): the .deb package could be downloaded ("fpc-laz_<version> ... .deb" (replace <version> with an actual version number))
2.2. In case of a RPM based Linux system (such as Fedora): the .rpm package could be downloaded ("fpc-<version> ... .rpm" (replace <version> with an actual version number))
Extract the downloaded package:
3.1. Place the downloaded .deb / .rpm package in the folder where you are going to extract it
3.2. Extract the downloaded .deb / .rpm package by Right-Click-ing it and then choosing Extract Here
3.3. Rename the extracted folder, as you desire, for example "fpc"; Further we denote this folder as "<BASEFOLDER>" and its path as - "<BASEFOLDER_PATH>"
In the case of a .deb package: Open the extracted <BASEFOLDER> and then, extract "data.tar.xz" - by Right-Click-ing it and then choosing Extract Here
Launch the Free Pascal window by typing the next command in the terminal - this command may vary according to the terminal used - replace <terminal> with the terminal used (by default: for Gnome based Desktop Environments -> gnome-terminal; for KDE based Desktop Environments -> konsole; for Xfce based Desktop Environments -> xfce4-terminal; for the MATE Desktop Environment -> mate-terminal; ...):
<terminal> -e '<BASEFOLDER_PATH>/usr/bin/fp'
OR:
<terminal> -- '<BASEFOLDER_PATH>/usr/bin/fp'
To add the units folders: From the Free Pascal Menu, access: Options -> Directories -> and copy (CTRL + C to Copy from outside the IDE, and (FN + )SHIFT + Insert to Paste inside the IDE) to the "Units" tab, the next three lines, each on a new line (replace <BASEFOLDER_PATH> with its corresponding value, and replace <LIB_FOLDER> with: lib in case of a .deb package or lib64 in case of a .rpm package):
<BASEFOLDER_PATH>/usr/<LIB_FOLDER>/fpc/$fpcversion\units\$fpctarget
<BASEFOLDER_PATH>/usr/<LIB_FOLDER>/fpc/$fpcversion\units\$fpctarget\*
<BASEFOLDER_PATH>/usr/<LIB_FOLDER>/fpc/$fpcversion\units\$fpctarget\rtl
Please note that by moving the files from the <BASEFOLDER> directory to other <BASEFOLDER_PATH>, you'll have to update the above three lines so that they contain the new <BASEFOLDER_PATH>, otherwise you might get errors like:
"Fatal: Can't find unit ..."
For navigation inside the IDE using keyboard - the following shortcuts can be used: Alt + Highlighted-letter, Highlighted-letter(s), Tab / Shift + Tab, Arrows, Enter, Esc
For Official Online Documentation see:
Online Documentation

Related

"Fatal error: 'EXTERN.h' file not found" while installing Perl modules

While trying to install Perl modules like JSON::XS or YAML::XS, i receive the same error:
XS.xs:1:10: fatal error: 'EXTERN.h' file not found
I use MacBook, xCode is up to date, everything else that could help is up to date too.
Since OS X El Capitan, Apple introduced System Integrity Protection which restricts writing to /usr/lib /usr/bin and other sensitive directories (even to root or sudo user) that are used by the installation of Perl bundled with the Operating System. This can cause issues when it comes to installing new modules and also if trying to install XS modules ( those linked to external C libraries ).
For this reason you should not consider the default Perl installation as a working development environment, especially if you are installing custom modules.
Check out this thread on PM and others. I had since El-Capitan managed to solve this before by manually building from tarball and adding a few params or environment variables to set the paths believing that it would be best to retain use of the system Perl but this is not the way to go. This makes your environment difficult to build but also brittle and sensitive to OS updates that may either break things in many different ways.
The best practice seems to be starting with a Perl using brew install perl and work in this environment, remembering to setup your bash_profile as directed by the installer.
Also worth remembering to do a brew link perl. If you receive warnings about this clobbering what looks like system Perl libraries don't worry - these are likely modules that were installed by you over the top and it will cause you less trouble to link over these. If you have concerns, make a note of which module installs will be cleared and re-install them once your environment is configured ( ie your module installer approach is configured using cpanm or sticking with the old perl -MCPAN -e shell etc)
This new Perl setup from brew eliminates the need to continuing running sudo which adds another layer of things that can go wrong as environment variables don't follow through and permission conflicts arise etc.
Finally to simplify package/module installation I suggest doing a brew install cpanminus. If you had previously already installed this, you can ensure the paths etc are configured by doing a brew reinstall cpanminus
If you want to take it another step further then you can install perlbrew as well which will give you the ability to run multiple versions of Perl as your user and configure these with their own libs and modules which can be very useful particularly if aligning with your production environment for testing etc.
One problem you may face if moving from system Perl to this kind of approach is needing to deal with any hangovers from installing things with sudo. It wis worth taking a little time to get all this set up right though and your issues going forward will be greatly reduced and you won't be left with that nagging feeling that you don't want to change anything for fear of it all breaking.
I have also come across a Perl Blog Article that suggests a fix for XS issues with perlbrew on Mojave
This Gist described updating your cpan shell install root though this shouldn't be necessary unless your cpan is stuck in an old config after taking steps above.
I've also raised this as a new issue on PerlMonks
After reading https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035624 and installing the Additional headers via
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
I successfully compiled without the missing 'EXTERN.h' error
In order to follow the common advice I also tried with Perlbrew to install a dedicated development version of Perl. Especially with the advice in mind First, do not use the system Perl on MacOS. The installed version is for Apple, not for you (see the discussion here: https://www.perlmonks.org/?node_id=1224727).
Unfortunately, the following error occurred:
Test Summary Report
-------------------
porting/libperl.t (Wstat: 65280 Tests: 35 Failed: 0)
Non-zero exit status: 255
Parse errors: No plan found in TAP output
Files=2653, Tests=1217766, 708 wallclock secs (52.74 usr 9.40 sys + 395.38 cusr 49.90 csys = 507.42 CPU)
Result: FAIL
make: *** [test_harness] Error 1
##### Brew Failed #####
Therefore, I decided to install it the following way (and not following the advice due to the error).
Even after having the above mentioned macOS SDK headers already installed on Catalina (macOS 10.15.2) it didn't work for me. I faced the issue during the installation of the Perl module Mac-SystemDirectory-0.13. The following steps (by identifying the missing file in hope of having a more generic approach for more or less equivalent issues) did the trick:
Locate the header file (in this case EXTERN.h)
sudo find /Library -type f -name EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
Ensure the installed Perl version (here 5.18) match the header file:
perl -v | grep version
This is perl 5, version 18, subversion 4 (v5.18.4) built for darwin-thread-multi-2level
Export the path for the C-Compiler (note MacOSX10.15.sdk for Catalina and Perl Version 5.18)
export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE
Invoke the Makefile.PL with perl
perl Makefile.PL
BTW — For anybody who's still struggling with this, my workaround was:
bash% module="Sub::Util" # For example
bash% cpanm --configure-args="INC=-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" "$module"
Please try this
CPATH=$(dirname $(find /usr/local/Cellar/ -name EXTERN.h)) cpan JSON::XS
For Big Sur and perl 5.30, EXTERN.h is at /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE
I'm trying to upgrade CPAN itself and got that error. But I have /usr/bin/cpan and I can't write there so I have to tweak it to write the updated version to /usr/local/bin/cpan.
No promises, but yum install perl-devel worked for me.
As #huyz has helpfully pointed out, if you hit this error on a Mac, you don't have this option, even though this is probably your issue, and you need to follow one of the above methods of getting a version of Perl that isn't missing important chunks, as per other answers.
But if, dear reader, you hit this error on a linux host, as I did, then this might be an option for you.
Building on what E Lisse suggested, you might also have luck looking in
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/
For example:
CPATH=$(dirname $(find /System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/ -name EXTERN.h)) cpan JSON::XS
You could also find where EXTERN.h is located and add that to your shell by default, e.g. in your .bashrc or .zshrc file:
export CPATH=/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/

How do I make Octave see installed Shogun libraries in Ubuntu 16.04?

I copied the commands (from these instructions: http://www.shogun-toolbox.org/install#ubuntu) into the terminal and they seem to have worked, but there is no documentation on how to make Octave find the libraries. I have tried modshogun and init_shogun but Octave cannot find them. I do have the libraries in usr/lib, and I have put that directory on PATH. I have even set usr/lib as my working directory in Octave and that did not help. As far as I have found, there is no Shogun documentation on what to do at this point.
I have also tried compiling Shogun from source, but configure couldn't find GCC. Apparently, this is a known problem with newer versions of GCC. I decided to ask for help with the former method because at least I have the libraries with that.
Edit: I am following the instructions here http://www.shogun-toolbox.org/install#manual-basics
When i do cd build and then "cmake -DINTERFACE_OCTAVE=ON" it tells me there is no cmakelists.txt. There is one in in the above folder, but when I go to that directory and do "cmake -DINTERFACE_OCTAVE=ON" again, it tells me "Shogun can only be built with GPL codes if the source files are in /home/derose/shogun/src/shogun/src/gpl. Please download or disable with LICENSE_GPL_SHOGUN=OFF."
However, when I add -LICENSE_GPL_SHOGUN=OFF as an option, i get the error "CMake Error: The source directory "/home/derose/shogun/src/shogun/-LICENSE_GPL_SHOGUN=OFF" does not exist."
You've linked to the Ubuntu install instructions. From there
These currently do contain the C++ library and Python bindings..
No word that this would include the GNU Octave binding. See below on the same page:
The native C++ interface is always included. The cmake options for building interfaces are -DINTERFACE_PYTHON=ON -DINTERFACE_R .. etc. For example, replace the cmake step above by cmake -DINTERFACE_PYTHON=ON...
So you have to grab the source and fire up cmake with something like -DINTERFACE_OCTAVE=ON
Steps to build the bleeding edge of shogun (the github repo) and the Octave interface:
git clone https://github.com/shogun-toolbox/shogun && cd shogun
git submodule update --init
mkdir build && cd build
cmake .. -DINTERFACE_OCTAVE=ON
make -j4

Weird Cuda C installation (Ubuntu14.04)

I just came across a weird situation after installing cuda... I literally followed every single step suggested by the nvidia website: http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/#axzz3H0tm46yY.... everything seems to be fine, even the samples work... however when I try to run the "hello world" program presented in Cuda by Example documentation, the terminal displays:
The program 'nvcc' is currently not installed. You can install it by typing:
sudo apt-get install nvidia-cuda-toolkit
This is quite strange since nvcc should already be installed during the procedure suggested by the nvidia website....
Does anyone have any idea?
The PATH variable needs to include your cuda /bin directory (by default it is /usr/local/cuda-6.5/bin)
On Ubuntu you can edit the .bashrc file on your $HOME directory, adding the following;
export PATH=/usr/local/cuda-6.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH
If you are running a 32-bit Ubuntu version, then the paths are:
export PATH=/usr/local/cuda-6.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib:$LD_LIBRARY_PATH
After editing the bashrc file, source it (or simply restart the terminal):
source ~/.bashrc
Of course, if you have changed the default location of your CUDA directory you must change the PATHS accordingly.
PLUS: there are another options to tell the system where to find a library, a program, etc. like using enviromental modules, specify the complete path to the libraries and programs manually are another options. There are many methods out there!

Build MonoDevelop + MonoMac on OS X

I'm following the instructions from here to build MonoDevelop on Mac OS X: Building MonoDevelop on OS X
I can build MonoDevelop just fine. I'd like to also build the MonoMac add in and use it.
The document says:
"To include addins from extras, manually copy their build directories
into the MonoDevelop.app directory, e.g.
cp -r ../../../extras/MonoDevelop.AspNet.Mvc/build/*
MonoDevelop.app/Contents/MacOS/lib/monodevelop/AddIns/MonoDevelop.AspNet.Mvc/"
However, I have no build directory under /extras/MonoDevelop.MonoMac.
I tried to follow this step to build extras:
"To include additional addins from extras in the build, instead of
using the Mac profile, use configure --select to select addins. This
will write the default profile. Next, replace the line in
profiles/default that begins with "main" with the one from
profiles/mac, then run configure again using the default profile."
But it does not give me the option to build the MonoMac extra.
Next, I try to compile the monodevelop.mdw. Again, I can build the main solution (MonoDevelop), but the extras fails with over 1000 errors.
Finally, I tried to take my existing monomac and macdev plugins and copy them into my master monodevelop.app bundle. But this breaks add solution/project dialog whenever I try to select a MonoMac project - it fails to load the Monodevelop.ide DLL.
Any advice on where I am going wrong would be appreciated.
I was not able to make this work following the directions on the MonoDevelop site. Even manually adding the extras/MonoDevelop.MonoMac extra to the profile did not work.
In the end, I build MonoDevelop from source, using the mac profile.
Then I got the latest MonoMac pieces, and build them from source. I used
make update
to install into my installed copy of MonoDevelop.
Then, I manually copied the following packages from my installed MonoDevelop to my newly compiled version from master:
MacPlatform.dll
MonoDevelop.iPhone
MonoDevelop.MacDev
MonoDevelop.MonoMac
Xamarin.Ide
Any everything now works :)

adding RMySQL package to R fails (on Windows)?

I can't figure out why my RMySQL package won't install - here's what I get:
> install.packages('RMySQL',type='source')
trying URL 'http://cran.mirrors.hoobly.com/src/contrib/RMySQL_0.7-5.tar.gz'
Content type 'application/x-gzip' length 160769 bytes (157 Kb)
opened URL
downloaded 157 Kb
* installing *source* package 'RMySQL' ...
ERROR: configuration failed for package 'RMySQL'
* removing 'C:/PROGRA~1/R/R-212~1.0/library/RMySQL'
The downloaded packages are in '(foo)'
Warning message:
In install.packages("RMySQL", type = "source") : installation of package 'RMySQL' had non-zero exit status
I don't think it's a problem with the MySQL install, as the right values seem to be in the registry:
> Sys.getenv('MYSQL_HOME')
MYSQL_HOME "C:/PROGRA~1/MySQL/MYSQLS~1.1/"
> readRegistry("SOFTWARE\\MySQL AB", hive="HLM", maxdepth=2)
$`MySQL Server 5.1`
$`MySQL Server 5.1`$DataLocation
[1] "C:\\Documents and Settings\\All Users\\Application Data\\MySQL\\MySQL Server 5.1\\"
$`MySQL Server 5.1`$FoundExistingDataDir
[1] "0"
$`MySQL Server 5.1`$Location
[1] "C:\\Program Files\\MySQL\\MySQL Server 5.1\\"
$`MySQL Server 5.1`$Version
[1] "5.1.54"
Puzzled. Any help would be greatly appreciated!
The basic process is described here, but there are several hints, So I will describe the whole solution (please change the R version and paths if needed):
Install latest RTools from here
install MySQL or header and library files of mysql
create or edit file C:\Program Files\R\R-2.12.1\etc\Renviron.site and add line like MYSQL_HOME=C:/mysql (path to your mysql files)
copy libmysql.lib from mysql/lib to mysql/lib/opt to meet dependencies.
copy libmysql.dll to C:\Program Files\R\R-2.12.1\bin or to windows/system32 directory.
run install.packages('RMySQL',type='source') and wait while compilation will end.
This worked for me on Windows 7 64 bit, so there should be no problems with 32 bit versions
Initialy posted here (similar question).
First I would try following the directions on this page: http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL
Then, ensure that you actually have a MySQL client on your computer, not just the server itself. I've had a problem myself where I had to use an older binary for the client, but you can download these from mysql website.
I created a binary which might work for people:
http://kenahoo.blogspot.com/2011/09/rmysql-binary-for-windows-7.html
I basically followed all these directions, including the ones at the Vanderbilt page, but for one reason or another it doesn't always seem to work. Anyway, hope this might be helpful for people who have the same versions of stuff I used.
I was having this same problem on Windows 7 with R 2.12.1 x64 and resolved it by:
Changing the R directory in my PATH variable to C:\Program Files\R\R-2.12.1\bin\x64 (rather than just ...\R-2.12.1\bin).
Copying ...\MySQL Server 5.5\lib\libmysql.dll to ...\MySQL Server 5.5\bin\.
Running R CMD INSTALL RMySQL_0.7-5.tar.gz in cmd.exe (install.packages('RMySQL',type='source') in R still would not work).
I came across this step-by-step guide to install RMySQL under Windows7 64bit.
http://www.ahschulz.de/2013/07/23/installing-rmysql-under-windows/
The software I used are:
Windows 8 OS
R3.0.2 - 64bit
Rtools 3.1
MySQL Server Community Edition 5.6 - 64bit
Following the above guide (with screenshots provided), my installation and loading of the RMySQL package works.
Many thanks to Arne Hendrik Schulz!
As Marek said. There is no windows binary for this package. I had similar troubles on my Mac when I tried to install RPostgreSQL (because there's no binary for Mac) in the end I had to compile it on my own and modify several files.
For the MySQL part(if you don't know much about MySQL), you might want to use WAMP which is admittedly more than you need, but easy to install and to start and shut down.
For some compiling help you might be interested in Rtools
HTH
BTW: What kind of windows do you run (sry, if I missed it)
You however there is one additional requirement at present (with the MySQL server version 5.5 & R2.12.1) follow thehttp://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL instructions at present as the locations of the libmySQL.dll differs to what is expected in the package.
i.e. for the 64bit compiling.
it expects the libmySQL.dll to be in "${MYSQL_HOME}"/bin/libmySQL.dll
so simply copy the dll over to the /bin dir and it will now compile.
for the 32bit compilling.
the libmySQL.lib is expected in "${MYSQL_HOME}"/lib/opt/libmysql.lib
again moving this should solve the problem.
Alternatively, if you don't want to or can't move these files. Then you can edit the source code files:
Makevars.win
Makevars.win32
Makevars.win64
appropriately pointing to /lib/libmysql.dll /lib/libmysql.lib
Add MySQL and RTools directory to the PATH!
Here is my PATH ; ~blah~;C:\Program Files\MySQL\MySQL Server 5.5\bin;c:\rtools\bin;C:\Rtools\gcc-4.6.3\bin;
I was working for last 2 days on Installation of R with RMySQL package, finally got the solution for that, here are the steps to install RMySQL package:-
DOWNLOAD SOFTWARE FROM THE FOLLOWING LINKS:
*a. R2.13.2: Download R from http://cran.stat.sfu.ca/index.html
b. RTools 214: Download RTools from http://cran.cict.fr
c. RMySQL 0.8-0.tar.gz: Download RMySQL from
http://biostat.mc.vanderbilt.edu/wiki/main/RMySQL/RMySQL_0.8-0.tar.gz
d. MySQL Server 5.0: download it from http://dev.mysql.com
e. RSTUDIO (optional): download it from http://rstudio.org*
SET THE FOLLOWING ENVIRONMENT VARIABLES
* a. MYSQL_HOME : <drive>/path to MySQL installation folder
e.g. MYSQL_HOME= C:\Program Files\MySQL\MySQL Server 5.5\
b. R_HOME: <drive>/path to R installation
e.g. R_HOME=C:\Program Files\R\R-2.13.2\
c. PATH: Modify path to accommodate the above variables. *
Be sure that the following paths areincluded in your Windows PATH variable:
\Rtools\2.14\bin
\Rtools\2.14\MinGW\bin
\Rtools\2.14\MinGW64\bin
CREATE FOLDER AND COPY FILES
a. OPT: Create a folder OPT under C:\Program Files\MySQL\MySQL Server 5.5\lib and copy
MYSQLLIB.LIB the above path. Also copy libmysql.dll to \\R\R-2.14.0\bin\ (64 bit) Or \\R\R-2.14.0\bin\i386\ (32 bit) and to C:\Windows\System32.
b. Renviron.site: create or edit a file \\R\R-2.14.0\etc\Renviron.site and add a
line: MYSQL_HOME =”C:/Program Files/MySQL/MySQL Server 5.5/”
NB: USE FORWARD SLASH AND DOUBLE QUOTES HERE
c. libMySQL.dll: Copy this file to C:\Program Files\R\R-2.13.2\bin\i386 as well as C:\Program
Files\R\R-2.13.2\bin
RUN COMMANDS
a. Install.Packages: Run R GUI by clicking on the R icon on desktop or from Start menu. Type
INSTALL.PACKAGES(“RMySQL”,type=”Sources”). This will download the required software from repositories.
b. Command Prompt: Copy the downloaded zip file (in step 4.a.) and paste it under R
installation folder. Go to start menu and open Command Prompt. Go to the R installation folder and type R CMD INSTALL RMySQL_0.8-0.tar.gz
*COMMANDS:
>library(RMySQL)
>drv = dbDriver("MySQL")
>con = dbConnect(drv,host="localhost",dbname="test",user="root",pass="root")
>album = dbGetQuery(con,statement="select * from t_master")
>album*
18 months later, new laptop, same problem. Returning to the scene of the crime - sorry January 2011 self; we're in the future, and this installation still isn't any fun.
Lessons learned:
-Updated RTools are essential. Get them.
-Are you seeing an error along the lines of .onLoad failed in loadNamespace() for 'RMySQL', details? This seems to mean that there's a problem with your system environment variables.
In R, run
Sys.getenv('MYSQL_HOME')
If it spits back a path like
[1] "C:\\Program Files\\MySQL\\MySQL Server 5.6"
you're good. But if it gives you empty string, you need to set this.
These are all Windows 7 directions, but the process is pretty similar in XP, if memory serves.
1) Bring up System Properties > Advanced > Environment Variables.
2) In the lower 'System Variables' pane, click 'New'.
3) Variable name is MYSQL_HOME and value is whatever the path is to your MySQL installation - mine was C:\Program Files\MySQL\MySQL Server 5.6
Newer versions of MySQL don't seem to create an environment variable on install - that and the lack of binaries for RMySQL explain why this questions has garnered 8,000 hits.
-Still stuck? Here are two additional in-depth writeups: 1, 2
Following worked for me in red hat linux
wget http://cran.r-project.org/src/contrib/RMySQL_0.9-3.tar.gz
sudo R CMD INSTALL --configure-args='--with-mysql-inc=/usr/include/mysql' --configure-args='--with-mysql-lib=/usr/lib64/mysql' RMySQL_0.9-3.tar.gz