2010-11-16 75 views
1

我想從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 -o -s ../../.ext/i386-cygwin/win32ole.so win32ole.o - L. -二。輪候冊, - 啓用 - 自動圖像基地, - 使能自動導入-lruby191 -ladvapi32 -lkernel32 -luser32 -luuid -loleaut32 -lole32 -lpthread -lrt -ldl -lcrypt

我不不知道爲什麼會發生這種情況(可能是頭文件資源不可用),但我其實並不在乎這個擴展(我不認爲我會使用它),所以我想知道如何禁用擴展名爲的win32olemake階段,只需跳過它。

我想有一種方式,但我不知道如何..

在此先感謝!

回答

3

做一個./configure --help並注意選項

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

我有相同的設置,Win 7的x86_64的使用Cygwin 1.7,有沒有問題,建設一個延伸。 gcc命令行與你的一樣。微軟文檔提到了一個你可以檢查的mlang.dll,我想。

+1

所以它應該只是'--with-out-ext = win32ole'?因爲我搜索文件的擴展名列表,但無法找到它 – Jack 2010-11-16 17:37:51

+0

在這種情況下,它應該足以將mlang.dll內cygwin斌文件夾或system32我想..(剛剛檢查,我已經在system32中有這個dll,我真的不明白爲什麼會發生這種情況) – Jack 2010-11-16 17:41:41

+0

任何文件中都沒有擴展名列表,只是ext目錄的內容。您可以查看ext/extmk.rb,瞭解如何處理這些參數,如果您好奇的話。 – 2010-11-16 17:43:24

1

我遇到了同樣的事情。我不知道./configure選項。經過各種探索和測試之後,我只是將win32ole目錄移開了,這似乎奏效了。

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'應該運行沒有錯誤。

+0

此外,可以通過 'export LIBRARY_PATH =/usr/lib/w32api:$ LIBRARY_PATH'修復此問題(此處可找到解決方案 http://wiki.livedoor.jp/kou1okada/d/Cygwin%20-%20ruby- 1.8.7-P371) – 2013-07-12 10:36:58