c - 如何编译程序员德沃夏克?

标签 c open-source linker driver wdk

我正在尝试编译开源项目 Programmer Dvorak .问题是它有点旧,并且不能使用当前版本的构建工具进行构建。
您可以在我的 project's Google Code page 上查看我在网上所做修改的完整源代码。 . Revision 2是原始项目中未修改的源文件。 Revision 3是我进行所有重大更改的地方。你可以看到一个 diff between the two revisions here .
剩下的唯一明显问题是一些 LINK 警告:

  • LNK4254 (例如 section '.edata' (40000040) merged into '.data' (C0000040) with different attributes. )——我问了一个独立版本的问题 here .
  • LNK4210 (例如 .CRT section exists; there may be unhandled static initializers or terminators)

  • 如何修复这些警告?我可以忽略它们吗?
    尽管有这些警告,它仍然会生成一个 exe。但是,如果我继续运行它,它不会正确安装,我需要求助于系统还原才能再次安装正式版本。
    这可能是因为警告,或者仅仅是因为我没有正确修改项目。
    我还需要做什么才能使该项目可安装?

    构建过程(以及对我的修改的解释):
    它说您需要 Windows DDK,但似乎是 Windows Driver Kit已经取代了它,所以我得到了它。我只安装了“构建环境”。
    1.根据 Readme.txt ,你应该运行:
    build-layout && build-installer
    
    2. build-layout.bat 正在运行。
    我不得不修改这个文件( see the diff here ):
  • WinDDK路径被修改,因为我有一个更新的版本(MOD-1)。
  • set PATH= ... %WINDDK%\bin\x86\x86;添加自 link.exe位于那里 (MOD-2)。
  • set INCLUDE= , %WINDDK%\inc\wxp改为 %WINDDK%\inc\api ,因为 wxp文件夹不存在,我最好的猜测是 api需要文件夹,因为它包含 kbd.h , 其中 kbddvp.c 使用(MOD-3)。
  • 对于 set LIB= , %WINDDK%\lib\crt修改为 %WINDDK%\lib\crt\i386 ,所以 libcmt.lib可以找到。请参阅下面的 MOD-7。 (MOD-4)

  • 3. fkbddvp.mak 正在运行。
    我不得不修改这个文件( see the diff here ):
  • 变量 CL32 的路径原为 $(WINDDK)\bin\x86\cl.exe$(WINDDK)\bin\x86\x86\cl.exe ,第一个 .exe 不存在,我相信这是我应该使用的 .exe。 (MOD-5)
  • 变量 CL64 的路径原为 $(WINDDK)\bin\win64\x86\amd64\cl.exe$(WINDDK)\bin\x86\amd64\cl.exe ,这是我对丢失的 .exe 位置的最佳猜测。 (MOD-6)
  • -opt:nowin98删除以抑制警告 LNK4224 (即 /OPT:NOWIN98 is no longer supported ),如 suggested by Bobby . (MOD-10)
  • 而不是使用不存在的 libc.lib ,我正在使用 libcmt.lib .我读了 this post建议改用此文件。 (MOD-7)
  • 而不是使用过时的实用程序 cabarc ,我正在使用 makecab makecab-dir.ddf .我拿了 my best guess关于如何使用这个新实用程序执行相同的逻辑。 (MOD-8)

  • 4. build-installer.bat 正在运行。
    我不得不修改这个文件( see the diff here ):
  • 这也是使用 cabarc我修改它以使用 makcab ,类似于 MOD-8,不同之处在于它以编程方式创建 .ddf 文件。 (MOD-9)

  • 完整的输出
    这是完整的输出,如果您想查看它:
    >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
    

    最佳答案

    AMD64?我认为这就是问题所在。

    也许问题只是您同时使用 32 或 64 ISA 的文件的问题。

    喜欢:

    kbddvp32.dll
    kbddvp64.dll

    尝试将那些用于您的平台 ISA 并取出其余的。

    关于c - 如何编译程序员德沃夏克?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3360746/

    相关文章:

    makefile - 为什么 "make"在 "make install"之前

    c++ - OSX 10.8.2 上的 Poco C++ 库 : Undefined symbols for architecture x86_64

    c 代码不适用于带有 float 的 Turbo C++

    java - 类似于 Rational Software Architect 的开源产品

    javascript - "look but don'的OSS许可证不能用它来与我们竞争”?

    c++ - 为什么在头文件中定义为静态的 C++ 方法没有显示在符号表中

    c++ 并链接到 lapack

    c++ - 我正在尝试使用函数 _snwprintf

    c - C程序中变量的值不变

    c++ - 删除有两个 child 的目标