2012-04-03 34 views
6

Tôi đã sử dụng homebrew (cổng linux) để cài đặt freeTDS và đang cố gắng triển khai/gói cài đặt ứng dụng của tôi với gem tinytds. Tôi nhận ra lỗi này khi làm bó cài đặtLỗi homebrew/TinyTDS/FreeTDS lỗi

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 

Khá tương tự như sửa chữa điều này, nhưng tôi không có các tập tin được đề cập trong thư mục của tôi: https://stackoverflow.com/a/7119224/1130736

Nội dung của thư mục lib homebrew:

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

Full bãi lỗi:

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.' 
+0

bạn đã bao giờ tìm thấy bản sửa lỗi cho điều này chưa? – shergill

Trả lời

7

tôi chạy fedora, nhưng việc sửa chữa cho tôi là

sudo yum install freetds-devel 

Tôi khá chắc chắn rằng bạn chỉ cần có gói phát triển của freetds để làm việc này. Sau khi tôi có gói devel,

gem install tiny_tds 

của chúng tôi hoạt động hoàn hảo.

+6

cho ubuntu sudo apt-get cài đặt freetds-dev –

10

Cài đặt FreeTDS với homebrew: brew install freetds.

Sau đó, cài đặt này sẽ làm việc: gem install tiny_tds

+0

tính năng này không hoạt động đối với tôi vì nó không tạo tệp 'lsybdb.so' – abc123

-1

tôi đã cùng một vấn đề, tôi giải quyết nó với hai lệnh dưới đây: brew cài đặt freetds

Và bạn cần phải cài đặt đá quý với x64 cờ: ARCHFLAGS = "-arch x86_64" gem install tiny_tds