質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

RubyGems

RubyGemsはRubyによるプログラミングのためのパッケージマネジメントツールです。ユーザはこれを使用することで、Rubyライブラリのダウンロードやアップデートや、依存関係の自動解決が可能になります。

Q&A

解決済

2回答

1752閲覧

【Rails】Gemがインストールできない

HisanoriSato

総合スコア67

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

RubyGems

RubyGemsはRubyによるプログラミングのためのパッケージマネジメントツールです。ユーザはこれを使用することで、Rubyライブラリのダウンロードやアップデートや、依存関係の自動解決が可能になります。

0グッド

0クリップ

投稿2022/10/12 07:25

編集2022/10/12 07:41

前提

Gem'TinyTDS'を使用してSQLserverにODBC接続したい。

実現したいこと

Gem'tinyTDS'のインストール

発生している問題・エラーメッセージ

ruby

1#実行コマンド(パスはもちろん合っている) 2D:\racoon>gem install tiny_tds -- --with-freetds-dir=C:\freetds-1.00 3 4#ログ(コマンドプロンプト) 5Temporarily enhancing PATH for MSYS/MINGW... 6Using msys2 packages: mingw-w64-i686-freetds 7Building native extensions with: '--with-freetds-dir=C:\freetds-1.00' 8This could take a while... 9ERROR: Error installing tiny_tds: 10 ERROR: Failed to build gem native extension. 11 12 current directory: C:/Ruby30/lib/ruby/gems/3.0.0/gems/tiny_tds-2.1.5/ext/tiny_tds 13C:/Ruby30/bin/ruby.exe -I C:/Ruby30/lib/ruby/3.0.0 -r ./siteconf20221012-27184-g0xt2g.rb extconf.rb --with-freetds-dir\=C:\\freetds-1.00 14looking for freetds headers in the following directories: 15 - /opt/local/include 16 - /opt/local/include/freetds 17 - /usr/local/include 18 - /usr/local/include/freetds 19looking for freetds library in the following directories: 20 - /opt/local/lib 21 - /opt/local/lib/freetds 22 - /usr/local/lib 23 - /usr/local/lib/freetds 24checking for sybfront.h... yes 25checking for sybdb.h... yes 26checking for tdsdbopen() in -lsybdb... no 27checking for dbanydatecrack() in -lsybdb... no 28Failed! Do you have FreeTDS 0.95.80 or higher installed? 29*** extconf.rb failed *** 30Could not create Makefile due to some reason, probably lack of necessary 31libraries and/or headers. Check the mkmf.log file for more details. You may 32need configuration options. 33 34Provided configuration options: 35 --with-opt-dir 36 --without-opt-dir 37 --with-opt-include 38 --without-opt-include=${opt-dir}/include 39 --with-opt-lib 40 --without-opt-lib=${opt-dir}/lib 41 --with-make-prog 42 --without-make-prog 43 --srcdir=. 44 --curdir 45 --ruby=C:/Ruby30/bin/$(RUBY_BASE_NAME) 46 --help 47 --with-freetds-dir 48 --with-freetds-include 49 --without-freetds-include=${freetds-dir}/include 50 --with-freetds-lib 51 --without-freetds-lib=${freetds-dir}/lib 52 --with-sybdb-dir 53 --without-sybdb-dir 54 --with-sybdb-include 55 --without-sybdb-include=${sybdb-dir}/include 56 --with-sybdb-lib 57 --without-sybdb-lib=${sybdb-dir}/lib 58 --with-sybdblib 59 --without-sybdblib 60 --with-sybdblib 61 --without-sybdblib 62 63To see why this extension failed to compile, please check the mkmf.log which can be found here: 64 65 C:/Ruby30/lib/ruby/gems/3.0.0/extensions/x86-mingw32/3.0.0/tiny_tds-2.1.5/mkmf.log 66 67extconf failed, exit code 1 68 69Gem files will remain installed in C:/Ruby30/lib/ruby/gems/3.0.0/gems/tiny_tds-2.1.5 for inspection. 70Results logged to C:/Ruby30/lib/ruby/gems/3.0.0/extensions/x86-mingw32/3.0.0/tiny_tds-2.1.5/gem_make.out

ログファイル"mkmf.log"

cmd

1find_header: checking for sybfront.h... -------------------- yes 2 3"gcc -o conftest.exe -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:\freetds-1.00/include -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:/Ruby30/lib -LC:\freetds-1.00/lib -L. -pipe -s -fstack-protector-strong -lmsvcrt-ruby300 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi " 4checked program was: 5/* begin */ 61: #include "ruby.h" 72: 83: #include <winsock2.h> 94: #include <windows.h> 105: int main(int argc, char **argv) 116: { 127: return !!argv[argc]; 138: } 14/* end */ 15 16"gcc -E -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:\freetds-1.00/include -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 -o conftest.i" 17checked program was: 18/* begin */ 191: #include "ruby.h" 202: 213: #include <winsock2.h> 224: #include <windows.h> 235: #include <sybfront.h> 24/* end */ 25 26-------------------- 27 28find_header: checking for sybdb.h... -------------------- yes 29 30"gcc -E -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:\freetds-1.00/include -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 -o conftest.i" 31checked program was: 32/* begin */ 331: #include "ruby.h" 342: 353: #include <winsock2.h> 364: #include <windows.h> 375: #include <sybdb.h> 38/* end */ 39 40-------------------- 41 42find_library: checking for tdsdbopen() in -lsybdb... -------------------- no 43 44"gcc -o conftest.exe -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:\freetds-1.00/include -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:/Ruby30/lib -LC:\freetds-1.00/lib -L. -pipe -s -fstack-protector-strong -lmsvcrt-ruby300 -lsybdb -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi " 45conftest.c: In function 't': 46conftest.c:17:57: error: 'tdsdbopen' undeclared (first use in this function) 47 17 | int t(void) { void ((*volatile p)()); p = (void ((*)()))tdsdbopen; return !p; } 48 | ^~~~~~~~~ 49conftest.c:17:57: note: each undeclared identifier is reported only once for each function it appears in 50checked program was: 51/* begin */ 52 1: #include "ruby.h" 53 2: 54 3: #include <winsock2.h> 55 4: #include <windows.h> 56 5: 57 6: /*top*/ 58 7: extern int t(void); 59 8: int main(int argc, char **argv) 60 9: { 6110: if (argc > 1000000) { 6211: int (* volatile tp)(void)=(int (*)(void))&t; 6312: printf("%d", (*tp)()); 6413: } 6514: 6615: return !!argv[argc]; 6716: } 6817: int t(void) { void ((*volatile p)()); p = (void ((*)()))tdsdbopen; return !p; } 69/* end */ 70`RSA_public_encrypt' 71 72collect2.exe: error: ld returned 1 exit status 73checked program was: 74/* begin */ 75 1: #include "ruby.h" 76 2: 77 3: #include <winsock2.h> 78 4: #include <windows.h> 79 5: 80 6: /*top*/ 81 7: extern int t(void); 82 8: int main(int argc, char **argv) 83 9: { 8410: if (argc > 1000000) { 8511: int (* volatile tp)(void)=(int (*)(void))&t; 8612: printf("%d", (*tp)()); 8713: } 8814: 8915: return !!argv[argc]; 9016: } 9117: extern void tdsdbopen(); 9218: int t(void) { tdsdbopen(); return 0; } 93/* end */ 94 95-------------------- 96 97find_library: checking for dbanydatecrack() in -lsybdb... -------------------- no 98 99"gcc -o conftest.exe -IC:/Ruby30/include/ruby-3.0.0/i386-mingw32 -IC:/Ruby30/include/ruby-3.0.0/ruby/backward -IC:/Ruby30/include/ruby-3.0.0 -I. -IC:\freetds-1.00/include -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:/Ruby30/lib -LC:\freetds-1.00/lib -L. -pipe -s -fstack-protector-strong -lmsvcrt-ruby300 -lsybdb -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi " 100conftest.c: In function 't': 101conftest.c:17:57: error: 'dbanydatecrack' undeclared (first use in this function) 102 17 | int t(void) { void ((*volatile p)()); p = (void ((*)()))dbanydatecrack; return !p; } 103 | ^~~~~~~~~~~~~~ 104conftest.c:17:57: note: each undeclared identifier is reported only once for each function it appears in 105checked program was: 106/* begin */ 107 1: #include "ruby.h" 108 2: 109 3: #include <winsock2.h> 110 4: #include <windows.h> 111 5: 112 6: /*top*/ 113 7: extern int t(void); 114 8: int main(int argc, char **argv) 115 9: { 11610: if (argc > 1000000) { 11711: int (* volatile tp)(void)=(int (*)(void))&t; 11812: printf("%d", (*tp)()); 11913: } 12014: 12115: return !!argv[argc]; 12216: } 12317: int t(void) { void ((*volatile p)()); p = (void ((*)()))dbanydatecrack; return !p; } 124/* end */ 125`RSA_public_encrypt' 126 127collect2.exe: error: ld returned 1 exit status 128checked program was: 129/* begin */ 130 1: #include "ruby.h" 131 2: 132 3: #include <winsock2.h> 133 4: #include <windows.h> 134 5: 135 6: /*top*/ 136 7: extern int t(void); 137 8: int main(int argc, char **argv) 138 9: { 13910: if (argc > 1000000) { 14011: int (* volatile tp)(void)=(int (*)(void))&t; 14112: printf("%d", (*tp)()); 14213: } 14314: 14415: return !!argv[argc]; 14516: } 14617: extern void dbanydatecrack(); 14718: int t(void) { dbanydatecrack(); return 0; } 148/* end */ 149 150-------------------- 151 152

該当のソースコード

cmd

1gem install tiny_tds -- --with-freetds-dir=C:\freetds-1.00

試したこと

一度下記コマンドでアンインストールしてからインストール

cmd

1gem uninstall tiny_tds -- --with-freetds-dir=C:\freetds-1.00

補足情報(FW/ツールのバージョンなど)

Ruby 3.0.2
Rails 6.1.6
TinyTDS 2.1.5
FreeTDS Version: 1.00

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kazto

2022/10/12 07:28

> To see why this extension failed to compile, please check the mkmf.log which can be found here: > C:/Ruby30/lib/ruby/gems/3.0.0/extensions/x86-mingw32/3.0.0/tiny_tds-2.1.5/mkmf.log ということで、まずはmkmf.logを確認してみてください。
m.ts10806

2022/10/12 07:32

特別な理由がない限りはWindows直ではなくWSL含めたLinux環境のほうが適切に思うのですが如何でしょうか
HisanoriSato

2022/10/12 07:42

ありがとうございます。ひとまずWindowsで設定したく思っています。 開発メンバーが全員Windows環境で上記処理に成功しており、 私だけうまく行っていない状態なんです。
guest

回答2

0

自己解決

コマンドの実行をCmdではなくPowerShellにしたら解決しました。
なんでやねん。。。。

投稿2022/10/24 05:40

HisanoriSato

総合スコア67

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

Failed! Do you have FreeTDS 0.95.80 or higher installed?

とあるので、FreeTDS Version: 1.00 には対応していないのではないでしょうか。
指示にあるように 0.95.80 をインストールしなおしてみてはいかがでしょうか。

投稿2022/10/12 08:01

kazto

総合スコア7196

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

HisanoriSato

2022/10/24 05:40

ありがとうございます。Windowsでは不可でしたので、別件で解決しました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問