I'm trying to compile the open source project [Programmer Dvorak][1]. 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][2]. [Revision 2][3] is the unmodified source files from the original project. [Revision 3][4] is where I made all the significant changes. You can see a [diff between the two revisions here][5].
The only obvious problems that are left are a few LINK warnings:
- [LNK4254][6] (e.g. `section '.edata' (40000040) merged into '.data' (C0000040) with different attributes.`) -- I asked a stand-alone version of the question [here][7].
- [LNK4210][8] (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][9] has replaced it, so I got that instead. I only installed the "Build Environments".
### 1. According to [`Readme.txt`][10], you are supposed to run:
build-layout && build-installer
### 2. [`build-layout.bat`][11] is run.
I had to modify this file ([see the diff here][12]):
- `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`][13] 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`][14] is run.
I had to modify this file ([see the diff here][15]):
- 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][16] (i.e. `/OPT:NOWIN98 is no longer supported`), as [suggested by Bobby][17]. (MOD-10)
- Instead of using the non-existent `libc.lib`, I'm using `libcmt.lib`. I read [this post][18] which recommends using this file instead. (MOD-7)
- Instead of using the obsolete utility `cabarc`, I'm using `makecab` with [`makecab-dir.ddf`][19]. I took [my best guess][20] as to how to execute the same logic with this new utility. (MOD-8)
### 4. [`build-installer.bat`][21] is run.
I had to modify this file ([see the diff here][22]):
- 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
[1]: http://www.kaufmann.no/roland/dvorak/
[2]: http://code.google.com/p/ergo-dvorak-for-developers/
[3]: http://code.google.com/p/ergo-dvorak-for-developers/source/browse/?r=2#svn/trunk
[4]: http://code.google.com/p/ergo-dvorak-for-developers/source/browse/?r=3#svn/trunk
[5]: http://code.google.com/p/ergo-dvorak-for-developers/source/detail?r=3
[6]: http://msdn.microsoft.com/en-us/library/ms235500(VS.80).aspx
[7]: https://stackoverflow.com/questions/3383675/how-can-i-resolve-lnk4254-warnings-in-link-exe
[8]: http://msdn.microsoft.com/en-us/library/708by912(VS.71).aspx
[9]: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=36a2630f-5d56-43b5-b996-7633f2ec14ff
[10]: http://code.google.com/p/ergo-dvorak-for-developers/source/browse/trunk/README.txt
[11]: http://code.google.com/p/ergo-dvorak-for-developers/source/browse/trunk/build-layout.bat
[12]: http://code.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
[13]: http://code.google.com/p/ergo-dvorak-for-developers/source/browse/trunk/kbddvp.c
[14]: http://code.google.com/p/ergo-dvorak-for-developers/source/browse/trunk/kbddvp.mak
[15]: http://code.google.com/p/ergo-dvorak-for-developers/source/diff?spec=svn6&old=2&r=6&format=side&path=/trunk/kbddvp.mak#
[16]: http://msdn.microsoft.com/en-us/library/w7ys78k4.aspx
[17]: https://stackoverflow.com/questions/3360746/how-can-i-compile-programmer-dvorak#comment-3552068
[18]: http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/45a46d37-5e20-4e1a-87e7-9f9f65986f6a/
[19]: http://code.google.com/p/ergo-dvorak-for-developers/source/browse/trunk/makecab-dir.ddf
[20]: https://stackoverflow.com/questions/3375908/how-do-i-convert-a-multi-file-cabarc-command-to-a-corresponding-makecab-command
[21]: http://code.google.com/p/ergo-dvorak-for-developers/source/browse/trunk/build-installer.bat
[22]: http://code.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 You can safely remove the nowin98-flag from the script. This has become the default behavior of 2008+ compilers.
以上就是How can I compile Programmer Dvorak?的详细内容,更多请关注web前端其它相关文章!