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

x/mobile: binding doens't seem to reuse build cache for modules #37902

karalabe opened this issue Mar 17, 2020 · 2 comments

x/mobile: binding doens't seem to reuse build cache for modules #37902

karalabe opened this issue Mar 17, 2020 · 2 comments


Copy link

@karalabe karalabe commented Mar 17, 2020

Apologies for not adhering to the default issue template, the issue is not a "bug" per se and not an issue with Go itself, so all those version and env infos would be useless.

gomobile added module support recently, which works spectacularly. One thing, however, that I did notice, is that if I call gomobile bind on a package that has heavy dependencies, those get rebuilt from scratch for every build, making the build very painful.

E.g. Binding will take 30 mins as it needs to build a dependent package that contains a huge C library (Tor). However, trying to call bind again with zero modifications will again take 30 mins. This is in contrast with building simply with Go locally, which will take 5 mins for the first run, but will be ~instantaneous afterwards (only link time is left).

My best guess until now is that gomobile bind creates its own temporary working directory /tmp/gomobile-work-xxxxxxxx and thus all code operations are short circuited into that folder, away from the system caches. This results in all object files produced by one build run to be deleted at the end.

Issue opened per @hajimehoshi 's request in #27234 (comment).

Continuing a thread from the above issue:

Aha, gobind, which is invoked by gomobile, generates a source code from Go packages for binding, and they are not cached indeed. Did you mean 'cache' of them?

No, I'm not referring to caching the generated files, rather the module dependencies of them, which should most definitely be cacheable.

Copy link

@hajimehoshi hajimehoshi commented Mar 17, 2020

Copy link

@MariusVanDerWijden MariusVanDerWijden commented Apr 29, 2020

The temporary directory is created in the following line:
Maybe you could add a flag that allows to change this line to an existing directory e.g.
gomobile bind -dep /home/user/mobile-deps

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

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.