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

Makefile: make sure the meteor bundle is present before running ekam. #3361

Closed
wants to merge 1 commit into from

Conversation

zenhack
Copy link
Collaborator

@zenhack zenhack commented Jun 8, 2020

Otherwise building node-capnp fails if the user has never run meteor,
due to not being able to find the development headers. This doesn't
trigger if the build is run as the same user that ran meteor's
curl ... | sh installer, which is why we haven't previously noticed
it.

Note that if the bundle is not present ./find-meteor-dev-bundle.sh will
pull it in, but although we define a variable in terms of this at the
top of the Makefile, its value is computed lazily, so it will not be run
until it is actually needed.

It might work to just use := instead of = when assigning the variable,
but conceptually having the build process depend on node seems like the
right thing (and it should also ensure a rebuild if the version of
node/the bundle is updated).

Fixes #3360

Otherwise building node-capnp fails if the user has never run `meteor`,
due to not being able to find the development headers. This doesn't
trigger if the build is run as the same user that ran meteor's
`curl ... | sh` installer, which is why we haven't previously noticed
it.

Note that if the bundle is not present ./find-meteor-dev-bundle.sh will
pull it in, but although we define a variable in terms of this at the
top of the Makefile, its value is computed lazily, so it will not be run
until it is actually needed.

It might work to just use := instead of = when assigning the variable,
but conceptually having the build process depend on node seems like the
right thing (and it should also ensure a rebuild if the version of
node/the bundle is updated).

Fixes sandstorm-io#3360
@ocdtrekkie ocdtrekkie added ready-for-review We think this is ready for review sandstorm-dev Issues hacking on Sandstorm labels Jun 8, 2020
@kentonv
Copy link
Member

kentonv commented Jun 11, 2020

Note that if the bundle is not present ./find-meteor-dev-bundle.sh will pull it in

Hmm, I don't think that's correct. find-meteor-dev-bundle.sh seems to fail with no output (on stdout) if the bundle isn't found. Unfortunately make ignores the failure in the context of initializing a variable. There's no code in find-meteor-dev-bundle.sh which would install meteor (or a specific version of meteor) if it's missing. Maybe there should be? Though installing meteor as a build step might disturb some people.

although we define a variable in terms of this at the top of the Makefile, its value is computed lazily

TIL make doesn't evaluate a variable until it runs a rule that references the variable (though it does seem to evaluate the variable before executing any lines of the rule, even if the variable is not referenced until later on).

That said, I don't think that's the issue here. $(NODEJS) is referenced before executing Ekam.

I think your change has the effect that if meteor is not installed, then tmp/.ekam-run ends up listing /bin/node as a dependency. /bin/node doesn't exist on most systems, but in theory it could, which would lead to some confusion here.

What we really want is that if find-meteor-dev-bundle.sh fails, make should fail. Maybe the answer is to change the definition of `METEOR_DEV_BUNDLE to:

METEOR_DEV_BUNDLE=$$(./find-meteor-dev-bundle.sh)

This would have the effect that find-meteor-dev-bundle.sh is executed just-in-time every place where METEOR_DEV_BUNDLE (or any downstream variable) is referenced in a command. That is probably fine since it caches its result anyway.

@kentonv
Copy link
Member

kentonv commented Jun 11, 2020

Actually that won't work either, because a failure inside $() doesn't propagate to the outer shell.

$ echo $(false)

$ echo $?
0

Ugh.

@ocdtrekkie ocdtrekkie removed the ready-for-review We think this is ready for review label Jun 11, 2020
@zenhack
Copy link
Collaborator Author

zenhack commented Jun 11, 2020

Hm, and now this patch doesn't actually cause it to error out early for me anymore; not sure what I was doing differently before.

In any case it looks like you're right; the problem is that we're ignoring the failure from that script entirely. Closing, since this is the wrong solution.

@zenhack zenhack closed this Jun 11, 2020
@zenhack
Copy link
Collaborator Author

zenhack commented Jun 11, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sandstorm-dev Issues hacking on Sandstorm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build Error: installing from source on ubuntu
3 participants