(Ruby 2.5.1) Windows Fix – “Cannot Load This sort of File – Sqlite3/Sqlite3_indigenous (LoadError)”

0
73
Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  


If you use Windows, you will have to respect that there are a number of gems which require exterior libraries in get to be “developed” adequately.

These external libraries are typically not current on your system and are demanded to be put in (and referenced) to get them operating. This is why the likes of the MYSQL2 and RMagick gems are seen as “complicated” to put in.

If you’re working with SQLite3, factors are a little distinct.

This gem has many “builds” which are intended to deliver functionality throughout a amount of platforms (Windows bundled). Even though this performs in previously versions of Ruby, it would not get the job done for Ruby 2.5.1+ – for this reason the mistake you are observing…

simply cannot load these types of file — sqlite3/sqlite3_native (LoadError)

The error is brought about by the set up & tried utilization of the “mingw32” model of the gem. This variation of the gem is pre-compiled with the SQLite core documents, but has difficulties when being utilized with the afterwards versions of Ruby.

The answer is to install the gem for the “ruby” system (which still performs good in Windows):

gem set up sqlite3 –platform=ruby

This will put in the “native” edition of the gem with all the ideal files and so forth – but will not use any of the platform-precise operation that arrives with the likes of the mingw32 edition.

This will operate 100% out of the box.

Nevertheless, there’s one more challenge. If you use “bundler”, it will frequently override the native gem set up in favour of a system-certain one particular. This suggests that if you operate bundle update / bundle put in, it will probably set up the sqlite3 gem with mingw32 system.

In this instance, you have to have to uninstall *any* references to the latter by employing “gem uninstall”. Here is what usually comes about (for us):

  • bundle update [installs sqlite3]
  • gem uninstall sqlite3 [shows selection]
  • remove “mingw32” variant
  • rails s [should work 100%]

This will get the system working with the gem.

The huge dilemma is that when you use the “mingw32” version of the gem, it will have a established of references/phone calls which are built precisely to call particular aspects of the gem.

In Ruby 2.5.1+ – for what ever reason – these phone calls are not completely utilized to make certain that the program is ready to make the most progress, therefore the error you might be looking at. To deal with this, you require to be equipped to fundamentally “power” your system to only use the “ruby” variant of the gem.

Of course, if you happen to be using the likes of Linux or Mac as a enhancement setting – this kind of detail could be fairly only averted. But where’s the pleasurable in doing some thing that is straightforward? Use Home windows!

Supply by Richard Peck

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

LEAVE A REPLY

Please enter your comment!
Please enter your name here