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

Windows compatibility? #230

Closed
drhuffman12 opened this issue Apr 20, 2021 · 6 comments
Closed

Windows compatibility? #230

drhuffman12 opened this issue Apr 20, 2021 · 6 comments

Comments

@drhuffman12
Copy link

drhuffman12 commented Apr 20, 2021

Is this shard Windows compatible?

When I tried to build on Windows via shards install --ignore-crystal-version, I get the following error:

Run shards install --ignore-crystal-version
...
Installing ameba (0.14.3)
Postinstall of ameba: make bin && make run_file
Error: Process completed with exit code 1.1.

See:

See:

@drhuffman12
Copy link
Author

drhuffman12 commented Apr 22, 2021

I'm not sure if it is related, but Spectator also was not working with Windows (diif error showed up). But in case it helps, they noted some fix info here: https://gitlab.com/arctic-fox/spectator/-/issues/58

@straight-shoota
Copy link
Contributor

The reason for failure is that ameba expects make to be available. But your Windows system probably doesn't have it.

My primary advise is to not use make for postinstall hooks (I already suggested that in #167 (comment)). While make is typically available in many environments, there's no guarantee to that. A postinstall hook should be as simple as possible and not expect any non-mandatory programs to be available.

For POSIX platforms, a basic shell script should work for any non-trivial tasks. As long as it doesn't use any bashisms or similar, it should be good.
Now, for windows support, this is more challenging as a shell script won't run.

Feel free to jump in the discussion: crystal-lang/shards#468

@straight-shoota
Copy link
Contributor

straight-shoota commented Apr 22, 2021

As a workaround, you can use shards install --skip-postinstall on windows.

@drhuffman12
Copy link
Author

@straight-shoota , thanks I'll try your recommendation re shards install --skip-postinstall on windows side.

@drhuffman12
Copy link
Author

I added the --skip-postinstall to the shards install ... lines (drhuffman12/crystal_ray_tracer@485a8bb), but it didn't exactly fix the issue. Yes, the CI logs now show that the make part is skipped, but the CI is trying to access the a file, which isn't there (maybe because ameba is expecting the make .. to have succeeded and plop a file there):

  • Ubuntu:
Run shards install --ignore-crystal-version --skip-postinstall
  shards install --ignore-crystal-version --skip-postinstall
  shell: /usr/bin/bash -e {0}
Resolving dependencies
Fetching https://github.com/stumpycr/stumpy_png.git
Fetching https://github.com/stumpycr/stumpy_bmp.git
Fetching https://github.com/crystal-ameba/ameba.git
Fetching https://gitlab.com/arctic-fox/spectator.git
Fetching https://github.com/askn/faker.git
Fetching https://github.com/crystal-community/hardware.git
Fetching https://github.com/stumpycr/stumpy_core.git
Installing stumpy_core (1.9.1)
Installing stumpy_png (5.0.1)
Installing stumpy_bmp (0.2.0)
Installing ameba (0.14.3)
Unhandled exception: Error opening file with mode 'r': '/home/runner/work/crystal_ray_tracer/crystal_ray_tracer/lib/ameba/bin/ameba': No such file or directory (File::NotFoundError)
Postinstall of ameba: make bin && make run_file (skipped)
  from /crystal/src/crystal/system/file.cr:7:7 in 'new'
  from /crystal/src/file.cr:627:12 in 'install_executables'
  from /shards/src/commands/install.cr:78:11 in 'run:ignore_crystal_version'
  from /shards/src/cli.cr:100:9 in '->'
  from /crystal/src/primitives.cr:255:3 in 'parse'
  from /shards/src/cli.cr:145:3 in '__crystal_main'
  from /crystal/src/crystal/main.cr:110:5 in 'main'
  from src/env/__libc_start_main.c:94:2 in 'libc_start_main_stage2'
Error: Process completed with exit code 1.
  • MacOS:
Run shards install --ignore-crystal-version --skip-postinstall
Resolving dependencies
Fetching https://github.com/stumpycr/stumpy_png.git
Fetching https://github.com/stumpycr/stumpy_bmp.git
Fetching https://github.com/crystal-ameba/ameba.git
Fetching https://gitlab.com/arctic-fox/spectator.git
Fetching https://github.com/askn/faker.git
Fetching https://github.com/crystal-community/hardware.git
Fetching https://github.com/stumpycr/stumpy_core.git
Installing stumpy_core (1.9.1)
Installing stumpy_png (5.0.1)
Installing stumpy_bmp (0.2.0)
Installing ameba (0.14.3)
Unhandled exception: Error opening file with mode 'r': '/Users/runner/work/crystal_ray_tracer/crystal_ray_tracer/lib/ameba/bin/ameba': No such file or directory (File::NotFoundError)
Postinstall of ameba: make bin && make run_file (skipped)
  from raise<File::Error+>:NoReturn
  from File::new<String, String, File::Permissions, Nil, Nil>:File
  from Shards::Package#install_executables:Nil
  from Shards::Commands::Install@Shards::Command::run:ignore_crystal_version<String, Bool>:(Array(Log::Entry) | Channel(Tuple(Log::Entry, Log::Backend+)) | IO+ | Nil)
  from ~procProc(Array(String), Array(String), Nil)@src/cli.cr:52
  from OptionParser#parse<Array(String)>:Nil
  from __crystal_main
  from main
Error: Process completed with exit code 1.
  • Windows:
Run shards install --ignore-crystal-version --skip-postinstall
Resolving dependencies
Fetching https://github.com/stumpycr/stumpy_png.git
Fetching https://github.com/stumpycr/stumpy_bmp.git
Fetching https://github.com/crystal-ameba/ameba.git
Fetching https://gitlab.com/arctic-fox/spectator.git
Fetching https://github.com/askn/faker.git
Fetching https://github.com/crystal-community/hardware.git
Fetching https://github.com/stumpycr/stumpy_core.git
Installing stumpy_core (1.9.1)
Installing stumpy_png (5.0.1)
Installing stumpy_bmp (0.2.0)
Installing ameba (0.14.3)
Postinstall of ameba: make bin && make run_file (skipped)
Unhandled exception: Error opening file with mode 'r': 'D:\\a\\crystal_ray_tracer\\crystal_ray_tracer\\lib\\ameba\\bin\\ameba.exe': No such file or directory (File::NotFoundError)
Error: Process completed with exit code 1.

@straight-shoota
Copy link
Contributor

straight-shoota commented Apr 23, 2021

Oh, that looks like a shards bug. --skip-postinstall should probably skip installing executables, too.

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

No branches or pull requests

3 participants