2013-05-10 63 views
1

由於未解析的外部結構,使用默認的-arch:SSE編譯器標誌進行構建時,Ruby 1.9.1無法使用Visual Studio 2012(update1和2)進行構建。Visual Studio 2012爲xmm生成未解析的外部結構

cl -nologo -LD main.obj dmyext.obj msvcr110-ruby191-static.lib msvcr110-ruby191.res unicows.lib oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib -Femsvcr110-ruby191.dll -link -incremental:no -debug -opt:ref -opt:icf -implib:dummy.lib -def:msvcr110-ruby191.def -MAP:map-out.txt 
Creating library dummy.lib and object dummy.exp 
dummy.exp : error LNK2001: unresolved external symbol [email protected] 
dummy.exp : error LNK2001: unresolved external symbol [email protected] 
msvcr110-ruby191.dll : fatal error LNK1120: 2 unresolved externals 

打開模塊定義文件,下面的寄存器數據項出現在出口部分:前面有兩個下劃線不會引起問題

[email protected] DATA 
[email protected] DATA 
[email protected] DATA 
[email protected] DATA 

前兩個項目,但最後兩個項目前面有一個下劃線負責未解決的外部事件。手動修改def文件以便它們都有兩個下劃線似乎可以解決這個問題,但我不確定這是否隱藏了問題或解決了問題。

另一種選擇是使用鏈接器標誌-force:unresolved構建,但如果實際需要未解析的外部件,則這會很危險。

解決此問題的第三個選項是使用-arch:IA32選項進行編譯,該選項不會生成SSE指令。不過,這個ruby dll也是爲x64平臺而構建的,似乎沒有辦法使用替代選項選項成功構建x64。

我的問題是:

是正常/預期XMM寄存器數據出現在模塊定義文件導出?

有沒有關於如何解決這個Win32和x64平臺的任何想法?

回答

1

現在解決了這個問題。

事實證明,有一個名爲mkexports.rb產生的msvcr110-ruby191.lib出口Ruby腳本。

在函數each_export中,有一行代碼排除基於8-16個十六進制數字的數據項,這些數據項已成功排除__real數據。

next if /(?!^)@.*@/ =~ l || /@[[:xdigit:]]{8,16}$/ =~ l || /^[email protected]/ =~ l 

修正代碼exlude根據8項 - 32位十六進制數字,它現在排除__xmm數據,太。

next if /(?!^)@.*@/ =~ l || /@[[:xdigit:]]{8,32}$/ =~ l || /^[email protected]/ =~ l 
相關問題