7

私はhomebrew(Linuxポート)を使用してfreeTDSをインストールし、gemtinytdsを使用してアプリを/bundleインストールしようとしています。バンドルインストールを実行すると、このエラー出力が表示されます

Installing tiny_tds (0.5.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/deployer/.rbenv/versions/1.9.2-p290/bin/ruby extconf.rb 

/usr/bin/ld: /opt/homebrew/lib/libsybdb.a(dblib.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC

/opt/homebrew/lib/libsybdb.a: could not read symbols: Bad value

この修正に非常に似ていますが、私のフォルダーで参照されているファイルがありません:https ://stackoverflow.com/a/7119224/1130736

自作libフォルダーの内容:

/opt/homebrew/lib$ ls
libct.a  libsybdb.a

完全なエラーダンプ:

full error dump:

Installing tiny_tds (0.5.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/deployer/.rbenv/versions/1.9.2-p290/bin/ruby extconf.rb 
checking for iconv_open() in iconv.h... yes
checking for sybfront.h... yes
checking for sybdb.h... yes
checking for tdsdbopen() in -lsybdb... yes
checking for ct_bind() in -lct... yes
creating Makefile

make
/usr/bin/gcc -I. -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/x86_64-linux -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1 -I. -DHAVE_ICONV_OPEN -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I/opt/homebrew/include -I/usr/local/include -I/usr/include -I'/home/deployer/.rbenv/versions/1.9.2-p290/include'    -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long   -o client.o -c client.c
client.c: In function ‘tinytds_err_handler’:
client.c:52: warning: initialization discards qualifiers from pointer target type
client.c: In function ‘tinytds_msg_handler’:
client.c:100: warning: initialization discards qualifiers from pointer target type
/usr/bin/gcc -I. -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/x86_64-linux -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1 -I. -DHAVE_ICONV_OPEN -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I/opt/homebrew/include -I/usr/local/include -I/usr/include -I'/home/deployer/.rbenv/versions/1.9.2-p290/include'    -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long   -o result.o -c result.c
/usr/bin/gcc -I. -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/x86_64-linux -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1 -I. -DHAVE_ICONV_OPEN -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I/opt/homebrew/include -I/usr/local/include -I/usr/include -I'/home/deployer/.rbenv/versions/1.9.2-p290/include'    -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long   -o tiny_tds_ext.o -c tiny_tds_ext.c
/usr/bin/gcc -shared -o tiny_tds.so client.o result.o tiny_tds_ext.o -L. -L/home/deployer/.rbenv/versions/1.9.2-p290/lib -Wl,-R/home/deployer/.rbenv/versions/1.9.2-p290/lib -L/home/deployer/.rbenv/versions/1.9.2-p290/lib -Wl,-R/home/deployer/.rbenv/versions/1.9.2-p290/lib -L/opt/homebrew/lib -Wl,-R/opt/homebrew/lib -L/usr/lib -Wl,-R/usr/lib -L. -L'/home/deployer/.rbenv/versions/1.9.2-p290/lib'  -rdynamic -Wl,-export-dynamic    -lct -lsybdb  -lpthread -lrt -ldl -lcrypt -lm   -lc 
/usr/bin/ld: /opt/homebrew/lib/libsybdb.a(dblib.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/opt/homebrew/lib/libsybdb.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [tiny_tds.so] Error 1


Gem files will remain installed in /home/deployer/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/tiny_tds-0.5.1 for inspection.
Results logged to /home/deployer/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/tiny_tds-0.5.1/ext/tiny_tds/gem_make.out
An error occured while installing tiny_tds (0.5.1), and Bundler cannot continue.
Make sure that `gem install tiny_tds -v '0.5.1'` succeeds before bundling.'
4

4 に答える 4

10

自作でFreeTDSをインストールします:brew install freetds

次に、このインストールは機能するはずです。gem install tiny_tds

于 2013-09-29T08:52:09.370 に答える
7

私はfedoraを実行していますが、修正は

sudo yum install freetds-devel

これを機能させるには、freetdsの開発パッケージが必要なだけだと確信しています。私が開発パッケージを手に入れた後、

gem install tiny_tds

完璧に動作しました。

于 2012-07-05T15:20:18.803 に答える
0

Macへのtiny_tdsのインストール:

bundlerを使用してtiny_tdsgemをインストールするには、FreeTDSを最初にインストールする必要があります。また、バンドラーにFreeTDSの場所を通知する必要があります。

まず、FreeTDSをインストールします。

brew install freetds

デフォルトでは、tiny_tdsは特定の場所で検索されますが、homebrewによってインストールされたfreetdsは、どの場所でも見つかりません。

looking for freetds headers in the following directories:
 - /opt/local/include
 - /opt/local/include/freetds
 - /usr/local/include
 - /usr/local/include/freetds
looking for freetds library in the following directories:
 - /opt/local/lib
 - /opt/local/lib/freetds
 - /usr/local/lib
 - /usr/local/lib/freetds

したがって、最初に、freetdslibおよびincludeディレクトリがどこにあるかを正確に見つける必要があります。

ls -l /opt/homebrew/Cellar/freetds

これが投稿された時点で、brewによってインストールされたfreetdsのバージョンは1.3.3であるため、次のように表示されるディレクトリですls -l

drwxr-xr-x  15 [username]  admin  480 Dec  7 15:36 1.3.3

次に、そのフォルダにcdして、その内容を確認します。

cd /opt/homebrew/Cellar/freetds/1.3.3
ls -l

そのフォルダにfreetdsのincludeディレクトリとlibディレクトリがあります。

次に、bundlerに、tiny_tdsにそれらを見つける場所を指示するように指示します。

bundle config set --global build.tiny_tds --with-freetds-dir=/opt/homebrew/Cellar/freetds/1.3.3

これでbundle、tiny_tdsgemが作成されます。

于 2021-12-08T06:43:33.657 に答える
-1

私は同じ問題を抱えていました、私はこれらの2つのコマンドでそれを解決しました:brew install freetds

そして、x64フラグ付きのgemをインストールする必要があります:ARCHFLAGS = "-arch x86_64" gem install tiny_tds

于 2016-02-12T16:08:41.753 に答える