Mind Ramblings My Blog

The Load Error

I hope you remember the LoadError that I shared with you last week. The one which I was stuck for many days, and well frankly I couldn’t devote much time too, at the beginning of this week as there was the competition and the travel back home. It was only these one or two days at the end when I could search for the error.
For convenience, I am adding the gist again

I was very close to finding out the error. I was certain that the directory, or atleast the file was missing from the $LOAD_PATH. Which becomes obvious, once you go through a few results after you have searched for the same error on the internet. But I had followed the tutorials from RubyGems.org on writing, file structure and naming of the extensions. So, there wasn’t any doubt that the extension might be building at a wrong location, that was not added to the $LOAD_PATH.

Even upon checking, the file symengine.so was right there in lib/symengine dir, after the extension was properly built. The only thing that I followed a little different from the tutorials was the gemspec file. So, I narrowed it down to gemspec file where the error might have been caused. Or some missing parameter that we need to set in order to include that to the $LOAD_PATH upon installation of the gem.

Then Isuru, one of my fellow GSoC students from SymPy, came to the rescue and pointed out that I had failed to include the library file symegine.so in the files list of the gem. What I was doing was

gem.files = Dir["lib/**/*.rb", "bin/*", "LICENSE", "*.md"]

With lib/**/*.rb I was clearly missing out the lib/symegine/symegine.so file, which was the one require 'symengine' wasn’t able to load. Upon doing

gem.files = Dir["lib/**/*", "bin/*", "LICENSE", "*.md"]

I could finally resolve the load error.

Commits:
1. Load error fixed, added symengine.so to gem.files



comments powered by Disqus