Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 700 Vote(s) - 3.55 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error installing mysql2: Failed to build gem native extension

#31
I have several computers, 32 and 64 bits processor, they run on Ubuntu Linux, Maverick (10.10) release.

I had the same problem, and for me, the
`sudo apt-get install libmysql-ruby libmysqlclient-dev`
did the job!!!
Reply

#32
An updated solution for Windows users. I am running

**Windows 10**

**MySql 8.0.30**

**Ruby 3.1.2**

My Ruby version is the one from rubyinstaller.org with the MYSYS devkit included

I downloaded a MariaDB C connector library msi installer file v3.1.17, ran it and it installed the relevant files in a directory in Program Files. I copied that directory to another location, renamed it so that it didn't have any spaces and ran the command:

gem install mysql2 --platform=ruby -- --with-mysql-dir="c:/my-mariadb-connector-path-with-no-spaces"

This gave me a functioning gem.

This is a specific version of the library and not the most recent. Finding your way around the download options on the MariaDB website is a bit confusing, so here is the direct download link.

[To see links please register here]


Before I got to this point I'd tried several things which hadn't worked. I've included them below as background information, but if all you're interested in is a working solution then you can stop reading now.

A few sources suggest that if you have the MYSYS devkit installed you can build the gem with the following command:

ridk exec gem install mysql2 --platform=ruby -- --use-system-libraries

This did not compile for me.

You may also have seen a recommendation to download an archived version - 6.1 - of the MySQl connector library. I tried this, the gem compiled, but when I tried to start my app I got an error message: "Incorrect MySQL client library version! This gem was compiled for 6.1.11 but the client library is 10.5.5."

In MySQL V8 and above the C library is no longer an optional extra but is included in the main installation. I found the relevant files, copied them to a no spaces directory path and tried the usual command. Again the gem compiled but the app wouldn't start. This time the error message said that "This gem was compiled for 8.0.30 but the client library is 10.5.5"

I also tried the latest version of of the MariaDB library. With that the error message said that the gem was compiled for 10.6.8. You need the specific version described above, and yes, it really is a MariaDB library you need even if you're using "Original" MySql as distributed by the Oracle Corporation
Reply

#33
1) Download the connector C file from [here][1]. (

[To see links please register here]

)

2) Extract the file to a location, like C:\ror\mysqlC\mysql-connector-c-6.1.11-winx64\lib

3) Use this template

gem install mysql2 -- '--with-mysql-lib="$*lib_location*" --with-mysql-include="$*include_location*"'

eg: My installed location is **lib_location** -> C:\ror\mysqlC\mysql-connector-c-6.1.11-winx64\lib


*gem install mysql2 -- '--with-mysql-lib="C:\ror\mysqlC\mysql-connector-c-6.1.11-winx64\lib" --with-mysql-include="C:\ror\mysqlC\mysql-connector-c-6.1.11-winx64\include"'*


Reply

#34
For M1 with Ventura:

```
gem install mysql2 -v '0.5.3' -- --with-mysql-config=$(brew --prefix mysql)/bin/mysql_config --with-ldflags="-L$(brew --prefix zstd)/lib -L$(brew --prefix openssl)/lib" --with-cppflags=-I$(brew --prefix openssl)/include
```

Thanks to
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through