Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I compile Programmer Dvorak?

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
like image 862
Senseful Avatar asked Jul 29 '10 08:07

Senseful


2 Answers

AMD64? I think that is the issue there.

Perhaps the problem is just a matter of you using BOTH the files for 32 or 64 ISA at the same time.

Like:

kbddvp32.dll kbddvp64.dll

Try using the ones for your platform ISA and take out the rest.

like image 172
Rui Avatar answered Oct 15 '22 08:10

Rui


MSDN links: http://msdn.microsoft.com/en-us/library/ms235500(VS.80).aspx -- LNK4254 http://msdn.microsoft.com/en-us/library/708by912(VS.71).aspx -- LNK4210

Note: LNK4210 can be caused by -NOENTRY but only your code can tell is using it is right or wrong LNK4254 is most probalby a "poltical" warning (a section declared as "read only" in a new version of some lib)

And I assume that you are running 2 completely clean and separated builds for x86 and x64. If not, you have to do that no matter what and do it first. So called mixed builds result in all kids of random-looking failures and there's noting to fix there - just have to build separately.

like image 1
ZXX Avatar answered Oct 15 '22 07:10

ZXX