禁用ruby扩展

时间:2010-11-16 17:12:58

标签: ruby cygwin

我正在尝试使用Cygwin在Win7 x64下的sctraches中编译ruby 1.9.2-p0 ..一切都很顺利,所有扩展都会被编译,直到它到达win32ole ext时失败并出现以下错误:

win32ole.o: In function `load_conv_function51932':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:934: undefined reference to `_CLSID_CMultiLanguage'
win32ole.o: In function `fole_activex_initialize':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:4762: undefined reference to `_IID_IPersistMemory'
win32ole.o: In function `mf_QueryInterface':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:597: undefined reference to `_IID_IUnknown'
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:597: undefined reference to `_IID_IMessageFilter'
win32ole.o: In function `QueryInterface':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:699: undefined reference to `_IID_IUnknown'
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:699: undefined reference to `_IID_IDispatch'
win32ole.o: In function `EVENTSINK_QueryInterface':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:7571: undefined reference to `_IID_IUnknown'
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:7571: undefined reference to `_IID_IDispatch'
win32ole.o: In function `fole_each':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:4014: undefined reference to `_GUID_NULL'
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:4031: undefined reference to `_IID_IEnumVARIANT'
win32ole.o: In function `load_conv_function51932':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:934: undefined reference to `_CLSID_CMultiLanguage'
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:934: undefined reference to `_CLSID_CMultiLanguage'
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:934: undefined reference to `_CLSID_CMultiLanguage'
win32ole.o: In function `find_default_source':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:8174: undefined reference to `_IID_IProvideClassInfo2'
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:8190: undefined reference to `_IID_IProvideClassInfo'
win32ole.o: In function `ev_advise':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:8308: undefined reference to `_IID_IConnectionPointContainer'
win32ole.o: In function `load_conv_function51932':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:934: undefined reference to `_CLSID_CMultiLanguage'
win32ole.o: In function `ole_create_dcom':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:2615: undefined reference to `_IID_IDispatch'
win32ole.o: In function `fole_initialize':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:3248: undefined reference to `_IID_IDispatch'
win32ole.o: In function `load_conv_function51932':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:934: undefined reference to `_CLSID_CMultiLanguage'
win32ole.o: In function `fole_respond_to':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:4516: undefined reference to `_GUID_NULL'
win32ole.o: In function `ole_variant2val':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:2262: undefined reference to `_IID_IDispatch'
win32ole.o: In function `ole_invoke':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:3392: undefined reference to `_GUID_NULL'
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:3450: undefined reference to `_GUID_NULL'
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:3364: undefined reference to `_GUID_NULL'
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:3467: undefined reference to `_GUID_NULL'
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:3506: undefined reference to `_GUID_NULL'
win32ole.o:/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:3481: more undefined references to `_GUID_NULL' follow
win32ole.o: In function `fole_s_connect':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:2718: undefined reference to `_IID_IDispatch'
win32ole.o: In function `ole_bind_obj':
/home/Jack/ruby-1.9.2-p0/ext/win32ole/win32ole.c:2656: undefined reference to `_IID_IDispatch'
collect2: ld returned 1 exit status
make: *** [../../.ext/i386-cygwin/win32ole.so] Error 1

makefile通过gcc使用以下选项构建它:

  

gcc -shared -s -o ../../.ext/i386-cygwin/win32ole.so win32ole.o -L。 -二。 -Wl, - enable-auto-image-base, - enable-auto-import -lruby191 -ladvapi32 -lkernel32 -luser32 -luuid -loleaut32 -lole32 -lpthread -lrt -ldl -lcrypt

我不知道为什么会发生这种情况(可能是一个不可用的标头资源)但我实际上并不太关心这个扩展(我不认为我会使用它)所以我想知道如何禁用<{1}}阶段的 win32ole 扩展程序,只是跳过它。

我想有办法,但我不知道怎么做..

提前感谢!

3 个答案:

答案 0 :(得分:3)

执行./configure --help并注意选项

--with-exts=EXTS
--with-out-ext=EXTS

我有相同的设置,Win 7 x86_64与cygwin 1.7,并没有建立该扩展的问题。 gcc命令行与您的相同。我想,Microsoft文档提到了你可以检查的mlang.dll。

答案 1 :(得分:1)

我遇到了同样的事情。我不知道./configure选项。经过各种探索和测试后,我只是将win32ole目录移开了,这似乎有效。

答案 2 :(得分:1)

可以在不禁用扩展的情况下修复此问题。

此失败的原因是链接时间错误。它与系统路径上存在的DLLS无关 - 这在运行时会出现问题。安装cygwin 1.7.9-1之后我遇到了这个问题。安装cygwin / usr / lib后,包含库文件libuuid。*,它隐藏了/ usr / lib / w32api中具有相同名称的文件,这些链接存根与windows API DLLS接口。这些是ruby扩展代码的预期目标。发生这种情况要么是因为它们最近被添加到cygwin发行版中,要么是因为我选择的其中一个包包含这些文件。我通过更改LIBPATH = -L行来解决这个问题。 -L $(topdir)到LIBPATH = -L。运行configure后,在ruby源代码中的ext / w32ole下的Makefile中的-L $(topdir)-L / usr / lib / w32api,使链接器在运行configure后能够找到正确的库文件。

请注意,在第一次运行'make'之前,ext / w32ole / Makefile不可见。完成后,Makefile可见并可以调整。第二次运行'make'应该没有错误。