| Summary: | Can't run scripts on Windows | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Doug Schaefer <cdtdoug> |
| Component: | Autotools | Assignee: | Jeff Johnston <jjohnstn> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | 0.8.0 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Doug Schaefer
(In reply to comment #0) > I tried autotools on Windows using MinGW. All the required tools seem to be > available there so it should work. > > However, as I found out with other projects, you can't run scripts directly on > Windows. You need to wrap the calls with a call to the shell, e.g. using 'sh > -c'. (I had to do this with Android and the call to the ndk-build script). I > would do this only if the Platform.getOS was win32 and leave it normal for the > rest of the platforms. We do wrap the configure and autogen.sh script with "sh" as part of a fix suggested by a Windows user. So the -c also required? I take it you were just trying to run the build and the configure step failed or were you trying another command? I got a autoreconf command not found when creating the project. I've checked out the source and I'll see if I can get it working. Thanks! BTW, the other problem could be the environment passed down to these commands. I have the path to MSYS/MinGW in my Build environment settings. I generally have multiple toolchains installed on my machine so I don't put these in my main Windows environment. OK. I got it working. Yes, you need to run the shell command as sh -c <cmd>. Here's a snippet I used:
if (Platform.getOS().equals(Platform.OS_WIN32)
|| Platform.getOS().equals(Platform.OS_MACOSX)) {
// Neither Mac or Windows support calling scripts directly.
String command = null;
for (String arg : configTargets) {
// TODO check for spaces in args
if (command == null)
command = arg;
else
command += " " + arg;
}
configTargets = new String[] { "-c", command };
}
I also noticed you have runScript, which runs configure, and runCommand, which ran autoreconf. autoreconf is a script, no?
I ran into a couple of other problems that I'll raise bugs for as well.
(In reply to comment #4) > OK. I got it working. Yes, you need to run the shell command as sh -c <cmd>. > Here's a snippet I used: > > if (Platform.getOS().equals(Platform.OS_WIN32) > || Platform.getOS().equals(Platform.OS_MACOSX)) { > // Neither Mac or Windows support calling scripts directly. > String command = null; > for (String arg : configTargets) { > // TODO check for spaces in args > if (command == null) > command = arg; > else > command += " " + arg; > } > configTargets = new String[] { "-c", command }; > } > > I also noticed you have runScript, which runs configure, and runCommand, which > ran autoreconf. autoreconf is a script, no? > > I ran into a couple of other problems that I'll raise bugs for as well. Thanks Doug. Patch has been applied and I changed autoreconf to use runScript as well. This still leaves the various autotool commands run from the Project Menu which are run directly but that should be a separate bug. |