gittup / tup

Tup is a file-based build system.
http://gittup.org/tup/
GNU General Public License v2.0
1.18k stars 145 forks source link

Linux executable build on Windows via WSL1 not detected as output #487

Open ompadu opened 10 months ago

ompadu commented 10 months ago

Hello,

I am using the following Lua rule on Windows to successfully build a Linux executable:

tup.definerule{ inputs = {'source/main.c'}, command = 'wsl clang %f -o %o', outputs = {'build/hello'} }

Even though the file is produced at the expected path and it runs under WSL1 as expected, tup throws the following error:

0) wsl clang source/main.c -o build/hello
 *** tup messages ***
tup error: Expected to write to file 'build/hello' from cmd 48 but didn't
 *** Command failed due to errors processing the output dependencies.

Maybe there's something up with elf executable detection?

gittup commented 8 months ago

I ran a wsl clang ... command on the command-line manually with Process Monitor enabled. It looks like the actual writes to the output file come from DllHost.exe, which is already running before tup executes anything (so, DllHost.exe is not a subprocess of wsl or clang, so tup can't do it's DLL injection to it in order to see file reads/writes). I guess when you run wsl the subcommands go through some service rather than doing the work themselves?

What is the benefit you are looking for to run clang through wsl instead of natively on Windows? Or, why not use tup inside wsl and then use the Linux subsystem's clang directly?