代码之家  ›  专栏  ›  技术社区  ›  Jack

禁用ruby扩展

  •  1
  • Jack  · 技术社区  · 14 年前

    我正试图用Cygwin从Win7 x64下的sctraches编译ruby 1.9.2-p0。。一切都很顺利,所有扩展都被编译,直到它到达win32ole ext,该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.-L../。。-五十、 -Wl,--启用自动映像库,--启用自动导入-lruby191-ladvapi32-lkernel32-luser32-luuid-loleaut32-lole32-lpthread-lrt-ldl-lcrypt

    我不知道为什么会发生这种情况(可能是头资源不可用),但实际上我不太关心这个扩展(我想我不会使用它),所以我想知道如何禁用 win32ole文件 从扩展 make 阶段,跳过它。

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

    提前谢谢!

    3 回复  |  直到 14 年前
        1
  •  3
  •   Ryan Calhoun    14 年前

    做一个 ./configure --help 并注意选项

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

    我有同样的设置,用cygwin 1.7赢了7x86u64,并且在构建扩展时没有问题。gcc命令行与您的命令行相同。微软文档提到了一个mlang.dll,我想你可以检查一下。

        2
  •  1
  •   Ryan Castillo Chris    13 年前

    我遇到了同样的事。我不知道./configure选项。经过各种各样的探索和测试,我刚刚把win32ole目录移到一边,这似乎是可行的。

        3
  •  1
  •   MathDSL Shane    13 年前

    这可以在不禁用扩展的情况下修复。

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

    请注意,在第一次运行“make”之前,ext/w32ole/Makefile是不可见的。一旦这样做,Makefile就可见并且可以调整。第二次运行“make”时应无错误。