I'm trying to install slacker so I can do some SQL testing. I've never used Ruby before. I'm on Windows. My dev box only has access to the Internet via a proxy and I have to nominate all URls in advance.
I I downloaded and ran rubyinstaller-devkit-2.7.5-1-x64.exe (because it requires Ruby 2.4/2.5 and 2.7.X was recommended at the Ruby site) accepting all of the defaults.
When it got to MSYS2 I hit ENTER (MSYS2 base installation and MINGW development toolchain).
I got errors in the gpg section, e.g. (but not limited to)
==> Updating trust database...
gpg: marginals needed: 3 completes needed: 1 trust model: pgp
gpg: depth: 0 valid: 1 signed: 6 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1 valid: 6 signed: 6 trust: 0-, 0q, 0n, 6m, 0f, 0u
gpg: depth: 2 valid: 6 signed: 0 trust: 6-, 0q, 0n, 0m, 0f, 0u
gpg: next trustdb check due at 2022-03-03
gpg: error retrieving '[email protected]' via WKD: No name
gpg: error reading key: No name
gpg: refreshing 1 key from hkps://keyserver.ubuntu.com
gpg: keyserver refresh failed: No name
==> ERROR: Could not update key: F40D263ECA25678A
Later, it said
MSYS2 seems to be properly installed
I then got a whole bunch of warnings about things being up to date -- skipping.
Then, it said
Install MSYS2 and MINGW development toolchain succeeded
and the MSYS2 window went back to the installation menu, so I closed the window.
Then, as per the instructions on the slacker site, I tried:
gem install slacker
I got:
ERROR: Could not find a valid gem 'slacker' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - no such name (https://rubygems.org/specs.4.8.gz)
I figured this was a proxy server issue and read around and discovered that if I downloaded the gems to a local folder, I could run the command from that folder and it should work. So, I downloaded slacker-1.0.24.gem from https://rubygems.org/gems/, unblocked the file and tried the command from that folder. I got a similar error to above for tiny_tds. I repeated the process until I appeared to have all required gems:
bundler-1.17.3.gem
diff-lcs-1.5.0.gem
rspec-3.10.0.gem
rspec-core-3.10.1.gem
rspec-expectations-3.10.1.gem
rspec-mocks-3.10.2.gem
rspec-support-3.10.3.gem
ruby-odbc-0.99999.gem
slacker-1.0.24.gem
tiny_tds-2.1.5.gem
Finally, it looked like it was working for a few seconds and then I got a whole new bunch of errors. Here are the first few - I can post the lot if it will help:
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-freetds
error: failed retrieving file 'mingw-w64-x86_64-openssl-1.1.1.l-1-any.pkg.tar.zst' from mirror.msys2.org : Could not resolve host: mirror.msys2.org
warning: too many errors from mirror.msys2.org, skipping for the remainder of this transaction
error: failed retrieving file 'mingw-w64-x86_64-freetds-1.2.6-2-any.pkg.tar.zst' from mirror.msys2.org : Could not resolve host: mirror.msys2.org
error: failed retrieving file 'mingw-w64-x86_64-p11-kit-0.24.0-1-any.pkg.tar.zst' from mirror.msys2.org : Could not resolve host: mirror.msys2.org
error: failed retrieving file 'mingw-w64-x86_64-ca-certificates-20210119-1-any.pkg.tar.zst' from mirror.msys2.org : Could not resolve host: mirror.msys2.org
then after those, this:
warning: failed to retrieve some files
error: failed to commit transaction (invalid url for server)
pacman failed with the following output:
resolving dependencies...
looking for conflicting packages...
Packages (6) mingw-w64-x86_64-ca-certificates-20210119-1 mingw-w64-x86_64-libffi-3.3-4 mingw-w64-x86_64-libtasn1-4.18.0-1 mingw-w64-x86_64-openssl-1.1.1.l-1 mingw-w64-x86_64-p11-kit-0.24.0-1 mingw-w64-x86_64-freetds-1.2.6-2
Total Download Size: 6.24 MiB
Total Installed Size: 77.14 MiB
:: Proceed with installation? [Y/n]
:: Retrieving packages...
mingw-w64-x86_64-openssl-1.1.1.l-1-any downloading...
mingw-w64-x86_64-freetds-1.2.6-2-any downloading...
mingw-w64-x86_64-p11-kit-0.24.0-1-any downloading...
mingw-w64-x86_64-ca-certificates-20210119-1-any downloading...
mingw-w64-x86_64-libtasn1-4.18.0-1-any downloading...
Errors occurred, no packages were upgraded.
Building native extensions. This could take a while...
ERROR: Error installing slacker:
ERROR: Failed to build gem native extension.
And more. There was also a reference to a log file which contained sections like this:
find_header: checking for sybfront.h... -------------------- no
"gcc -o conftest.exe -IC:/Ruby27-x64/include/ruby-2.7.0/x64-mingw32 -IC:/Ruby27-x64/include/ruby-2.7.0/ruby/backward -IC:/Ruby27-x64/include/ruby-2.7.0 -I. -I/opt/local/include -I/opt/local/include/freetds -I/usr/local/include -I/usr/local/include/freetds -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby27-x64/lib -L/opt/local/lib -L/opt/local/lib/freetds -L/usr/local/lib -L/usr/local/lib/freetds -L. -pipe -s -fstack-protector-strong -m64 -lx64-msvcrt-ruby270 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7: return !!argv[argc];
8: }
/* end */
To my questions:
- Is there any way to resolve this without getting the URLs added to the proxy list? It's basically at least a week per change because of the hoops we have to jump through.
- If I need to get the URLs added to the proxy list, is there a master list or URLs so I can do it once and be sure it will work? I've tried Googling it but I just end up with help getting Ruby code to use proxys not the installer.
CodePudding user response:
I have answered question 1 myself. If anyone else can give me a definitive answer to part two, I will happily mark that as the answer.
I guessed that I needed to download and install the mingw packages that couldn't be downloaded somewhere. I did a bit of trawling and found this article (Offline installation of packages)which gave me the pointers I needed. I got these four files from https://repo.msys2.org/mingw/mingw64/:
mingw-w64-x86_64-freetds-1.2.6-2-any.pkg.tar.zst
mingw-w64-x86_64-libtasn1-4.18.0-1-any.pkg.tar.zst
mingw-w64-x86_64-openssl-1.1.1.l-1-any.pkg.tar.zst
mingw-w64-x86_64-p11-kit-0.24.0-1-any.pkg.tar.zst
And mingw-w64-x86_64-ca-certificates-20210119-1-any.pkg.tar.zst from https://ftp.acc.umu.se/mirror/msys2.org/mingw/mingw64/.
I copied them to: C:\Ruby27-x64\msys64\home\myUserId\freetds which is in my home dir in msys. (From errors I got the first time, it looks like the folder name has to match the database name.) Then I started msys by running: C:\Ruby27-x64\msys64\msys2.exe.
In msys, I ran:
cd freetds/
then, to create a repository database just for freetds:
$ repo-add freetds.db.tar.gz *.pkg.tar.zst
I got a bunch of messages telling me it was ==> Adding package 'ming...
I needed to edit the pacman.conf file to point to my temp database, so I made a copy of the pacman.conf file:
cp /etc/pacman.conf /etc/pacman.conf.old
I edited pacman.conf in Notepad , changing SigLevel to = Never, commenting out the other repositories, and adding this to the end:
[freetds]
Server = file:///home/myUserId/freetds
Then, I made pacman synchronise with the database I created:
pacman -Sy
:: Synchronizing package databases...
freetds 1676.0 B 7.54 KiB/s 00:00 [#####################] 100%
I tried gem install slacker again but there was another missing package "mingw-w64-x86_64-libffi, so I downloaded mingw-w64-x86_64-libffi-3.3-4-any.pkg.tar.zst and put it in the same place, re-ran the repo-add command and pacman Sy and then gem install slacker.
This worked and I got 10 gems installed. I've run the test project documented in the slacker GitHub pages and it worked.
