How to load Spatialite SQLite extension on macOS - macos

I am attempting to load the libspatialite extension in SQLite. As per the installation guide, I downloaded the latest libspatialite and moved the included libspatialite.1.1.3.dylib file to /usr/local/lib.
greg /usr/local/lib $ls | grep libspatialite
libspatialite.1.1.3.dylib
However, I was unable to load the extension.
sql> SELECT load_extension('libspatialite.1.1.3.dylib')
[2017-09-19 10:45:25] [1] [SQLITE_ERROR] SQL error or missing database (dlopen(libspatialite.1.1.3.dylib.dylib, 10): image not found)
I also tried storing libspatialite.1.1.3.dylib.dylib in the same directory as the sqlite file with no luck.
I have confirmed that enable_load_extension is true and I'm using DataGrip as my IDE. I have also quit DataGrip and rebooted to ensure any new binaries are collected. Am I missing something obvious?

As per this homebrew formula for libspatialite:
New SQLite3 extension won't load via SELECT load_extension("mod_spatialite"); unless named mod_spatialite.dylib (should actually be mod_spatialite.bundle). See: https://groups.google.com/forum/#!topic/spatialite-users/EqJAB8FYRdI
So, if installing manually, you gonna need to rename the dynamic library file as per suggested. Or you can let Homebrew do the installation for you:
brew install libspatialite

Related

How to specify external library file locations when installing CPAN modules

I'm trying to get Perl's Finance::Quote module working after MacOS upgrade to 11.4. One of the dependencies is B::Keywords. B::Keywords installation fails a test with this error:
> sudo cpan B::Keywords
[...]
Can't open /System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/keywords.h: No such file or directory at t/11keywords.t line 25
Digging around, I see that keywords.h exists on my system in this location:
/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/keywords.h
Is there a way to tell cpan (or cpanm, or some other installation tool) where to look for these headers? Or, any other approach to get this working would be welcome.
It seems like they removed the keywords.h from the CORE directory (relative to the path given from $Config{archlibexp}) for the system perl on macOS 10.14, see this bug report.
The reason you are not able to install B::Keywords is due to a failed test 11keywords.t see line 24. Some possible solutions:
Install the module without running the tests (sudo cpan -T B::Keywords)
Submit an issue at the GitHub issue tracker so the author of the module can fix the problem.
Install the module with perlbrew instead of using the system perl (I tested this and it worked fine here).

Ubuntu libexiv2.so.26 missing error message

I am working with the exiv2 library. I currently faced an issue, and i can't find my way out of it. Here is the issue.
I installed the exiv2 library. When I try to run it, the following error is given.
exiv2: error while loading the shared libraries: libexiv2.so.26: cannot open shared object file: No such file or directory
But, when i open the /usr/local/lib folder, it exists there. Again when I try to locate the library using the ldd command, the command cannot locate it!
Can anyone help me to find what is going on there? Thanks in advance!
If not how to uninstall the whole library and reinstall it?
I had a similar problem when using the sources for installing.
You can remove the built files with sudo make uninstall from inside the sources folder of exiv2.
The solution to my problem was to simply use the package from the Ubuntu repository: sudo apt install exiv2 libexiv2-dev.
Hopefully this will help you too.

I get a LoadError when trying to about anything with a new Ruby install on Windows

I installed Ruby on Windows via RubyInstaller, with the associated DevKit.
I'm trying to run various scripts (mainly Jekyll), and I'm getting all sorts of errors about paths. For instance:
...cannot load such file -- redcarpet.so (LoadError)
Or:
...cannot load such file -- 2.0/redcloth_scan (LoadError)
Specifically, in both those cases, I'm trying to run "redcloth.bat" and "redcarpet.bat" in the bin directory of the Ruby directory.
I feel like I'm missing something basic with paths. Note that this has never worked -- I installed the RubyInstaller, then the DevKit, then the Jekyll gem...and this is what happened.
Is there something basic about this installation that I failed to set?
We ran into the RedCloth side of this error today.
We started with this error
How to install RedCloth on Windows?
What we found was we had installed the mswin32 version of RedCloth, we first got the no such file to load.
We then went to our
C:\ruby200/lib/ruby/gems/1.9.1/gems/RedCloth-mswin32
Directory , added the 2.0 file and copied the redcloth_scan.so file into the 2.0 directory.
We started getting another error that was similar.
We decided we would just uninstall the precompiled version of the gem, and start with the normal RedCloth-2.4.9.gem to be compiled locally with devkit.
Once this was installed, we again went to the lib dir for the gem.
CD C:/ruby200/lib/ruby/gems/1.9.1/gems/RedCloth-2.4.9/lib
We created a 2.0 directory
We then copied the file redcloth_scan.so file into the 2.0 directory and we no longer had the error. The server came up fine and we

Install a Ruby located on local system using RVM

How would one install a Ruby VM (JRuby, Ruby MRI, etc.) on a machine that doesn't have internet access?
I'd like to just drop the tar.gz file somewhere that RVM is able to see (or checks before it goes out and tries to retrieve the package itself). Any ideas?
This blog post explains that you can drop the source archive in your $HOME/.rvm/archives directory.
cp ruby-enterprise-1.8.7-2010.02.tar.gz /home/minhajuddin/.rvm/archives
rvm install ree-1.8.7
Or the docs say that you can specify the archives directory from the command line:
--archives - directory for downladed files (~/.rvm/archives/)

Ruby cannot find sqlite3 driver on windows

I am trying to set up Ruby on Rails on windows. I am using the Flash Rails distribution that looks pretty good, but there is an issue with sqlite3. I found the threads telling me to install version 1.2.3, which installed fine. I'm using ruby 1.9.0, and every time I try and run a script (e.g. rake db:create) that uses the database I get an error message "no driver for sqlite3 found".
This apparently is a missing sqlite3.dll, but I have the dll in my %PATH%, and I have also tried copying it into the directory where I am running the script from, the directory where the sqlite3 ruby code lives.
Does anyone have any ideas? If possible I want all teh ruby stuff to be self contained so I can use it from a pen drive.
EDIT: To clarify, I already used gem install to install the ruby-sqlite3 gem - it is just non functional as it cannot find the sqlite3.dll (even though it is actually present in a directory on my %PATH%)
EDIT PART 2: After doing some more digging, the problem appears that ruby will not load the sqlite3_api.dll. I have copied it all over my filesystem, I just get a failure to read file. Other dll libraries in the same directory (e.g. zlib.dll) work fine!
I tried installing the dlls into system32, and that did not work either.
The problem put simply is that sqlite3-ruby 1.2.3 is not compatible with ruby 1.9. This is caused because ruby 1.9 does not use .dll files for c libraries it uses .so files instead. Additionally, since sqlite3_api.dll is written against msvcrt-ruby18.dll. This means that it specifically only will support ruby 1.8.*.
The good news is that there is a fat binary version that will support both ruby 1.8 and ruby 1.9. Uninstalling all former versions of sqlite3-ruby and then installing this one. (You may have to manually delete some versions the gem after uninstalling.) in order to install it use
install sqlite3-ruby --source http://gems.rubyinstaller.org
for more information see this website
Try installing the sqlite3-ruby gem:
gem install sqlite3-ruby
Something similar happened to me recently so I thought I'd update my answer.
For reference there's a sqlite3_api.dll file located in the gem's lib directory. Also the sqlite3.dll file needs to be reachable on the path. They are different files, the first is required by the gem to interface Ruby to C code, while the second contains the actual Sqlite implementation.
It's best to get the second file from the sqlite website and extract it to the Ruby\bin directory (as you shouldn't manually put DLL's into the windows or windows\system directories any more).
So for reference "sqlite3_api.dll" needs to be in:
Ruby\lib\ruby\gems\1.8\gems\sqlite3-ruby-1.2.3-x86-mswin32\lib
and "sqlite3.dll" needs to be on the path, possibly in:
Ruby\bin
As for the "driver not found" problem I would suggest trying the easy things first and making sure gems is installed correctly, up to date, and that the RUBYLIB and PATH environment variables are set appropriately. (System restart may be required to propagate the changes fully.)
Re this link
Download sqlitedll-3_6_10.zip and extract into ruby/bin!
Try going to sqlite.org download page and get the zipped up dll. Then put that in your c:\windows\system32 folder, that should allow Ruby to find it.
Restart your machine after running install sqlite3-ruby
To clarify, which gem are you using? sqlite-ruby or sqlite3-ruby?
They're part of the same project, but different releases. The key is that sqlite3 appears to have driver code included.
I assume you're attempting to use the first, since it's giving me the same error. If so, try switching.
Also.. How literal do you mean by this?
but I have the dll in my %PATH%
PATH=...;C:\sqlite\sqlite3.dll
PATH=...;C:\sqlite
The first will attempt to find C:\sqlite\sqlite3.dll\sqlite3.dll, AFAIK.
I use Ruby 1.8.7 (works with 1.9.1 too)
OS is WindowsXP SP3
Go to
http://www.sqlite.org/download.html
and Download file
sqlitedll-3_7_0_1.zip (265.19 KiB)
and unzip then we will get
sqlite3.dll
Copy sqlite3.dll to your bin folder
as C:\Ruby191\bin or C:\Ruby187\bin
then it works

Resources