orange1
orange1

Reputation: 2939

Cannot find mysql.h file when installing an R package

I'm trying to install the RMySQL R library, however, when I try to install it, I get the following error messages:

In file included from RS-MySQL.c:22:
./RS-MySQL.h:32:10: fatal error: 'mysql.h' file not found
#include <mysql.h>
     ^
1 error generated.
make: *** [RS-MySQL.o] Error 1
ERROR: compilation failed for package ‘RMySQL’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RMySQL’

I have MySQL installed, as I am able to use it with MySQLWorkbench. This ( fatal error mysql.h:No such file or directory during compilation) question seems to be from someone who had a similar problem, however, I'm not sure how to find where the header files were installed -- they are not in either of the paths are suggested. How can I find where my MySQL header files are installed, and then where do I define their path in order to be able to install the RMySQL library?

I am on a Mac and using RStudio.

Upvotes: 0

Views: 3352

Answers (2)

Pawel Osipowski
Pawel Osipowski

Reputation: 544

 mysql_config --include

I took it from here and it worked for me.

Upvotes: 1

MichalO
MichalO

Reputation: 21

I had a similar case today.

I've copied all the headers from /usr/local/mysql/include to /usr/local/include and the problem was fixed. If you cannot find your myslq headers, just search the disk for mysql.h

Then there was also an issue of linker not aware of libmysqlclient.18.dylib, but copying it from /usr/local/mysql/lib to the lib directory of R fixed it too.

Upvotes: 1

Related Questions