在 Windows 中构建 Rakudo 时的警告

Warnings while building Rakudo in Windows

我按照说明构建 Rakudo . With similar reading here and here,我尝试在 Windows 中使用 VS-2019 构建它。

但是,在 windows 中构建 Rakudo 时,我收到以下构建警告:

Updating submodules .................................... OK
Configuring native build environment ................... 
    trying to compile a simple C program ............... YES
did not find libzstd; will not use heap snapshot format version 3
OK
...
src\io\syncfile.c(272): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size
src\io\syncfile.c(334): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size
...
src\io\signals.c(115): warning C4068: unknown pragma
src\io\signals.c(116): warning C4068: unknown pragma
src\io\signals.c(120): warning C4068: unknown pragma
...
src\platform\random.c(132): warning C4113: 'FARPROC' differs in parameter lists from 'CRYPTGENRANDOM'
src\platform\random.c(132): warning C4133: '=': incompatible types - from 'FARPROC' to 'CRYPTGENRANDOM'
src\platform\random.c(130): warning C4113: 'FARPROC' differs in parameter lists from 'CRYPTACQUIRECONTEXTA'
src\platform\random.c(130): warning C4133: 'initializing': incompatible types - from 'FARPROC' to 'CRYPTACQUIRECONTEXTA'
...
src\platform\win32\io.c(27): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size
src\platform\win32\io.c(116): warning C4312: 'type cast': conversion from 'int' to 'HANDLE' of greater size
...
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9002 : ignoring unknown option '-lm'
minilua.c
...
src\jit\x64\emit.c(8): warning C4129: 'j': unrecognized character escape sequence
src\jit\x64\emit.c(8): warning C4129: 'e': unrecognized character escape sequence
srcjitdemit.dasc(4): warning C4068: unknown pragma
srcjitdemit.dasc(5): warning C4068: unknown pragma
srcjitdemit.dasc(7): warning C4068: unknown pragma
srcjitdemit.dasc(8): warning C4068: unknown pragma
src/jit/x64/tiles.dasc(2): warning C4068: unknown pragma
...

上面的代码块中只显示了警告。给出了完整的日志 here.

用于构建的系统:Appveyor with VS-2019 in Windows

配置:

## Appveyor configuration for Rakudo

# Manually build and don't use MSVC's build process so disable it
build: off

platform:
  - x64

install:
  - '"C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Auxiliary\Build\vcvars64.bat"'
  # install zstd
  - choco install zstandard
  - SET PATH=C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;%PATH%
  - perl Configure.pl --gen-moar --gen-nqp --backends=moar --prefix=%APPVEYOR_BUILD_FOLDER%\raku
  - nmake 
  - nmake install

environment:
  matrix:
  - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019

branches:
  only:
    - master
  1. 虽然我已经从chocolatey安装了zstandard(https://github.com/facebook/zstd),为什么我得到.. did not find libzstd; will not use heap snapshot format version 3
  2. 构建过程中的这些警告(zstd 除外)是否无害,我可以安全地忽略?或者我应该担心什么?
  3. 有没有办法消除这些警告?

我快速浏览了一下:

关于 conversion from 'int' to 'HANDLE' of greater size 的警告可能是由于缺少 #include <io.h>,这导致编译器假设 _get_osfhandle() returns int 而不是 intptr_t这可能是一个错误(尽管它可能不会在实践中出现,具体取决于值的范围 windows 实际上 returns 来自该函数)。

有关 'FARPROC' differs in parameter lists 的警告是由于缺少从 GetProcAddress() 返回的通用指针到特定类型的转换。但是,因为所有指针类型都具有兼容的表示形式,所以如果忽略也不会发生什么坏事。

有关 pragma 的警告也可以忽略,并且可以通过明智地使用 #ifdef __GNUC__.

来抑制

有关 unrecognized character escape sequence 的警告是由于未正确转义生成代码中路径中的反斜杠。应该修复,但也可以忽略。

关于zstd,配置脚本使用pkg-config查找库,所以没有windows支持。有人应该解决这个问题。不过,我相信这只会影响分析器,不会影响 MoarVM 的正常运行。

我没有调查 Command line warning 的东西,虽然看起来有些东西认为它是在 *nix 系统上编译的,因此传递了不正确的标志。应该已修复,但可能不会破坏构建。