-
Notifications
You must be signed in to change notification settings - Fork 104
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
make: fix possible PATH issues #1630
make: fix possible PATH issues #1630
Conversation
Makefile.defs
Outdated
else | ||
SHARED_STL_LIB:=$(shell PATH='$(PATH)' $(CC) -print-file-name=libstdc++.so.6) | ||
endif | ||
# TODO: Detect/support libc++ Clang TCs? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some make nastiness for that, FWIW.
(Probably ripped inspired from Linux's makefiles, IIRC).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it (assuming it works ;p).
Oh, boy… I'm afraid to look at those logs. |
Of course, can't check if one those |
7105cb6
to
0731f6e
Compare
Sloppy it is, then. |
Re-reading the docs (without testing anything so far), I'm mildly confused by all those existing shell + PATH hacks: the shell function is already supposed to pickup the env (and exported variables), and the only thing that actually updates PATH inside the makefiles is the Android stuff (... at least in base, the front one doesn't use export, which is either an oversight or I'm on not on the latest code). |
I know! ¯\(ツ)/¯ But I can reproduce it when running the android docker image locally… |
Yeah, the front one was broken before, but is entirely gone after koreader/koreader@3ac8a67, and it's required by the |
Is the Android TC perhaps already in your PATH in that environment? |
Which would explain https://github.com/koreader/koreader/blob/3ac8a67c6d39ce09f0cdbdfface63498857a6f22/Makefile#L34 successfully picking up the compiler on your end and not in the CI? |
Nope. And no |
Oh, wait, I misread
as cannot reproduce, oops. :D. |
And when compiling with my local environment, the android toolchain is not in the |
A (very) quick SO search seems to imply it's 4.2+, yeah :/. (.SHELLSTATUS support, I mean). |
Yeah, I hate that the make documentation does not mention the version that first introduced a feature… |
If all else fails, I'd try removing all the explicit PATH= hacks inside shell calls (and hope make is actually working as advertised on that front), but restoring an export PATH assignment in an Android branch in front ahead of the MACHINE assignment. |
Extremely sneaky but stupid idea: do you have a PATH variable set in your environment (like, at all)? |
But we already do set |
Yes. |
Which makefile are we talking about here? ^^
Does it work with PATH entirely unset and gone from the env? |
I've not checked, but the nightly build script does set |
Possibly related (or not, I can never grok how the fuck these assignments differ in practice), but |
I don't recall if the front CI does, though. |
From TARGET_MARCHINE. :P |
Oh, true, but I have an inkling it might the front one failing: https://github.com/koreader/koreader/blob/3ac8a67c6d39ce09f0cdbdfface63498857a6f22/Makefile#L34 (And I'm not sure if it isn't actually assigned before the base includes (with its proper PATH export) gets processed, because make is weird or something). |
Why are we duplicating those variables? It's still done after including |
Yeah, see my edits above, that's what I'm not sure on because of the seven billion ways there are to assign variables in make, I'm not sure the sensible thing is actually what's happening here... |
Since it's set with |
We can't guarantee that That would both explain the weird duplication, and the silently-failing include ( |
(I may have lost the plot a little, it's 2AM, sorry if I'm making less and less sense ;p) |
It's definitively an issue with older make versions: ▸ env PATH=/bin:/usr/bin make41 -f - <<\EOF
export PATH=/pouet:/bin:/usr/bin
$(error $(shell echo "$$PATH"))
EOF
/tmp/Gm4xFbl8:2: *** /bin:/usr/bin. Stop.
▸ env PATH=/bin:/usr/bin make43 -f - <<\EOF
export PATH=/pouet:/bin:/usr/bin
$(error $(shell echo "$$PATH"))
EOF
/tmp/Gm3Vvgp6:2: *** /bin:/usr/bin. Stop.
▸ env PATH=/bin:/usr/bin make44 -f - <<\EOF
export PATH=/pouet:/bin:/usr/bin
$(error $(shell echo "$$PATH"))
EOF
/tmp/GmGMUP9D:2: *** /pouet:/bin:/usr/bin. Stop. |
Let me amend the code / commit message to mention that. |
Ensure our possibly updated `PATH` variable is picked up by `$(shell …)` invocations when using older (<4.4) make versions.
0731f6e
to
a38818b
Compare
OK, I think this can be merged. And then bump base again, and… wait for the next nightly? |
I can't find any mention of the behavior change in the NEWS file, FWIW, yaaay -_-". |
Actually, I can, it sure helps if I look at the right version xD.
(In 4.4) |
I can and afaik only 4.4 is newer.
Edit: sorry, commented too fast. I see you figured that out too. |
Ensure our possibly updated
PATH
variable is taken into account for all$(shell …)
invocations.Additionally, add a couple of sanity checks after some of those invocations).Nope, still sloppy…This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)