Statically building LXD

@stgraber thanks for your detailed answer, again. Yeah it definitely doesn’t make sense to ask you guys to switch to rewrite the entire runtime code in pure go, I definitely wouldn’t be so selfish as to ask something like that – I was more wondering if it would be pointless to go off and try something myself. Looking at the binding (https://github.com/lxc/go-lxc/blob/v2/lxc-binding.go), the amount of work doesn’t seem insurmountable but obviously would take a very long time to actually get right.

I’m a bit past my knowledge/comfort zone, but do you think it would be possible to statically compile the LXC shared libraries? LXC is supported on alpine which is what gives me hope, as that means it must have been compiled with musl libc, which is a lot more amenable to static compilation.

From the discussion so far it seems like what I should be trying to do is statically compile go-lxc on something like Alpine and then seeing if it could be used at all from container linux, then go about finding a way to use it as a static library in lxd’s compilation.

[EDIT] - thinking about it, I will also try to run lxd from a privileged container and see if that works. I think I’ve tried it before and it didn’t but maybe I didn’t try hard enough