2017-09-23 80 views
0

我无法登录WINEHQ Bugzilla,所以我问这里,这是要求:
我们有一个Windows应用程序,我们有exe源代码,并使用ATL。 DLL的EXE依赖需要一些特殊的设备,但主要是他们有Linux版本。现在我们需要将windows应用程序移植到linux。
我最后尝试:写一个中间的dll来包装已经是跨平台的一些lib,这个exe会调用新的中间dll,并且我将中间的dll命名为“WINE custom build-in dll”。 CUSTOM意味着我编译这个dll.so是由酿酒师独立的。一切都很好,直到下wine64运行它,在Linux的shell命令行:酒不能加载我的自定义内置DLL和报告“调用未实现的功能”

wine64 portsome.exe 

这里是输出:

wine: Call from 0x7bc5eeec to unimplemented function wrapsome.dll.wrap_SOME_GetVersion, aborting 
Backtrace: 
=>0 0x000000007bc5eeec stub_entry_point+0x5c(dll=<is not available>, name=<is not available>, ret_addr=<is not available>) [/home/root0/src/wine/build/dlls/ntdll/../../../src/dlls/ntdll/loader.c:215] in ntdll (0x000000000023fbc0) 
    1 0x0000000140001022 in portsome (+0x1021) (0x000000000023fbc0) 
    2 0x00000001400012e2 in portsome (+0x12e1) (0x000000000023fd70) 
    3 0x000000007b47d02f start_process+0xbe(entry=0x140001418) 

Modules: 
Module Address         Debug info  Name (23 modules) 
ELF    7b400000-  7b81a000  Dwarf   kernel32<elf> 
    \-PE   7b420000-  7b81a000  \    kernel32 
ELF    7bc00000-  7bd21000  Dwarf   ntdll<elf> 
    \-PE   7bc20000-  7bd21000  \    ntdll 
ELF    7c000000-  7c004000  Deferred  <wine-loader> 
PE    140000000-  140007000  Export   portsome 
ELF   7fbfe53b4000- 7fbfe56c6000  Deferred  msvcr100<elf> 
    \-PE  7fbfe53e0000- 7fbfe56c6000  \    msvcr100 
ELF   7fbfe5b48000- 7fbfe5f1d000  Deferred  libhwaware.so 
ELF   7fbfe5f1d000- 7fbfe6131000  Deferred  wrapsome<elf> 
    \-PE  7fbfe5f20000- 7fbfe6131000  \    wrapsome 
ELF   7fbfe66bc000- 7fbfe68ce000  Deferred  libnss_files.so.2 
ELF   7fbfe68ce000- 7fbfe6ada000  Deferred  libnss_nis.so.2 
ELF   7fbfe6ada000- 7fbfe6cf3000  Deferred  libnsl.so.1 
ELF   7fbfe6cf3000- 7fbfe6efc000  Deferred  libnss_compat.so.2 
ELF   7fbfe70fc000- 7fbfe7312000  Deferred  libgcc_s.so.1 
ELF   7fbfe7312000- 7fbfe761b000  Deferred  libm.so.6 
ELF   7fbfe761e000- 7fbfe7822000  Deferred  libdl.so.2 
ELF   7fbfe7822000- 7fbfe7bec000  Deferred  libc.so.6 
ELF   7fbfe7bed000- 7fbfe7e0a000  Deferred  libpthread.so.0 
ELF   7fbfe7e22000- 7fbfe81c8000  Dwarf   libwine.so.1 
ELF   7fbfe81ca000- 7fbfe83f2000  Deferred  ld-linux-x86-64.so.2 
ELF   7ffd8bbe1000- 7ffd8bbe2000  Deferred  [vdso].so 

这里是我的问题:
我怎么编译酒自定义生成 - 在DLL中使Windows本机应用程序可以调用它的功能时运行,是否需要通过winebuilder生成一个虚假的DLL?

我工作端口Windows应用程序到Linux

详细步骤:
1.找到特殊的DLL这需要与硬件直接联系,如CUDA,加密狗接入。
2.打包dll,更改exe文件的代码来调用这个打包dll函数,然后打包dll然后调用硬件感知dll。
3.用https://wiki.winehq.org/Winelib_User%27s_Guide#The_Spec_file的要求创建“wrapsome.spec”文件。
4.拷贝涡卷代码到Ubuntu 16.04,切换到包裹代码源目录和在壳运行下面的命令:

winemaker --dll --nosource-fix -DWRAPSOME_EXPORTS -I../deps/hdaware -L../deps/hdaware -lhdaware . 

然后我得到了“生成文件”文件和我追加-fPIC到LDFLAGS。
5.继续运行“make”,是的,我得到了wrapsome.dll.so,我将它复制到wine build-in dll目录中。 6.最后我没有运行“wine64 portsome.exe”,上面提到了这个问题。
葡萄酒报告“未实现的功能wrapsome.dll.wrap_SOME_GetVersion”,我甚至证实nm wrapsome.dll.so,这里是它的输出:

0000000000213291 B __bss_start 
0000000000213298 b call_fini.9485 
0000000000213294 b completed.7585 
       w __cxa_finalize 
00000000000118b0 t deregister_tm_clones 
0000000000011a20 t DisableThreadLibraryCalls 
0000000000011bf0 t DllMain 
0000000000011940 t __do_global_dtors_aux 
0000000000212de8 t __do_global_dtors_aux_fini_array_entry 
0000000000213040 d __dso_handle 
0000000000212df8 d _DYNAMIC 
0000000000213291 D _edata 
00000000002132a0 B _end 
0000000000011c88 t _fini 
0000000000011980 t frame_dummy 
0000000000212de0 t __frame_dummy_init_array_entry 
0000000000011ec8 r __FRAME_END__ 
0000000000213000 d _GLOBAL_OFFSET_TABLE_ 
       w __gmon_start__ 
0000000000011cb8 r __GNU_EH_FRAME_HDR 
0000000000000810 t _init 
       w _ITM_deregisterTMCloneTable 
       w _ITM_registerTMCloneTable 
0000000000212df0 d __JCR_END__ 
0000000000212df0 d __JCR_LIST__ 
       w _Jv_RegisterClasses 
00000000000118f0 t register_tm_clones 
       U SOME_GetVersion 
       U SOME_InitAwareSDK 
       U SOME_UninitAwareSDK 
0000000000213298 d __TMC_END__ 
       U [email protected]@WINE_1.0 
       U [email protected]@WINE_1.0 
       U [email protected]@WINE_1.0 
0000000000011ad0 t __wine_spec_dll_entry 
0000000000011c94 r __wine_spec_file_name 
0000000000011a20 t __wine_spec_import_thunks 
0000000000011c20 t __wine_spec_init 
0000000000011c40 t __wine_spec_init_ctor 
000000000021329c b __wine_spec_init_state 
0000000000213048 d __wine_spec_nt_header 
000000000000082a t __wine_spec_pe_header 
00000000000119b0 t __wine_spec_relay_entry_points 
0000000000011ab9 T wrap_SOME_GetVersion 
0000000000011a3c T wrap_SOME_InitAwareSDK 
0000000000011a53 T wrap_SOME_UninitAwareSDK 
0000000000011a26 T _Z7DllMainP11HINSTANCE__jPv 

声明:我已拒绝与常见的一些字,因为它是不好的展示对公众。

我甚至看葡萄酒的源代码在github上https://github.com/wine-mirror/wine/blob/fdac39f697e049ead215b164bfe6953269ffa7be/dlls/ntdll/loader.c#L660,似乎
exports = RtlImageDirectoryEntryToData(imp_mod, TRUE, IMAGE_DIRECTORY_ENTRY_EXPORT, &exp_size); 不能导出我的酿酒师+ winegcc工具链编译warpsome.dll.so文件符号表。

回答

0

我改变了wrapsome.spec文件,此内容:

@ stdcall wrap_SOME_InitAwareSDK(ptr) wrap_SOME_InitAwareSDK 
@ stdcall wrap_SOME_UninitAwareSDK(ptr) wrap_SOME_UninitAwareSDK 
@ stdcall wrap_SOME_GetVersion() wrap_SOME_GetVersion 

并再次,然后CP到酒的dll目录,它的作品!而且我知道没有必要在Windows中将exe链接改为warp dll,只需构建一个dll.so,并提取exe所需的相同导出名称即可。我会在稍后尝试。

+0

我试过了,只记得使用小写的文件名,即使它在Windows中也是大写。 – Haffon