Windows 上的 V8 JavaScript 引擎 (MinGW)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/328718/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:40:46  来源:igfitidea点击:

V8 JavaScript Engine on Windows (MinGW)

javascriptwindowsmingwv8

提问by bhadra

The build instructions of V8 JavaScript Enginemention only Visual Studio 2005 and 2008. Has anybody been successful with MinGWon Windows XP/Vista?

V8 JavaScript 引擎构建说明只提到了 Visual Studio 2005 和 2008。有人在 Windows XP/Vista 上使用MinGW成功吗?

采纳答案by the_drow

You just need to change Scons a bit.
Take a look at C:\YourPythonFolder\Lib\site-packages\scons-YourSconsVersion\SCons\Script__ init__.py and go to line 560.
Change the linker to gnulink, the c compiler to mingw and the c++ compiler to g++.
Eventually it should look like this:

你只需要稍微改变 Scons。
查看 C:\YourPythonFolder\Lib\site-packages\scons-YourSconsVersion\SCons\Script__ init__.py 并转到第 560 行。
将链接器更改为 gnulink,将 c 编译器更改为 mingw,将 c++ 编译器更改为 g++。
最终它应该是这样的:

linkers = ['gnulink', 'mslink',  'ilink', 'linkloc', 'ilink32' ]
c_compilers = ['mingw', 'msvc',  'gcc', 'intelc', 'icl', 'icc', 'cc', 'bcc32' ]
cxx_compilers = ['g++', 'msvc', 'intelc', 'icc',  'c++', 'bcc32' ]

Now MingW is activated by default :)

现在 MingW 是默认激活的 :)

回答by Ariya Hidayat

回答by kentaromiura

I've tried, but seems it automatically detect the WIN32 platform and tries to invoke the vc++ compiler, I tried to adding to the PATH the mingw-gcc compiler (I've not vc++ installed) and the build script correctly sees it, but doesn't compile out of the box.

我试过了,但似乎它会自动检测 WIN32 平台并尝试调用 vc++ 编译器,我尝试将 mingw-gcc 编译器(我没有安装 vc++)添加到 PATH 中,并且构建脚本正确地看到了它,但是不是开箱即用的。

I suppose deleting the "WIN32 flag" will do the work, since for successfully compiling under mingw the compiler needs to thinks to be on unix enviroment, but then even if it compiles probably it will have some problems due to the different platform.

我想删除“WIN32标志”会完成这项工作,因为要在mingw下成功编译,编译器需要认为是在unix环境中,但是即使编译可能由于平台不同也会出现一些问题。

回答by kentaromiura

V8 seems to use different parts of its code (especialy for the file system stuff) for different platforms. I made a build under Cygwin which puts out a beautiful linux lib, which runs on linux but doesn't on Win. I think partwise this will be the same with MinGW if you erase the WIN32 flag!

V8 似乎在不同平台上使用其代码的不同部分(尤其是文件系统内容)。我在 Cygwin 下构建了一个漂亮的 linux lib,它在 linux 上运行但不在 Win 上运行。我认为如果您删除 WIN32 标志,这将与 MinGW 部分相同!

At the moment I just can see 2 possibilities. One is simple: Use Visual Studio, it's free. The second is very hard: write a makefile :)

目前我只能看到两种可能性。一个很简单:使用 Visual Studio,它是免费的。第二个很难:写一个makefile :)