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

Ameba does not install on FreeBSD #167

Closed
ghost opened this issue Oct 16, 2020 · 5 comments
Closed

Ameba does not install on FreeBSD #167

ghost opened this issue Oct 16, 2020 · 5 comments

Comments

@ghost
Copy link

ghost commented Oct 16, 2020

Ameba's postinstall script seems to not work on FreeBSD. I initialized an empty project with crystal init app ., added the following to shard.yml:

dependencies:
  ameba:
    github: crystal-ameba/ameba

And ran shards. Error message:

Resolving dependencies
Fetching https://github.com/crystal-ameba/ameba.git
Installing ameba (0.13.2)
Postinstall of ameba: make bin && make run_file
Failed postinstall of ameba on make bin && make run_file:
build
make: exec(build) failed (No such file or directory)
*** Error code 1

Stop.
make: stopped in <project dir>/lib/ameba

This is a FreeBSD machine that has GNU make installed from packages (though I suspect the problem is that the FreeBSD package installs GNU make as gmake since make is BSD make).

@ghost
Copy link
Author

ghost commented Oct 16, 2020

The error is also produced using version: ~> 0.12.0 as mentioned in the README.

@veelenga
Copy link
Member

@yujiri8 0.12.0 in readme is a mistake, I've just corrected it. Will try to reproduce the issue with make and fix. Thanks for the heads-up

@veelenga veelenga added the bug label Oct 17, 2020
@veelenga
Copy link
Member

Hm, I thought I would be able to run FreeBSD docker container on Mac, but seems like FreeBSD containers must be run from FreeBSD hosts.

@yujiri8 I would like to ask you for helping me with this and providing a fix before I ended up running FreeBSD, on top of Vagrant, on top of macOS. Will that be possible for you?

@ghost
Copy link
Author

ghost commented Oct 24, 2020

I was right that the problem is GNU make vs BSD make. BSD make doesn't support the $(shell ) syntax for running shell commands. As far as I can tell, it only supports var != command, but that isn't the same as GNU's ?=, it's like :=. I'm not sure about a compatible alternative to ?=.

Here are some links I read:
https://www.gnu.org/software/make/manual/html_node/Setting.html
https://stackoverflow.com/questions/52912099/how-to-conditionally-assign-value-to-a-variable-in-a-makefile-bsd-gnu/52912640
https://stackoverflow.com/questions/21874468/run-a-command-in-gnu-and-bsd-makefile-and-store-the-result-into-a-variable
https://stackoverflow.com/questions/2019989/how-to-assign-the-output-of-a-command-to-a-makefile-variable

Ugghhhh this is why I hate make...

This was referenced Apr 3, 2021
@straight-shoota
Copy link
Contributor

straight-shoota commented Apr 3, 2021

The best solution, in general, is to just use GNU make on FreeBSD (see #221 (comment)).
For a postinstall hook that might not be feasible, though. But it probably shouldn't need a makefile recipe. A simple, portable build script would do. In the end, it's just a shards build command.

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

Successfully merging a pull request may close this issue.

2 participants