pharo-project / pharo-vm

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

Not able to build on Windows with up-to-date Cygwin #563

Open pavel-krivanek opened 1 year ago

pavel-krivanek commented 1 year ago

I was not able to build the Windows VM with the fresh Cygwin (64) installation.

First, the definitions of packages in installCygwin.ps1 does not seem to be complete. These packages are missing

libssh2-devel
libSDL2-devel
libssl-devel
libfreetype-devel

...and maybe some more (libuuid-devel, libpixman-devel, libcairo-devel ???)

But even with these present, I'm getting

-- Build files have been written to: /cygdrive/d/repos/pharo-vm/SDL2-2.24.1-download
[100%] Built target SDL2-2.24.1-download
-- /cygdrive/d/repos/pharo-vm/SDL2-2.24.1-src/SDL2.dll
-- Configuring done
CMake Error at /usr/share/cmake-3.23.2/Modules/ExternalProject.cmake:2302:EVAL:2 (add_custom_command):
  Attempt to add a custom rule to output

    /cygdrive/d/repos/pharo-vm/D.rule

  which already has a custom rule.
Call Stack (most recent call first):
  /usr/share/cmake-3.23.2/Modules/ExternalProject.cmake:2302 (cmake_language)
  /usr/share/cmake-3.23.2/Modules/ExternalProject.cmake:2821:EVAL:2 (ExternalProject_Add_Step)
  /usr/share/cmake-3.23.2/Modules/ExternalProject.cmake:2821 (cmake_language)
  /usr/share/cmake-3.23.2/Modules/ExternalProject.cmake:3640 (_ep_add_download_command)
  cmake/vmmaker.cmake:97 (ExternalProject_Add)
  CMakeLists.txt:430 (include)

I'm running the compilation as:

cmake . -DWIN=1 -DPHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES=TRUE

Notice that the version Pharo wants to build is much newer than the one in Cygwin (2.24 vs 2.0.7) but I'm not sure it plays any role.

When building without DPHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES, I'm getting

-- /cygdrive/d/repos/pharo-vm/libpng-1.6.37-src/libpng16.dll
-- Looking for SDL2 in the system
CMake Error at cmake/importSDL2.cmake:82 (get_target_property):
  get_target_property() called with non-existent target "SDL2::SDL2".
Call Stack (most recent call first):
  cmake/Windows.cmake:96 (include)
  CMakeLists.txt:558 (add_third_party_dependencies_per_platform)
pavel-krivanek commented 1 year ago

maybe not only Windows specific. When I tried the compilation in WSL, I got

[100%] Built target libpng-1.6.37-download
-- /home/krivanek/pharo-vm/build/libpng-1.6.37-src/libpng.so
-- /home/krivanek/pharo-vm/build/libpng-1.6.37-src/libpng16.so
-- /home/krivanek/pharo-vm/build/libpng-1.6.37-src/libpng16.so.16
-- /home/krivanek/pharo-vm/build/libpng-1.6.37-src/libpng16.so.16.37.0
-- Looking for SDL2 in the system
CMake Error at cmake/importSDL2.cmake:82 (get_target_property):
  get_target_property() called with non-existent target "SDL2::SDL2".
Call Stack (most recent call first):
  cmake/Linux.cmake:57 (include)
  CMakeLists.txt:558 (add_third_party_dependencies_per_platform)

-- Using system libSDL2 from
-- dot executable from Graphviz not found. Dependency graphs not generated
-- Configuring incomplete, errors occurred!
See also "/home/krivanek/pharo-vm/build/CMakeFiles/CMakeOutput.log".
See also "/home/krivanek/pharo-vm/build/CMakeFiles/CMakeError.log".

The WSL has:

Description:    Ubuntu 20.04.6 LTS

...and I installed all the packages listed on the wiki

guillep commented 1 year ago

I was not able to build the Windows VM with the fresh Cygwin (64) installation.

First, the definitions of packages in installCygwin.ps1 does not seem to be complete. These packages are missing

libssh2-devel
libSDL2-devel
libssl-devel
libfreetype-devel

...and maybe some more (libuuid-devel, libpixman-devel, libcairo-devel ???)

Hmm, this is not failing in the CI because we are not using that file... Jenkins comes with pre-configured (stateful) slaves... Would you mind making a PR to update this file with whatever works for you? We should think now that GitHub actions are stable if it makes sense to migrate part of the process.

But even with these present, I'm getting

-- Build files have been written to: /cygdrive/d/repos/pharo-vm/SDL2-2.24.1-download
[100%] Built target SDL2-2.24.1-download
-- /cygdrive/d/repos/pharo-vm/SDL2-2.24.1-src/SDL2.dll
-- Configuring done
CMake Error at /usr/share/cmake-3.23.2/Modules/ExternalProject.cmake:2302:EVAL:2 (add_custom_command):
  Attempt to add a custom rule to output

    /cygdrive/d/repos/pharo-vm/D.rule

  which already has a custom rule.
Call Stack (most recent call first):
  /usr/share/cmake-3.23.2/Modules/ExternalProject.cmake:2302 (cmake_language)
  /usr/share/cmake-3.23.2/Modules/ExternalProject.cmake:2821:EVAL:2 (ExternalProject_Add_Step)
  /usr/share/cmake-3.23.2/Modules/ExternalProject.cmake:2821 (cmake_language)
  /usr/share/cmake-3.23.2/Modules/ExternalProject.cmake:3640 (_ep_add_download_command)
  cmake/vmmaker.cmake:97 (ExternalProject_Add)
  CMakeLists.txt:430 (include)

I'm running the compilation as:

cmake . -DWIN=1 -DPHARO_DEPENDENCIES_PREFER_DOWNLOAD_BINARIES=TRUE

Notice that the version Pharo wants to build is much newer than the one in Cygwin (2.24 vs 2.0.7) but I'm not sure it plays any role.

Probably. SDL changed it's internal CMake configuration.

I guess this is related to

https://github.com/pharo-project/pharo-vm/pull/555

Now, changing it back means not supporting new versions either. We should probably change it to make it support both versions? It could be done in CMake by asking if the new SDL2::SDL2 target is defined, otherwise use the old one.

https://stackoverflow.com/questions/27339329/how-to-check-whether-a-target-has-been-added-or-not

Stack Overflow
How to check whether a target has been added or not?
Assume I have a cmake macro that adds target (library or executable) based on some conditions macro (conditionally_add target_name target_src condition) if (condition) add_library (target_name
pavel-krivanek commented 1 year ago

Would you mind making a PR to update this file with whatever works for you?

I can but first, the problem of SDL2 needs to be solved else I'm not able to compile whole VM to prove it is a valid list.