Add CONFIGURATOR_WRAPPER#3464
Conversation
|
After reading the code and some old PRs some more I realize that I might have misunderstood things. Am I supposed to cross compile |
I'm not sure tbh, I think the idea behind the configurator is to determine the target architecture capabilities. Running it on the host machine is unlikely to return the correct configuration (though most archs don't differ too much afaik). I think running it with the target configuration (natively or through QEMU) is the intended use, but @rustyrussell can likely say more to this :-) |
Right, other config generators typically never run machine code for that reason. You have to use hacks, like generate compiler warnings, to figure out the capabilities of the host system. But then there needs to be some variable that specifies a wrapper with which the configuration tool should be called so that it can be run in a virtual machine. |
|
I updated this PR by adding an environment variable for wrapping the calls to I tested it like this: |
|
this didn't help much I think. Doing it like this requires a native aarch64 compiler for the configurator. |
724e734 to
d06c0f3
Compare
|
new update: Now I build the configurator like before but I added a feature to wrap every call to the test binaries that the configurator compiles. This actually successfully compiles for me and I hope this was how the configurator was meant to be used. |
|
Actually, this might not even be necessary. On modern debian (and I guess most distributions) it is actually possible to transparently run binaries for the wrong architecture. Somehow you can register with the kernel that it should launch binaries for certain architectures with qemu-static. https://wiki.debian.org/QemuUserEmulation @rustyrussell Maybe for cross-compiling on windows/osx you would still need to run the binaries with some wrapper. WDYT? |
From what I can tell, running qemu-user-static on osx is not possible. I assume qemu-user-static would work in the Windows Subsystem for Linux (WSL) on windows, but it's unclear. A docker based alternative is really useful, thanks for that. I'll give it a try soon on osx. |
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Since the probing binaries compiled by the configurator needs to run on the host machine we provide a variable CONFIGURATOR_WRAPPER that can be set to anything that you want to wrap the calls with. One example is `qemu-aarch64-static`.
af84669 to
65a72d6
Compare
|
I like this change, but I applied it to upstream (ccan/) instead, and then pulled that back in and used your ./configure patch. Will apply once Travis acks, thanks! Ack: 65a72d6 |
|
Ack 65a72d6 |
This was necessary for cross-compiling. Otherwise the configurator will be compiled for the host architecture.
Here are my scripts for cross compiling with docker, if you want to reproduce:
NickeZ/bitbox-base@cf7c4e8
Thanks