failed to build v8 engine with "is_component_build = false" and "v8_static_library = true"

376 views
Skip to first unread message

Hejian Lin

unread,
Dec 10, 2017, 3:18:22 PM12/10/17
to v8-users
Version: 6.4.389
OS: Windows10
Architecture: x64, ia32

What steps will reproduce the problem?
1.following instruction to set the environment and fetch the latest code for building the v8 engine
2.set args "is_component_build = false" and "v8_static_library = true" via command "gn args out.gn\x64.release"
3.compile the code via command "ninja -C out.gn/x64.release"

I got the following error when building v8:

C:\v8.Engine\source\v8>python tools/dev/v8gen.py x64.debug
C:\v8.Engine\source\v8>ninja -C out.gn/x64.debug
ninja: Entering directory `out.gn/x64.debug'
[1/149] LINK cctest.exe cctest.exe.pdb
FAILED: cctest.exe cctest.exe.pdb
C:/v8.Engine/depot_tools/win_tools-2_7_6_bin/python/bin/python.exe ../../build/toolchain/win/tool_wrapper.py link-wrapper environment.x64 False link.exe /nologo /OUT:./cctest.exe /PDB:./cctest.exe.pdb @./cctest.exe.rsp
LINK : warning LNK4001: no object files specified; libraries used
LINK : error LNK1218: warning treated as error; no output file generated

I have tried many time with the same result. Anybody encountered a similar problem?

Louis Traynard

unread,
Dec 15, 2017, 7:55:31 AM12/15/17
to v8-users
I did (the very same), and I found a solution.
The problem happens for cctest and unittests and seems to come from the separation of the sources declaration from the executable in the respective BUILD.gn files of those two projects (commits https://github.com/v8/v8/commit/dbe9457fcb3a4875e5a29f5790444f352436db83#diff-0321f895b38a0b2e2f27acc6a3269f3e and https://github.com/v8/v8/commit/d6ead37d265d7215cf9c5f768f279e21bd170212#diff-9e94d02534a592dff1f50a56c7a84e51) : it seems that visual studio cannot easily link .lib files only ; it needs some raw .obj files as well (I suspect it needs at least the object file containing the main() declaration, because when I tried to ignore the warning LNK4001 I ended up having another error about unresolved mainCRTStartup).

Anyway, I more-or-less manually reverted those commits and I could finish the build without problems.
Reply all
Reply to author
Forward
0 new messages