如果这是一个重复的问题,我道歉。我继承了一个包含ZipRuby作为必需Gems之一的项目。我的本地开发环境是Windows 7.我的ruby是1.9.3p194。我有Rails 3.2.6。我已经安装了RubyDevKit版本452。
所有其他必要的宝石要么在Windows 7上安装,要么本机兼容,而不是ZipRuby gem。我从来没有从头开始制作宝石。 gem开始编译并出现以下错误。
`enter code here` linking shared-object zipruby.so
tmpfile.o: In function `zipruby_tmpnam':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/tmpfile.c:56: undefined reference to `strcpy_s'
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/tmpfile.c:62: undefined reference to `_sopen_s'
zipruby_archive.o: In function `zipruby_archive_read':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zipruby_archive.c:1447: undefined reference to `fopen_s'
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zipruby_archive.c:1471: undefined reference to `_fclose_nolock'
zip_close.o: In function `add_data':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_close.c:293: undefined reference to `ftello'
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_close.c:312: undefined reference to `ftello'
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_close.c:314: undefined reference to `fseeko'
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_close.c:328: undefined reference to `fseeko'
zip_close.o: In function `zip_close':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_close.c:188: undefined reference to `ftello'
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_close.c:153: undefined reference to `fseeko'
zip_crypt.o: In function `zip_crypt':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_crypt.c:293: undefined reference to `ftello'
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_crypt.c:265: undefined reference to `fseeko'
zip_dirent.o: In function `zip_cdir_write':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_dirent.c:109: undefined reference to `ftello'
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_dirent.c:116: undefined reference to `ftello'
zip_file_get_offset.o: In function `zip_file_get_offset':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_file_get_offset.c:64: undefined reference to `fseeko'
zip_fopen_index.o: In function `zip_file_fillbuf':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_fopen_index.c:155: undefined reference to `fseeko'
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_fopen_index.c:155: undefined reference to `fseeko'
zip_open.o: In function `zip_checkcons':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_open.c:282: undefined reference to `fseeko'
zip_open.o: In function `zip_open':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_open.c:84: undefined reference to `fseeko'
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_open.c:85: undefined reference to `ftello'
zip_open.o: In function `zip_find_central_dir':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_open.c:436: undefined reference to `fseeko'
zip_open.o: In function `zip_readcdir':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_open.c:217: undefined reference to `fseeko'
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_open.c:220: undefined reference to `ftello'
zip_source_filep.o: In function `read_file':
C:\Ruby193\lib\ruby\gems\1.9.1\gems\zipruby-0.3.6\ext/zip_source_filep.c:105: undefined reference to `fseeko'
collect2: ld returned 1 exit status make: *** [zipruby.so] Error 1
很明显,没有解析对一个或多个库文件的引用。我不知道下一步该怎么做。有没有人在Windows 7上使用zipruby和mingw安装ruby成功?
我错过了一些其他信息。为了达到这个目的,我不得不安装GnuWin32的Windows开发版本。因此gem的构建命令是:Gem install ZipRuby - --with-opt-dir = Path.to.GnuWin32.folder。此文件夹中必须包含一个包含源代码的lib和bin文件夹。如果我从其他任何地方得到答案之前弄清楚任何问题,我会更多地更新问题,如果我了解更多并发布解决方案。
答案 0 :(得分:0)
尝试gem install zipruby --version" = 0.3.6" --platform = mswin32
它对我有用。