我怎么可以编译程序员德沃夏克? [英] How can I compile Programmer Dvorak?

查看:143
本文介绍了我怎么可以编译程序员德沃夏克?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译开源项目程序员德沃夏克。问题是,这是一个有点老不符合的构建工具的当前版本构建。

您可以看到完整的源代码code。与修改我在网上进行项目的谷歌code页修订2 是从原始项目未修改的源文件。 修订3 是哪里我把所有的显著变化。你可以在这里看到两个修订差异>。

这是剩下的唯一显而易见的问题是一些LINK警告:


  • LNK4254 (如节 .edata(40000040)合并成'。数据(C0000040)具有不同的属性) - 我问的问题<一的单机版href=\"http://stackoverflow.com/questions/3383675/how-can-i-resolve-lnk4254-warnings-in-link-exe\">here.

  • LNK4210 (如 .CRT部分存在,可能还有未处理的静态初始化或终结

如何解决这些警告? <罢>我可以不理会他们?

尽管有这些警告,但它仍然会产生一个exe。如果我继续和运行它,虽然,它不能正确安装,我需要求助于系统,以重新安装正式版本恢复。

这可能是因为警告或者仅仅是因为我没有正确地修改项目。

还有什么我需要做的,使这个项目的安装?


的构建过程(和我修改的解释):

它说,你需要使用Windows DDK,但它似乎像<一个href=\"http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=36a2630f-5d56-43b5-b996-7633f2ec14ff\">Windows 已经取代了它的驱动程序包,让我得到了来代替。我只安装了构建环境。

1。据<一个href=\"http://$c$c.google.com/p/ergo-dvorak-for-developers/source/browse/trunk/README.txt\"><$c$c>Readme.txt,你应该运行:

 建设布局和放大器;&安培;建立安装程序

2。 <一href=\"http://$c$c.google.com/p/ergo-dvorak-for-developers/source/browse/trunk/build-layout.bat\"><$c$c>build-layout.bat运行。

我不得不修改这个文件(<一个href=\"http://$c$c.google.com/p/ergo-dvorak-for-developers/source/diff?spec=svn5&r=3&format=side&path=/trunk/build-layout.bat&old_path=/trunk/build-layout.bat&old=2\">see这里的差异):


  • WINDDK 路径修改,因为我有一个新的版本(MOD-1)

  • 设置PATH = ... WINDDK%%\\ BIN \\ 86 \\ 86; 是自<$添加C $ C> LINK.EXE 位于有(MOD-2)

  • 将纳入= %WINDDK%\\ INC \\ WXP 改为 %WINDDK%\\ INC \\ API ,因为 WXP 文件夹不存在,和我最好的猜测是, API需要文件夹,因为它包含 kbd.h ,其中<一个href=\"http://$c$c.google.com/p/ergo-dvorak-for-developers/source/browse/trunk/kbddvp.c\"><$c$c>kbddvp.c使用(MOD-3)

  • 对于设置LIB = %WINDDK%\\ LIB \\ CRT 修改为 WINDDK%%\\ LIB \\ CRT \\ I386 ,使 LIBCMT.LIB 可寻。见MOD-7的下面。 (MOD-4)

3。 <一href=\"http://$c$c.google.com/p/ergo-dvorak-for-developers/source/browse/trunk/kbddvp.mak\"><$c$c>fkbddvp.mak运行。

我不得不修改这个文件(<一个href=\"http://$c$c.google.com/p/ergo-dvorak-for-developers/source/diff?spec=svn6&old=2&r=6&format=side&path=/trunk/kbddvp.mak#\">see这里的差异):


  • 的变量 CL32 的路径是从 $(WINDDK)\\ BIN改变\\ 86 \\ cl.exe时 $(WINDDK)\\ BIN \\ 86 \\ 86 \\ cl.exe时,第一个.exe文件不存在,我相信这是我应该的。exe使用来代替。 (MOD-5)

  • 的变量 CL64 $(WINDDK)\\ BIN \\ Win64的改变路径\\ 86 \\ AMD64 \\ cl.exe时 $(WINDDK)\\ BIN \\ 86 \\ AMD64 \\ cl.exe时,这是我最好的猜测在何处丢失的.exe文件。 (MOD-6)

  • -opt:NOWIN98 删除共进晚餐preSS警告的 LNK4224 (即 / OPT:NOWIN98不再支持),如<一个href=\"http://stackoverflow.com/questions/3360746/how-can-i-compile-programmer-dvorak#comment-3552068\">suggested由鲍比。 (MOD-10)

  • 而不是使用的不存在的 LIBC.LIB ,我使用 LIBCMT.LIB 。我读<一个href=\"http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/45a46d37-5e20-4e1a-87e7-9f9f65986f6a/\">this帖子其中建议使用此文件来代替。 (MOD-7)

  • 而不是使用过时的工具 CABARC ,我使用找到MakeCab 与<一的href=\"http://$c$c.google.com/p/ergo-dvorak-for-developers/source/browse/trunk/makecab-dir.ddf\"><$c$c>makecab-dir.ddf.我把<一个href=\"http://stackoverflow.com/questions/3375908/how-do-i-convert-a-multi-file-cabarc-command-to-a-corresponding-makecab-command\">my最好的猜测对如何使用这一新工具执行相同的逻辑。 (MOD-8)

4。 <一href=\"http://$c$c.google.com/p/ergo-dvorak-for-developers/source/browse/trunk/build-installer.bat\"><$c$c>build-installer.bat运行。

我不得不修改这个文件(<一个href=\"http://$c$c.google.com/p/ergo-dvorak-for-developers/source/diff?spec=svn5&r=3&format=side&path=/trunk/build-installer.bat&old_path=/trunk/build-installer.bat&old=2\">see这里的差异):


  • 这还使用 CABARC ,我修改了它使用 makcab ,类似MOD-8,除了这里创建.ddf文件programmaticaly。 (MOD-9)


的完整输出

下面是完整的输出,如果你想看到它:

 &GT;建设布局和放大器;&安培;建立安装程序
        C:\\ WINDDK \\ 7600.16385.1 \\ BIN \\ 86 \\ 86 \\ cl.exe时-nologo -c -I .. \\ INC -Zp8 -Gy
 -W3 -wx -Gz -Gm- -EHs-C- -GR- -gf -zl -Oxs -D_WIN32_WINNT = 0x0501 -Fokbddvp32.o
BJ kbddvp.c
kbddvp.c
        RC kbddvp.rc
微软(R)的Windows(R)资源编译器版本6.1.6908.0
版权所有(C)微软公司。版权所有。        链接-machine:IX86 -nologo -dll -base:0x5FFF0000 -subsystem:本地-def:
kbddvp.def -noentry -merge:.edata =。数据-merge:.rdata =。数据-merge:的.text =。数据
-merge:.bss中。数据= -ignore:4078,4070 -section:.data和重新-stack:0x40000,0x1000 -op
T:REF,ICF -release退房手续:kbddvp32.dll kbddvp32.obj kbddvp.res
   创建库kbddvp32.lib和对象kbddvp32.exp
LINK:警告LNK4254:节.edata(40000040)合并成'。数据(C000004
0)具有不同属性的
LINK:警告LNK4254:节.rdata(40000040)合并成'。数据(C000004
0)具有不同属性的
LINK:警告LNK4254:节的.text(60000020)合并成'。数据(C0000040
)具有不同属性的
LINK:警告LNK4254:节的.bss'(C0000080)合并成'。数据(C0000040)
 具有不同属性的
        C:\\ WINDDK \\ 7600.16385.1 \\ BIN \\ 86 \\ AMD64 \\ cl.exe时-nologo -c -I .. \\ INC -Zp8 -
戈瑞-W3 -wx -Gz -Gm- -EHs-C- -GR- -gf -zl -Oxs -DBUILD_WOW6432 -D_WIN32_WINNT = 0X
0501 -Fokbddvp64.obj kbddvp.c
kbddvp.c
        链接-machine:AMD64 -nologo -dll -base:0x5FFE0000 -subsystem:本地-def
:kbddvp.def -noentry -merge:.edata =。数据-merge:.rdata =。数据-merge:的.text =。数据
 -merge:.bss中。数据= -ignore:4078,4070 -section:.data和重新-stack:0x40000,0x1000 -o
PT:REF,ICF -release退房手续:kbddvp64.dll kbddvp64.obj kbddvp.res
   创建库kbddvp64.lib和对象kbddvp64.exp
LINK:警告LNK4254:节.edata(40000040)合并成'。数据(C000004
0)具有不同属性的
LINK:警告LNK4254:节.rdata(40000040)合并成'。数据(C000004
0)具有不同属性的
LINK:警告LNK4254:节的.text(60000020)合并成'。数据(C0000040
)具有不同属性的
LINK:警告LNK4254:节的.bss'(C0000080)合并成'。数据(C0000040)
 具有不同属性的
        C:\\ WINDDK \\ 7600.16385.1 \\ BIN \\ 86 \\ 86 \\ cl.exe时-nologo -c -Folauncher.obj升
auncher.c
launcher.c
        链接-machine:IX86 -nologo -subsystem:窗户-release -nodefaultlib -ou
T:LAUNCHER.EXE launcher.obj KERNEL32.LIB LIBCMT.LIB USER32.LIB SHELL32.LIB
LIBCMT.LIB(cpu_disp.obj):警告LNK4210:.CRT部分存在;有可能未
处理静态初始化或终结
        找到MakeCab /˚F找到MakeCab-dir.ddf
微软(R)橱柜制造商 - 版本5.1.2600.5512
版权所有(c)Microsoft公司。版权所有..在4个文件27686个字节
文件总数:4
字节之前:27686
字节后:8,140
后/前:29.40%的COM pression
时间:0.19秒(0小时0分0.19秒)
吞吐量:144.58 KB /秒
        IEX preSS / N / Q / M kbddvp.sed
        1文件(S)复制。
微软(R)橱柜制造商 - 版本5.1.2600.5512
版权所有(c)Microsoft公司。版权所有..在16个文件60290个字节
文件总数:16
字节之前:60290
之后的字节数:16876
后/前:27.99%的COM pression
时间:0.27秒(0小时0分0.27秒)
吞吐量:221.34 KB /秒


解决方案

启动是一个程序开始升高安装的.inf文件,
禁止重定向使真正的的%SystemRoot%目录揭晓
到32位进程,即使它在WOW64正在运行。

从它使用C运行时唯一的程序是 ZeroMemory ,这是
宏扩展到 _memset 。在早期版本中,没有出现问题
在这一个常规静态链接,忽略了运行时初始化。
也许是在以后的版本中,这会触发LNK4210警告。

您可以使用此功能替换为 ZeroMemory 来电:

 无效ZEROFILL(IN VOID UNALIGNED * PTR,IN SIZE_T LEN){
    字符* DST;
    对于(DST =(字符*)PTR; LEN大于0; len--,DST ++){
        * DST = 0;
    }
}

和删除提及的libc / libcmt 与目录%WINDDK%\\ LIB \\ CRT \\ I386

还要注意的是,如果你以管理员身份从上下文菜单中安装
在资源管理器中的 kbddvp.inf 文件,你应该能够做到设置
没有启动程序,从而消除这一阶段的任何错误。它
只有present更容易再分配,而不是至关重要的。

I'm trying to compile the open source project Programmer Dvorak. The problem is that it's a bit old and doesn't build with the current versions of the build tools.

You can see the full source code with modifications I made online at my project's Google Code page. Revision 2 is the unmodified source files from the original project. Revision 3 is where I made all the significant changes. You can see a diff between the two revisions here.

The only obvious problems that are left are a few LINK warnings:

  • LNK4254 (e.g. section '.edata' (40000040) merged into '.data' (C0000040) with different attributes.) -- I asked a stand-alone version of the question here.
  • LNK4210 (e.g. .CRT section exists; there may be unhandled static initializers or terminators)

How do I fix these warnings? Can I ignore them?

Despite these warnings, it still produces an exe. If I go ahead and run it, though, it doesn't get installed correctly and I need to resort to a system restore in order to install the official version again.

This might be because of the warnings or simply because I didn't modify the project correctly.

What else do I need to do to make this project installable?


The build process (and an explanation of my modifications):

It says that you need the Windows DDK, but it seems like the Windows Driver Kit has replaced it, so I got that instead. I only installed the "Build Environments".

1. According to Readme.txt, you are supposed to run:

build-layout && build-installer

2. build-layout.bat is run.

I had to modify this file (see the diff here):

  • WinDDK path was modified since I have a newer version (MOD-1).
  • set PATH= ... %WINDDK%\bin\x86\x86; was added since link.exe is located there (MOD-2).
  • In set INCLUDE=, %WINDDK%\inc\wxp was changed to %WINDDK%\inc\api, because the wxp folder does not exist, and my best guess is that the api folder was needed since it contains kbd.h, which kbddvp.c uses (MOD-3).
  • For set LIB=, %WINDDK%\lib\crt was modified to %WINDDK%\lib\crt\i386, so that libcmt.lib could be found. See MOD-7 below. (MOD-4)

3. fkbddvp.mak is run.

I had to modify this file (see the diff here):

  • The path for the variable CL32 was changed from $(WINDDK)\bin\x86\cl.exe to $(WINDDK)\bin\x86\x86\cl.exe, the first .exe doesn't exist, I believe this is the .exe I'm supposed to use instead. (MOD-5)
  • The path for the variable CL64 was changed from $(WINDDK)\bin\win64\x86\amd64\cl.exe to $(WINDDK)\bin\x86\amd64\cl.exe, this is my best guess as to where the missing .exe is. (MOD-6)
  • -opt:nowin98 removed to suppress warning LNK4224 (i.e. /OPT:NOWIN98 is no longer supported), as suggested by Bobby. (MOD-10)
  • Instead of using the non-existent libc.lib, I'm using libcmt.lib. I read this post which recommends using this file instead. (MOD-7)
  • Instead of using the obsolete utility cabarc, I'm using makecab with makecab-dir.ddf. I took my best guess as to how to execute the same logic with this new utility. (MOD-8)

4. build-installer.bat is run.

I had to modify this file (see the diff here):

  • This was also using cabarc and I modified it to use makcab, similar to MOD-8, except that here it creates the .ddf file programmaticaly. (MOD-9)

The complete output

Here's the complete output, if you want to see it:

>build-layout && build-installer
        "C:\WinDDK\7600.16385.1\bin\x86\x86\cl.exe" -nologo -c -I..\inc -Zp8 -Gy
 -W3 -WX -Gz -Gm- -EHs-c- -GR- -GF -Zl -Oxs  -D_WIN32_WINNT=0x0501 -Fokbddvp32.o
bj kbddvp.c
kbddvp.c
        rc kbddvp.rc
Microsoft (R) Windows (R) Resource Compiler Version 6.1.6908.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        link -machine:ix86 -nologo -dll -base:0x5FFF0000 -subsystem:native -def:
kbddvp.def -noentry  -merge:.edata=.data -merge:.rdata=.data -merge:.text=.data
-merge:.bss=.data  -ignore:4078,4070 -section:.data,re -stack:0x40000,0x1000 -op
t:ref,icf  -release -out:kbddvp32.dll kbddvp32.obj kbddvp.res
   Creating library kbddvp32.lib and object kbddvp32.exp
LINK : warning LNK4254: section '.edata' (40000040) merged into '.data' (C000004
0) with different attributes
LINK : warning LNK4254: section '.rdata' (40000040) merged into '.data' (C000004
0) with different attributes
LINK : warning LNK4254: section '.text' (60000020) merged into '.data' (C0000040
) with different attributes
LINK : warning LNK4254: section '.bss' (C0000080) merged into '.data' (C0000040)
 with different attributes
        "C:\WinDDK\7600.16385.1\bin\x86\amd64\cl.exe" -nologo -c -I..\inc -Zp8 -
Gy -W3 -WX -Gz -Gm- -EHs-c- -GR- -GF -Zl -Oxs  -DBUILD_WOW6432 -D_WIN32_WINNT=0x
0501 -Fokbddvp64.obj kbddvp.c
kbddvp.c
        link -machine:amd64 -nologo -dll -base:0x5FFE0000 -subsystem:native -def
:kbddvp.def -noentry  -merge:.edata=.data -merge:.rdata=.data -merge:.text=.data
 -merge:.bss=.data  -ignore:4078,4070 -section:.data,re -stack:0x40000,0x1000 -o
pt:ref,icf  -release -out:kbddvp64.dll kbddvp64.obj kbddvp.res
   Creating library kbddvp64.lib and object kbddvp64.exp
LINK : warning LNK4254: section '.edata' (40000040) merged into '.data' (C000004
0) with different attributes
LINK : warning LNK4254: section '.rdata' (40000040) merged into '.data' (C000004
0) with different attributes
LINK : warning LNK4254: section '.text' (60000020) merged into '.data' (C0000040
) with different attributes
LINK : warning LNK4254: section '.bss' (C0000080) merged into '.data' (C0000040)
 with different attributes
        "C:\WinDDK\7600.16385.1\bin\x86\x86\cl.exe" -nologo -c -Folauncher.obj l
auncher.c
launcher.c
        link -machine:ix86 -nologo -subsystem:windows -release -nodefaultlib -ou
t:launcher.exe  launcher.obj kernel32.lib libcmt.lib user32.lib shell32.lib
libcmt.lib(cpu_disp.obj) : warning LNK4210: .CRT section exists; there may be un
handled static initializers or terminators
        makecab /F makecab-dir.ddf
Microsoft (R) Cabinet Maker - Version 5.1.2600.5512
Copyright (c) Microsoft Corporation. All rights reserved..

27,686 bytes in 4 files
Total files:              4
Bytes before:        27,686
Bytes after:          8,140
After/Before:            29.40% compression
Time:                     0.19 seconds ( 0 hr  0 min  0.19 sec)
Throughput:             144.58 Kb/second
        iexpress /N /Q /M kbddvp.sed
        1 file(s) copied.
Microsoft (R) Cabinet Maker - Version 5.1.2600.5512
Copyright (c) Microsoft Corporation. All rights reserved..

60,290 bytes in 16 files
Total files:             16
Bytes before:        60,290
Bytes after:         16,876
After/Before:            27.99% compression
Time:                     0.27 seconds ( 0 hr  0 min  0.27 sec)
Throughput:             221.34 Kb/second

解决方案

launcher is a program to start an elevated installation of the .inf file, disabling redirection so that the true %SystemRoot% directory is revealed to a 32-bit process even if it is running in Wow64.

The only routine from the C runtime which it uses is ZeroMemory, which is a macro expanding to _memset. In earlier versions, there was no problems in linking this one routine statically, ignoring the runtime initialization. Perhaps it is in later versions, which triggers the LNK4210 warning.

You can replace the calls to ZeroMemory with this function:

void ZeroFill(IN VOID UNALIGNED *ptr, IN SIZE_T len) {
    char *dst;
    for( dst = (char*) ptr; len > 0; len--, dst++) {
        *dst = 0;
    }
}

and remove the reference to libc/libcmt and the directory %WINDDK%\lib\crt\i386.

Note also that if you as an Administrator choose Install from the context-menu in Explorer for the kbddvp.inf file, you should be able to do the setup without the launcher program, thus eliminating any errors from that stage. It is only present for easier redistribution and is not vital.

这篇关于我怎么可以编译程序员德沃夏克?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆