pharo-project / pharo-vm

This is the VM used by Pharo
http://pharo.org
Other
115 stars 71 forks source link

Docu for building on Windows is incomplete #762

Open astares opened 7 months ago

astares commented 7 months ago

I tried to follow the Pharo VM documentation to download and build the windows VM on a fresh machine: Unfortunately the documentation on https://github.com/pharo-project/pharo-vm/wiki/Building-on-Windows is incomplete and not very helpful:

  1. I used a fresh Windows virtualized Windows box

  2. First I installed a git client "https://git-scm.com"

  3. Then I run

    git clone https://github.com/pharo-project/pharo-vm

    to get a copy of the repository

  4. I navigate to the script directory and run the installation script for the cygwin tools

    powershell 
.\scripts\installCygwin.ps1 setup-x86_64.exe x86_64

the tools get installed

  1. I also set
Set-ExecutionPolicy -ExecutionPolicy Unrestricted

6, Now I open Cygwin.bat from C:\cygwin to get into Cygwin commandline (which is not mentioned and missing in the docu)

  1. Then I run
cmake .

and already get same errors:

image
astares commented 7 months ago

The log part is

-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /cygdrive/c/projects/pharo/pharo-vm/LibGit2-download
[ 11%] Performing update step for 'LibGit2-download'
[ 22%] No patch step for 'LibGit2-download'
[ 33%] No configure step for 'LibGit2-download'
[ 44%] No build step for 'LibGit2-download'
[ 55%] No install step for 'LibGit2-download'
[ 66%] No test step for 'LibGit2-download'
[ 77%] Completed 'LibGit2-download'
[100%] Built target LibGit2-download
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could NOT find GSSAPI (missing: GSSAPI_LIBRARIES GSSAPI_INCLUDE_DIR)
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
CMake Error at LibGit2-src/cmake/SelectHTTPSBackend.cmake:29 (message):
  Unable to autodetect a usable HTTPS backend.Please pass the backend name
  explicitly (-DUSE_HTTPS=backend)
Call Stack (most recent call first):
  LibGit2-src/src/CMakeLists.txt:40 (include)

-- Configuring incomplete, errors occurred!
astares commented 7 months ago

What is strange: I've checked out the source code on "C:\projects\pharo\pharo-vm" path. I think it its required to checkout on "C:\pharo-vm" as the build seems to expect it there.

Cygwin smake build seems to create a relative folder like this:

image
astares commented 7 months ago

I double checked with the workflow build:

https://github.com/pharo-project/pharo-vm/blob/pharo-10/.github/workflows/continuous-integration-workflow.yaml

Looks like ".\scripts\runScriptInCygwinBash.ps1" always requires a file argument and can not be run interactively. Otherwise one gets an error with "Path" check.

astares commented 7 months ago

I started freshly: new git clone on C:\pharo-vm

Trying to mock the build from workflow file:

  1. created a file run.ps1 in C:\pharo-vm
mkdir -p build
cd build
cmake .. -DAPPNAME=Pharo -DVM_EXECUTABLE_NAME=Pharo

and then on DOS commandline (while being in C:\pharo-vm directory) running

powershell  -File .\scripts\runScriptInCygwinBash.ps1 run.ps1

but still get an error:

image
astares commented 7 months ago

As git gives a warning

"fatal: detected dubious ownership in repository at '/cygdrive/c/pharo-vm'
To add an exception for this directory, call:

        git config --global --add safe.directory /cygdrive/c/pharo-vm
fatal: detected dubious ownership in repository at '/cygdrive/c/pharo-vm
...

Which is basically a permission issue - just as an additional security warning as one clones into "C:\pharo-vm" same way as the CI build (which is typically a directory outside of the directories owned by the current user and can impose a security risk). One can ignore this warning

To prevent the warning I modified the run.ps1 in C:\pharo-vm into

git config --global --add safe.directory /cygdrive/c/pharo-vm
mkdir -p build
cd build
cmake .. -DAPPNAME=Pharo -DVM_EXECUTABLE_NAME=Pharo

and run again

powershell  -File .\scripts\runScriptInCygwinBash.ps1 run.ps1

now it does not lament and the build starts running and downloading stuff (like the LibGit2-download) but failed with the original error

-- Performing Test IS_WFORMAT_SUPPORTED - Failed
-- Performing Test IS_WFORMAT_SECURITY_SUPPORTED
-- Performing Test IS_WFORMAT_SECURITY_SUPPORTED - Failed
-- Could NOT find GSSAPI (missing: GSSAPI_LIBRARIES GSSAPI_INCLUDE_DIR)
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
CMake Error at build/LibGit2-src/cmake/SelectHTTPSBackend.cmake:29 (message):
  Unable to autodetect a usable HTTPS backend.Please pass the backend name
  explicitly (-DUSE_HTTPS=backend)
Call Stack (most recent call first):
  build/LibGit2-src/src/CMakeLists.txt:40 (include)
image

Looks like still some magic wizardry is required

OpenSSL comes with cygwin and is installed/available in C:\cygwin\bin

image

astares commented 7 months ago

After checking with @tesonep (who suggested to set DPHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES to TRUE) I modified the run.ps1 into

git config --global --add safe.directory /cygdrive/c/pharo-vm
mkdir -p build
cd build
cmake -S .. -B . -DPHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES=TRUE
cmake .. -DAPPNAME=Pharo -DVM_EXECUTABLE_NAME=Pharo

this passed the open ssl and freetype issue but failed again on dot executable from Graphviz not found" (white part in screenshot) and failing in custom rules (the red part in screenshot)

image

The /CMakeFiles/CMakeConfigureLog.yaml looks like CMakeConfigureLog.yaml.TXT