Disable ruby extension
I'm trying to compile ruby 1.9.2-p0 from sctraches under Win7 x64 with Cygwin.. everything almost goes fine, all the extensions are compiled until it reaches the win32ole ext which fails with following errors:
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
the makefile 开发者_开发百科builds it through gcc with the following options:
gcc -shared -s -o ../../.ext/i386-cygwin/win32ole.so win32ole.o -L. -L../.. -L. -Wl,--enable-auto-image-base,--enable-auto-import -lruby191 -ladvapi32 -lkernel32 -luser32 -luuid -loleaut32 -lole32 -lpthread -lrt -ldl -lcrypt
I don't know why this is happening (probably a header resource that is unavailable) but I actually don't care too much about this extension (I don't think I will use it) so I wonder how to disable the win32ole extension from the make
phase and just skip it.
I suppose there's a way but I don't know how..
thanks in advance!
Do a ./configure --help
and note the options
--with-exts=EXTS
--with-out-ext=EXTS
I've got the same setup, Win 7 x86_64 with cygwin 1.7, and had no problems building that extension. The gcc command line is the same as yours. Microsoft docs mention a mlang.dll you could check for, I suppose.
I ran into the same thing. I didn't know about the ./configure options. After various exploration and testing I just moved the win32ole directory out of the way and that seemed to work.
This can be fixed without disabling the extention.
The reason this fails is due a link time error. It doesn't have to do with what DLLS are present on the system path - this would case a problem at run time. I ran into this after installing cygwin 1.7.9-1. After installing cygwin /usr/lib contained the library files libuuid.* which hide the files having the same name in /usr/lib/w32api, the link stubs which interface with the windows API DLLS. These are the intended target of the ruby extention code. This happened either because they were added to the cygwin distribution recently or becuase one of the packages I chose included these files. I worked around it by changing the line LIBPATH = -L. -L$(topdir) to LIBPATH = -L. -L$(topdir) -L/usr/lib/w32api in the Makefile under ext/w32ole in the ruby source code after running configure to enable the linker to find the correct library files after running configure.
Note that the ext/w32ole/Makefile is not visible until you run 'make' for the first time. Once you do, the Makefile is visible and can be adjusted. Running 'make' a second time should run without errors.
精彩评论