project-renard / curie

:mag_right::book: Document reader (currently in pre-alpha)
https://p3rl.org/Renard::Curie
14 stars 5 forks source link

Windows build #188

Closed jstaursky closed 7 years ago

jstaursky commented 7 years ago

Hey I am unable to get a working windows build. I tried the approach outlined here https://project-renard.github.io/doc/development/meeting-log/posts/2016/05/03/windows-build-with-msys2/ but unfortunately get failure at the installation of Glib::Object::Introspection, Test::Trap, Gtk3, XML::Simple.

I'll post a compile log if you are interested but I'm suspecting that this may be a known issue since the how to I referenced was made nearly a year ago.

zmughal commented 7 years ago

Hi!

Yeah, there is a bit of a problem with getting Windows working locally. I have to revisit that.

Right now, we're using a variation of those steps to test each change using Appveyor and it does work consistently under continuous integration. I'm planning on taking that setup and trying to automate more of it. I haven't yet written the notes on how I will do that, but it will be on this wiki page when I get to it: https://project-renard.github.io/doc/development/contributing/.

@MaxPerl has put together an automated installer for Gtk3 based on the instructions you linked that I have yet to try: https://github.com/MaxPerl/perl-Gtk3-windows-installer. I just noticed that you were having problems with it at https://github.com/MaxPerl/perl-Gtk3-windows-installer/issues/1. My goal for this week is to reproduce an automated developer environment, so I'll try to figure out why that is failing.

If you just want to try out the application in its current alpha state, I have an MSI I built under the releases repo's artifacts: https://ci.appveyor.com/project/zmughal/release/build/1.0.110/artifacts. I haven't announced this publicly nor tested it thoroughly because I wanted to wait until we hit the v0.004 milestone.

Cheers, -zaki

zmughal commented 7 years ago

I installed the MSI I linked to in my comment (build 110). It seems to be crashing when using the file chooser. There is a working version in build 45 here https://ci.appveyor.com/project/zmughal/release/build/1.0.45/artifacts.

jstaursky commented 7 years ago

OK Thank you for looking into the issue. I have been working on the issue since then and have since been able to get the issue https://github.com/MaxPerl/perl-Gtk3-windows-installer/issues/1 fixed. I think the issue ultimately was caused by two things,

  1. It seems my fresh install was being disrupted by MSYS2 thinking I was using glib2.0 version 2.48. This was happening because I use emacs builds from http://emacsbinw64.sourceforge.net/ and put its "bin" folder in my .bashrc path. Now since all of emacs libs happen to be in that same folder, msys2 thought I was using an old version of glib2.
  2. my msys2_root was in "E:\Programming\msys64" ('E:' b/c I am using this on flash drive) which seems not to jive well with "MaxPerl's" installer. I tried editing his script so "E:\Programming\msys64" was the default install location but this causes perl to think the 'm' in "msys64" is a special character because it is being escaped. I tried working around this using \Q..\E solution suggested here: http://stackoverflow.com/questions/576435/how-do-i-handle-special-characters-in-a-perl-regex but this still didn't work. So eventually I gave up and reinstalled msys2 in E:\msys64 and refered to the emacs executable using the bash function
    function emacs {
    /emacs/bin/runemacs.exe $1
    }

    After all that, I was able to install use MaxPerl's installer without too many issues (just had to replace "C:" with "E:" in his script). I still need to get around to trying to install curie but haven't had much time to get around to it. I'll update this thread next time I get another chance to hack away at it if something goes wrong during the install.

MaxPerl commented 7 years ago

Dear jstaursky, Thank you very much for your feedback. This is really unsatisfactory that my installer only works when PATH is C:\msys64. Sorry for that. Have you tried E:/Programming/msys64 that means / instead of \\ as directory separator? The POSIX style causes mostly less problems...

PS.: Oh, I just saw the problem. The volume drive letter is hardcoded in the Makefile Hack function. That is not good. I will change it the next weeks. But at the moment I don't have a windows install to test it...

jstaursky commented 7 years ago

MaxPerl please see my response at https://github.com/MaxPerl/perl-Gtk3-windows-installer/issues/1

jstaursky commented 7 years ago

@zmughal While I do appreciate the install links, I want to be able to set up the build myself. and unfortunately even after successful installation of of glib relateds modules I am still unable to install all module dependencies necessary to run curie. When I try to run cpanm --installdeps . inside the curie directory I get errors on the following modules

$ cpanm --installdeps . --> Working on . Configuring E:/msys64/my-projects/development/curie ... OK ==> Found dependencies: Alien::MuPDF, Test::Trap --> Working on Alien::MuPDF Fetching http://www.cpan.org/authors/id/Z/ZM/ZMUGHAL/Alien-MuPDF-0.007.tar.gz ... OK Configuring Alien-MuPDF-0.007 ... OK ==> Found dependencies: Alien::gmake, Alien::patch --> Working on Alien::gmake Fetching http://www.cpan.org/authors/id/P/PL/PLICEASE/Alien-gmake-0.19.tar.gz ... OK ==> Found dependencies: Alien::Build::MM, Alien::Build --> Working on Alien::Build::MM Fetching http://www.cpan.org/authors/id/P/PL/PLICEASE/Alien-Build-0.31.tar.gz ... OK Configuring Alien-Build-0.31 ... OK Building and testing Alien-Build-0.31 ... FAIL ! Installing Alien::Build::MM failed. See E:\msys64\home\jnstaursky.cpanm\work\1490448578.10244\build.log for details. Retry with --force to force install it. ! Installing the dependencies failed: Module 'Alien::Build' is not installed, Module 'Alien::Build::MM' is not installed ! Bailing out the installation for Alien-gmake-0.19. --> Working on Alien::patch Fetching http://www.cpan.org/authors/id/P/PL/PLICEASE/Alien-patch-0.11.tar.gz ... OK ==> Found dependencies: Alien::Build, Alien::Build::MM ! Installing the dependencies failed: Module 'Alien::Build::MM' is not installed, Module 'Alien::Build' is not installed ! Bailing out the installation for Alien-patch-0.11. ! Installing the dependencies failed: Module 'Alien::patch' is not installed, Module 'Alien::gmake' is not installed ! Bailing out the installation for Alien-MuPDF-0.007. --> Working on Test::Trap Fetching http://www.cpan.org/authors/id/E/EB/EBHANSSEN/Test-Trap-v0.3.2.tar.gz ... OK Configuring Test-Trap-v0.3.2 ... OK Building and testing Test-Trap-v0.3.2 ... FAIL ! Installing Test::Trap failed. See E:\msys64\home\jnstaursky.cpanm\work\1490448578.10244\build.log for details. Retry with --force to force install it. ! Installing the dependencies failed: Module 'Test::Trap' is not installed, Module 'Alien::MuPDF' is not installed ! Bailing out the installation for ..

Now after this I ran cpanm --look Alien::Build::MM && perl Makefile.PL && dmake && dmake install and was able to install this module and similarly for Alien::Build but after doing all that and running cpanm --installdeps . inside curie I keep running into the following

$ cpanm --installdeps . --> Working on . Configuring E:/msys64/my-projects/development/curie ... OK ==> Found dependencies: Test::Trap, Alien::MuPDF --> Working on Test::Trap Fetching http://www.cpan.org/authors/id/E/EB/EBHANSSEN/Test-Trap-v0.3.2.tar.gz ... OK Configuring Test-Trap-v0.3.2 ... OK Building and testing Test-Trap-v0.3.2 ... FAIL ! Installing Test::Trap failed. See E:\msys64\home\jnstaursky.cpanm\work\1490449253.2108\build.log for details. Retry with --force to force install it. --> Working on Alien::MuPDF Fetching http://www.cpan.org/authors/id/Z/ZM/ZMUGHAL/Alien-MuPDF-0.007.tar.gz ... OK Configuring Alien-MuPDF-0.007 ... OK ==> Found dependencies: Alien::gmake --> Working on Alien::gmake Fetching http://www.cpan.org/authors/id/P/PL/PLICEASE/Alien-gmake-0.19.tar.gz ... OK Configuring Alien-gmake-0.19 ... OK ==> Found dependencies: Alien::MSYS --> Working on Alien::MSYS Fetching http://www.cpan.org/authors/id/P/PL/PLICEASE/Alien-MSYS-0.07.tar.gz ... OK Configuring Alien-MSYS-0.07 ... OK Building and testing Alien-MSYS-0.07 ... FAIL ! Installing Alien::MSYS failed. See E:\msys64\home\jnstaursky.cpanm\work\1490449253.2108\build.log for details. Retry with --force to force install it. ! Installing the dependencies failed: Module 'Alien::MSYS' is not installed ! Bailing out the installation for Alien-gmake-0.19. ! Installing the dependencies failed: Module 'Alien::gmake' is not installed ! Bailing out the installation for Alien-MuPDF-0.007. ! Installing the dependencies failed: Module 'Test::Trap' is not installed, Module 'Alien::MuPDF' is not installed ! Bailing out the installation for ..

I am trying to this by installing Alien::MSYS but this appears to require gmake, which as far as I know is not available via MSYS2's pacman. Also when doing cpanm --look Alien::MSYS and just looking at the README, it looks like this wants tools from the original MSYS project

$ cat README NAME

Alien::MSYS - Tools required for GNU style configure scripts on Windows

VERSION

version 0.07

SYNOPSIS

from Perl:

 use Alien::MSYS;
 # runs uname from MSYS
 my $uname = mysy { `uname` };

From Prompt/Makefile

 C:\> perl -MAlien::MSYS -e msys_run uname

DESCRIPTION

MSYS provides minimal shell and POSIX tools on Windows to enable GNU
style configure scripts to run (the type usually generated by
autoconf). This module aims to provide an interface for using MSYS on
Windows and act as a no-op on Unix like operating systems which already
have that capability. If you use this module, I recommend that you list
this as a prerequisite only during MSWin32 installs.

When installing, this distribution will look for an existing MSYS using
the following methods in this order:

environment variable PERL_ALIEN_MSYS_BIN

  If set, this environment variable should be set to the root of MSYS
  (NOT MinGW). For example, if you have MinGW / MSYS installed on D:
  you might use this:

   C:\> set PERL_ALIEN_MSYS_BIN=D:\MinGW\msys\1.0\bin

  Keep in mind that this environment variable is consulted during both
  install and at run-time, so it is advisable to set this in the System
  Properties control panel.

search PATH for mingw-get.exe

  First Alien::MSYS searches the PATH environment variable for the
  mingw-get.exe program, which is a common method for installing MinGW
  and MSYS. From there if it can deduce the location of MSYS it will
  use that.

try C:\MinGW\msys\1.0\bin

  This is usually the default location, so Alien::MSYS will try this
  directory even if it isn't found by another method.

Use desktop shortcut for MinGW Installer

  Usually when you install the MinGW installer it creates a shortcut on
  the desktop. if Win32::Shortcut is installed (it is an optional
  dependency), then Alien::MSYS can use that information to determine
  the location of MSYS.

If MSYS cannot be found using any of these methods, then it will
download and install MSYS in this distribution's share directory (via
File::ShareDir).

FUNCTIONS

msys

 # get the uname from MSYS
 my $uname = msys { `uanem` };

 # run with GNU make from MSYS instead of
 # dmake from Strawberry Perl
 msys { system 'make' };

This function takes a single argument, a code reference, and runs it
with the correctly set environment so that calls to the system function
or the qx quote like operator will use MSYS instead of the default
environment.

msys_run

 # pass command through @ARGV
 C:\> perl -MAlien::MSYS -e msys_run uname

 # pass command through @_
 C:\> perl -MAlien::MSYS -e "msys_run 'make'; msys_run 'make install'"

This function runs a command with the MSYS environment. It gets the
command and arguments either as passed to it, or if none are passed the
the command is expected to be in @ARGV.

If the command fails then it will exit with a non-zero error code. This
is useful, in the second example above if either make or make install
fails, then the whole command will fail, also make install will not be
attempted unless make succeeds.

msys_path

This function returns the full path to the MSYS bin directory.

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

So I'm not really sure what to do next :/

zmughal commented 7 years ago

@jstaursky, Alien::MSYS and Test::Trap should install fine under MSYS2/MinGW64. I could try to diagnose the exact problem if you do cpanm --verbose --installdeps . and share the log from that.

I recently forced a rebuild on Appveyor from a clean slate and this works with the same versions that are failing in the log you shared: https://ci.appveyor.com/project/zmughal/curie/build/1.0.664.

I created a small batch script that automates the entire process in a way that closely matches what the above Appveyor script does. All it needs is a fresh install of MSYS2 (but it may make the assumption that the install is under C:\msys64).

One thing to note is that there is currently a new bug that requires installing an older version of Function::Parameters (see project-renard/curie/issues/190 for more details). I'll try to get this bug squared away in a couple days.


install.bat

@echo off

set MSYS_DRIVE=C:
set MSYS2_DIR=msys64
set MSYSTEM=MINGW64
set MSYS2_ARCH=x86_64
SET "PATH=%MSYS_DRIVE%\%MSYS2_DIR%\%MSYSTEM%\bin;%MSYS_DRIVE%\%MSYS2_DIR%\usr\bin;%PATH%"

set MSYS2_HOME=%MSYS_DRIVE%\%MSYS2_DIR%\home\%username%

echo %MSYS2_HOME%

git clone https://github.com/project-renard/curie.git %MSYS2_HOME%\project-renard\curie
git clone https://github.com/project-renard/devops.git %MSYS2_HOME%\project-renard\curie\external\project-renard\devops
git clone https://github.com/MaxPerl/perl-Gtk3-windows-installer.git %MSYS2_HOME%\project-renard\perl-Gtk3-windows-installer

set APPVEYOR_BUILD_FOLDER=%MSYS2_HOME%\project-renard\curie

cd %APPVEYOR_BUILD_FOLDER%

bash -lc "~/project-renard/curie/external/project-renard/devops/script/from-curie/ci/appveyor/update-msys2.sh"
bash -lc "~/project-renard/curie/external/project-renard/devops/script/from-curie/script/install-native-dep"
bash -lc "perl ~/project-renard/perl-Gtk3-windows-installer/install-perl-Gtk3-mingw64.pl"
bash -lc "~/project-renard/curie/external/project-renard/devops/script/from-curie/ci/appveyor/install-perl-dist.sh"
bash -lc "cpanm Function::Parameters@1.0706"
bash -lc "perl ~/project-renard/curie/bin/curie"
zmughal commented 7 years ago

@StayerX, when you have time, could you give the above a try? I believe it will get you set up. I am working on creating a video that demonstrates that it does work.

zmughal commented 7 years ago

Here is the batch file above as a text file: install.bat.txt

I recorded a video of the installation process here.

2017-03-28: Project Renard Curie install automatic (sped up 10x)

jstaursky commented 7 years ago

Good News! I was able to install curie using your batch script. I had a little difficulty during the install since I had to stop the script here and there to change the paths to "E:" but otherwise install went smoothly. Thank you for the help!

zmughal commented 7 years ago

@jstaursky: That's wonderful!

I will be planning on making something much cleaner in the future. I need it for incorporating throughout the various modules I'm building for this project. For example, the .msi builder is a ridiculous hack --- I'm surprised it even works.