Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding port file for v8 #2324

Closed
wants to merge 0 commits into from
Closed

Adding port file for v8 #2324

wants to merge 0 commits into from

Conversation

tkerwin
Copy link

@tkerwin tkerwin commented Dec 7, 2017

v8 has a quite convoluted build system.
This is the general sequence of events:

  1. Fetch and unzip Google's "depot_tools"
  2. Update depot_tools
  3. Pull v8 code via depot_tools
  4. Generate build framework via depot_tools
  5. Append commands to build config file
  6. Call ninja to perform the build
  7. Install header and library files

Make sure to initialize the Visual Studio command line environment before running vcpkg install v8:x64-windows i.e. run "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" or the equivalent on your system

Fixes #372

@windoze
Copy link

windoze commented Dec 11, 2017

Hi, I've tried your port, but there're some issues.

  1. It complained about the depot_tools.zip hash mismatch, I guess Chromium team just made some updates.
  2. It complained that it cannot find git
CMake Error at C:/tools/vcpkg/scripts/cmake/vcpkg_execute_required_process.cmake:44 (message):
    Command failed: GIT_EXECUTABLE-NOTFOUND;checkout;branch-heads/6.3
    Working Directory: C:/tools/vcpkg/buildtrees/v8/src/v8/v8
    See logs for more information:
      C:\tools\vcpkg\buildtrees\v8\x64-windows-out.log
      C:\tools\vcpkg\buildtrees\v8\x64-windows-err.log

Call Stack (most recent call first):
  C:/tools/vcpkg/ports/v8/portfile.cmake:69 (vcpkg_execute_required_process)
  C:/tools/vcpkg/scripts/ports.cmake:72 (include)

2 logs files are empty, and I'm pretty sure Git.exe is installed and on the path.

@tkerwin
Copy link
Author

tkerwin commented Dec 11, 2017

Thanks for trying it out. Before that error, was there an output line that says "Git found: [something]"? Perhaps find_package(Git) is failing for some reason.

@windoze
Copy link

windoze commented Dec 11, 2017

Here is the full output:

vcpkg install v8:x64-windows

The following packages will be built and installed:
    v8:x64-windows
Starting package 1/1: v8:x64-windows
Building package v8:x64-windows...
-- CURRENT_INSTALLED_DIR=C:/tools/vcpkg/installed/x64-windows
-- DOWNLOADS=C:/tools/vcpkg/downloads
-- CURRENT_PACKAGES_DIR=C:/tools/vcpkg/packages/v8_x64-windows
-- CURRENT_BUILDTREES_DIR=C:/tools/vcpkg/buildtrees/v8
-- CURRENT_PORT_DIR=C:/tools/vcpkg/ports/v8/.
-- Using cached C:/tools/vcpkg/downloads/depot_tools.zip
-- Testing integrity of cached file...
-- Testing integrity of cached file... OK
-- Extracting done
-- Updating depot_tools...
-- Switching to checkout of v8 version 6.3
-- Could NOT find Git (missing: GIT_EXECUTABLE)
CMake Error at C:/tools/vcpkg/scripts/cmake/vcpkg_execute_required_process.cmake:44 (message):
    Command failed: GIT_EXECUTABLE-NOTFOUND;checkout;branch-heads/6.3
    Working Directory: C:/tools/vcpkg/buildtrees/v8/src/v8/v8
    See logs for more information:
      C:\tools\vcpkg\buildtrees\v8\x64-windows-out.log
      C:\tools\vcpkg\buildtrees\v8\x64-windows-err.log

Call Stack (most recent call first):
  C:/tools/vcpkg/ports/v8/portfile.cmake:69 (vcpkg_execute_required_process)
  C:/tools/vcpkg/scripts/ports.cmake:72 (include)


Error: Building package v8:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: v8:x64-windows
  Vcpkg version: 0.0.100-2017-12-09-9f0d33b6ad3af842b133aafa8be1bbf63e08201d

Additionally, attach any relevant sections from the log files above.
where git
C:\Program Files\Git\cmd\git.exe

Seems it failed to find git, which I've installed with Chocolatey.

choco list -li
...
git 2.15.1.2
git.install 2.15.1.2
...

@ghost
Copy link

ghost commented Dec 13, 2017

Can you edit your initial post to contain "Fixes #372"?

@windoze
Copy link

windoze commented Dec 14, 2017

It's weird that suddenly FindGit worked, but there was a new issue:

vcpkg install v8:x64-windows
The following packages will be built and installed:
    v8:x64-windows
Starting package 1/1: v8:x64-windows
Building package v8:x64-windows...
-- CURRENT_INSTALLED_DIR=C:/tools/vcpkg/installed/x64-windows
-- DOWNLOADS=C:/tools/vcpkg/downloads
-- CURRENT_PACKAGES_DIR=C:/tools/vcpkg/packages/v8_x64-windows
-- CURRENT_BUILDTREES_DIR=C:/tools/vcpkg/buildtrees/v8
-- CURRENT_PORT_DIR=C:/tools/vcpkg/ports/v8/.
-- Using cached C:/tools/vcpkg/downloads/depot_tools.zip
-- Testing integrity of cached file...
-- Testing integrity of cached file... OK
-- Extracting source C:/tools/vcpkg/downloads/depot_tools.zip
-- Extracting done
-- Updating depot_tools...
-- Initial fetch of v8 git repository
-- Generating build directory x64.optdebug
-- Setting configuration for shared library build
-- Building x64.optdebug through ninja
-- Generating build directory x64.release
-- Setting configuration for shared library build
-- Building x64.release through ninja
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/share/v8/copyright
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/libplatform
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/libplatform/libplatform-export.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/libplatform/libplatform.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/libplatform/v8-tracing.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/v8-debug.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/v8-inspector-protocol.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/v8-inspector.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/v8-platform.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/v8-profiler.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/v8-testing.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/v8-util.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/v8-value-serializer-version.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/v8-version-string.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/v8-version.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/v8.h
-- Installing: C:/tools/vcpkg/packages/v8_x64-windows/include/v8config.h
CMake Error at C:/tools/vcpkg/ports/v8/portfile.cmake:147 (file):
  file INSTALL cannot find
  "C:/tools/vcpkg/buildtrees/v8/src/v8/v8/out.gn/x64.release/v8.dll".
Call Stack (most recent call first):
  C:/tools/vcpkg/scripts/ports.cmake:72 (include)


Error: Building package v8:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: v8:x64-windows
  Vcpkg version: 0.0.100-2017-12-09-9f0d33b6ad3af842b133aafa8be1bbf63e08201d

Additionally, attach any relevant sections from the log files above.

x64-windows-err.log:

c:\tools\vcpkg\buildtrees\v8\src\v8\v8\third_party\_gclient_gittmp_instrumented_librariesy9byp3\shallow - The process cannot access the file because it is being used by another process.

@windoze
Copy link

windoze commented Dec 14, 2017

ok, I'v found the problem.
For some reason, ninja didn't build "v8.dll" when it's building "v8-shell.exe", I added "v8.dll" target in portfile.cmake:103 and portfile.cmake:133 and the issue's gone.

And there is another problem, looks that this port doesn't copy natives_blob.bin and snapshot.bin into installed directory, I've to copy them from the buildtrees to make a hello world program to run.

BTW, does this port support static build?

@tkerwin
Copy link
Author

tkerwin commented Dec 14, 2017

I haven't tried static build, but I'll give it a shot.
The requirement on native_blob.bin and snapshot.bin should be removed by the line:
file(APPEND ${SOURCE_PATH}/v8/v8/out.gn/${BUILDTYPE}/args.gn "v8_use_external_startup_data = false" )

That's how I did it when I had that problem, but it's already in portfile.cmake, so I'm not sure why you're seeing the issue.

@tkerwin
Copy link
Author

tkerwin commented Dec 14, 2017

I think maybe the depot tools update affected the v8.dll build issue. I wasn't seeing it before, and now I am.

@tkerwin
Copy link
Author

tkerwin commented Dec 14, 2017

I think the new depot_tools might have changed something with the build.ninja generation. For the x64.optdebug build, it has build v8: phony ./v8.dll.lib, but in x64.release, it has build v8: phony obj/v8.stamp. The dlls are built correctly in the first case but not for release.

@windoze
Copy link

windoze commented Dec 15, 2017

I see the problem, in portfile.cmake:95, you forgot to add a "\n" at the line end, so the generated args.gn was like:

...
visual_studio_version = "2017"v8_use_external_startup_data = false

@tkerwin
Copy link
Author

tkerwin commented Dec 20, 2017

The latest fixes work better for me. the v8.dll problem seemed to be some strange side effect of them updating the depot_tools, so I generated the build files using a different method.

Copy link
Contributor

@icedream2linxi icedream2linxi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you consider Linux and MacOS?

是否考虑下 Linux 和 MacOS?


include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src)
vcpkg_download_distfile(ARCHIVE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

depot_tools.zip will change with the version, why not directly git clone?

depot_tools.zip 会随着版本变化,为什么不直接 git clone ?

vcpkg_execute_required_process(
COMMAND ${SOURCE_PATH}/gclient.bat
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME ${TARGET_TRIPLET}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same as the log name that follows, which can lead to indistinguishable.

这里与后面的日志名称相同,会导致无法区分。


message(STATUS "Switching to checkout of v8 version 6.3")

find_package(Git)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use find_program(GIT NAMES git git.cmd), for example vcpkg_apply_patches.cmake.

使用 find_program(GIT NAMES git git.cmd),例如vcpkg_apply_patches.cmake

WORKING_DIRECTORY ${SOURCE_PATH}/v8/v8
LOGNAME ${TARGET_TRIPLET}
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sync is required after checkout because checkout does not update submodule to the appropriate version.

checkout 后需要 sync,因为 checkout 并没有将 submodule 更新到合适版本。

@ivanmoskalev
Copy link

ivanmoskalev commented Nov 13, 2018

Is there any particular reason why this PR is suspended?
I need v8 in my project, and I'd prefer to add it through the vcpkg, so I might try and help the author to merge this.

@Rastaban
Copy link
Contributor

ug, I had a few updates to this PR but ended up making a mess when pushing my change because of how I merged the latest master branch into it. I attempted to force-push to undo the mess but it ended up closing the PR. I have stuck all the changes into dev/philc/tkerwin-master for now until I can sort it all out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants