Hi,I've gotten Tup to work on 64bit Windows, even loading 32 bit applications.It is not a very elegant solution, but it works.
The reason 64bit loading on 64bit windows and 32bit loading on 32bit windows is straight forward is that Windows maps the kernel32.dll at the same address for all processes (until next reboot). So Tup can check what addresses the LoadLibraryA and GetProcAddress functions in that dll is and know that it will be the same for newly created processes, construct a small assembly stub and inject this into the new process forcing the new process to load the Tup dll using those function addresses.This changes when loading 32 bits processes from a 64bit Tup. The way I found the 32bit addresses from the 64bit version of Tup, was to have a small program, compiled as 32bit, print them out. So when the 64bit tup needs to start a 32bit program, it first starts the small 32bit program and store the 32bit addresses to the functions in kernel32.dll. These are then used to load the 32bit version of the Tup dll.Thus the 64bit version of Tup needs both the 32bit and 64bit version of the DLL, if both types of programs are to be started from Tup.
One caveat I haven't figured out yet is command chaining. (i.e. "cmd1 && cmd2") Tup encapsulates command chanining on Windows in a cmd.exe wrapper. But cmd.exe on 64bit Windows seems reluctant to injection, or would need some special handling. I have noticed that the process version for cmd.exe differs from the other 64bit applications, but according to documentation I have read this should only pertain to an extra MSDOS header saying that this application cannot run on ms-dos...I solved this by having a python script handing command chaining with Popen for now.
One caveat I haven't figured out yet is command chaining. (i.e. "cmd1 && cmd2") Tup encapsulates command chanining on Windows in a cmd.exe wrapper. But cmd.exe on 64bit Windows seems reluctant to injection, or would need some special handling. I have noticed that the process version for cmd.exe differs from the other 64bit applications, but according to documentation I have read this should only pertain to an extra MSDOS header saying that this application cannot run on ms-dos...I solved this by having a python script handing command chaining with Popen for now.I run my tests on a 64-bit Windows 7 VM, but even there it seems cmd.exe is a 32-bit program. Is this the case on your machine as well? Are you loading the 32-bit DLL for it? Maybe it has something to do with the WoW64 layer?
I don't know if we need cmd.exe specifically, but we do need some way to support &&, ||, and the redirection operators < and >. Those are the cases where tup automatically adds cmd.exe into the mix. Can you explain a bit what the python script does? Is that effectively a mini-shell.py?
Let me know if you want to get this in the tree - I would need a license agreement (here: http://gittup.org/tup/icla.txt ) and of course a patch or github repo somewhere :)
Hi Mike,Sorry for the late reply, beeing swamped with work here. We are currently porting our old makefile system to tup, for an operating system and all its applications. And unfortunately half our developers are on FreeBsd and half on Windows 8, so have taken some time porting all the tools. Just finished the auto-tools last night (generate tupfiles etc.). So we are switching today :)
One caveat I haven't figured out yet is command chaining. (i.e. "cmd1 && cmd2") Tup encapsulates command chanining on Windows in a cmd.exe wrapper. But cmd.exe on 64bit Windows seems reluctant to injection, or would need some special handling. I have noticed that the process version for cmd.exe differs from the other 64bit applications, but according to documentation I have read this should only pertain to an extra MSDOS header saying that this application cannot run on ms-dos...I solved this by having a python script handing command chaining with Popen for now.I run my tests on a 64-bit Windows 7 VM, but even there it seems cmd.exe is a 32-bit program. Is this the case on your machine as well? Are you loading the 32-bit DLL for it? Maybe it has something to do with the WoW64 layer?
We are running on Windows 8, and here cmd.exe is 64 bit. But the file format is "pei-x86-64", not "pe-x86-64" as is the case for the 64bit applications that work. I will investigate more when I get around.
Let me know if you want to get this in the tree - I would need a license agreement (here: http://gittup.org/tup/icla.txt ) and of course a patch or github repo somewhere :)
Yes, have to clean up the code a bit first, and fix the agreement and github repo.
~/tup64$ cat tup.config
CONFIG_TUP_MINGW=x86_64-w64-mingw32
--
--
tup-users mailing list
email: tup-...@googlegroups.com
unsubscribe: tup-users+...@googlegroups.com
options: http://groups.google.com/group/tup-users?hl=en
---
You received this message because you are subscribed to the Google Groups "tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tup-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I have tried building myself with mingw-w64 + the patch above and also built vanilla tup with i686-w64-mingw32. Also tried with the binaries attached earlier in this thread and with the ones provided from http://gittup.org/tup/. Nothing works. I found that I get different errors depending on which command I test with, copy or xcopy. I have also tried cl and even gcc. That's were I started but when I ran into errors I tried to make it as simple as possible.Most likely I made some simple mistake but I can't find it so I think I have to give up and find something else to use other than tup. It bugs me since tup is what I want to use but Windows support is a deal breaker for me.
--
--
tup-users mailing list
email: tup-...@googlegroups.com
unsubscribe: tup-users+...@googlegroups.com
options: http://groups.google.com/group/tup-users?hl=en
---
You received this message because you are subscribed to the Google Groups "tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tup-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Just to clarify - standard binaries from the website work on Windows as long as the application being run is 32-bit. System can be 64-bit. I'm using tup for over a year on Windows 7 64-bit with gcc.
Regards,
FCh
#include <windows.h>
int main(int argc, char** argv)
{
int ll = (int) LoadLibraryA;
int gpa = (int) GetProcAddress;
printf("%x-%x\n", ll, gpa);
ExitProcess(0);
}
CONFIG_TUP_MINGW=x86_64-w64-mingw32
--
* 1) cmd /C gcc -c -o test.o test.c
*** tup errors ***
tup error: Expected to write to file 'test.o' from cmd 20 but didn't
DEBUG_HOOK("%s is WOW64: %i\n", GetCommandLineA(), bWow64);
TCHAR buffer[1024];
if (GetModuleFileNameEx(lpProcessInformation->hProcess,0,buffer,1024)){
DEBUG_HOOK("Executable: %s\n", buffer);
}
3) You are right, compiling with the 64bit compiler with the -m32 flag seem to produce the expected output.