RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.25k stars 1.25k forks source link

re-enable support on windows platforms #42

Closed RussTedrake closed 10 years ago

RussTedrake commented 10 years ago

FYI - I am looking into this. Most things appear to work via cygwin, but the windows version of matlab appears to not support the "-n" command line option, which I was relying on to extract the mex configuration for building directly from cmake. I have contacted mathworks to see if there is a reasonable alternative.

Note that I did have to manually install java's jdk and manually add the matlab/bin directory and jdk directories to my path. I also manually installed the Microsoft SDK 7.1 since I didn't have another matlab supported compiler installed yet.

Note: do not install cmake from cygwin. install it separately (see below). Note: do install git from cygwin, not separately.

RussTedrake commented 10 years ago

I'm past the matlab -n issues (resolved most by using mex -v instead), and have been robustifying the prereq installs with cygwin. The current problem is getting cygwin's cmake to recognize the Windows SDK compiler (since matlab on windows doesn't know how to use gcc, etc). It seems that vsvars32.bat (and vcvars32.bat) are broken as the SDK installer didn't properly set the registry variables. My next goal is to get cl.exe to run cleanly from the cygwin shell (right now it errors out because it can't find the shared libraries).

This is turning into enough of a pain that I think releasing a pre-compiled version for windows is probably the most reasonable approach.

RussTedrake commented 10 years ago

Got autoconf (in the lcm dir) working with the microsoft sdk (but it was a pain). Cmake still complains.

I first had to add the missing registry entry to get vsvars32.bat (or vcvars32.bat) to run. I did it manually with regedit, but something like this should have worked, if I could run it with proper priviledges:

reg add "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "10.0" /t REG_SZ /d "C:\Program Files (x86)\Microsoft Visual Studio 10.0\"
reg add "HKLM\SOFTWARE\Microsoft\MicrosoftSDKs\Windows\v7.0A" /v "InstallationFolder" /t REG_SZ /d "C:\Program Files\Microsoft SDKs\Windows\v7.1\"

then I modified my c:\cygwin64\cygwin.bat file to read

@echo off

C:
chdir C:\cygwin64\bin
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat" > NUL:
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" > NUL:

start mintty.exe c:\cygwin64\bin\bash --login -i

and changed the cygwin desktop icon to call cygwin.bat instead of mintty.exe directly.

Next steps :

RussTedrake commented 10 years ago

wow. just found out that i can't use the cygwin cmake: https://www.mail-archive.com/cmake@cmake.org/msg14286.html installing cmake manually fixed it.

RussTedrake commented 10 years ago

Still unresolved:

RussTedrake commented 10 years ago

precompiled distro almost works. not surprisingly, i have a few global path references baked in: addpath_spotless (and spotless_manifest.txt looks a little broken). the lcm java files also didn't load on this machine, but it could be a 32-bit vs 64-bit issue.

JavadHasaneini commented 10 years ago

Russ, this is scary and almost impossible for me to follow! I agree with you that "a pre-compiled version for windows is probably the most reasonable approach."

RussTedrake commented 10 years ago

Resolved cmake install path (by cleaning up build prefix using cygpath). Resolved absolute filepaths in addpath_spotless.
Cleaned up release zip files (dramatically). Should have a functional release .zip now. Will test on the work machine. Still need to:

Getting close...

RussTedrake commented 10 years ago

tested zip install on my windows install at work. it was somehow missing some important files: drake/addpath_drake.m checkDependency.m SecondOrderSystem.m CoordinateFrame.m (and presumably many others)

also, my relative path solution for spotless wasn't sufficient. need to get rid of spotless/spot_install_manifest.txt , and just write the manifest into the addpath_spotless (using the relative paths). but after running spot_install manually.... and downloading some of the essential missing files, it looks like I am in business.

will update the missing files, etc from my home machine tonight, and should have a zip download ready late tonight or tomorrow morning.

RussTedrake commented 10 years ago

resolved global paths in addpath_spotless and addpath_drake. added logic so that make calls the cmake_make_program to do the actual build (resolve nmake issue) resolved missing files. my grep -v used . without escaping it.

RussTedrake commented 10 years ago

Ok. I've posted a precompiled release for windows that looks like it should work: https://github.com/RobotLocomotion/drake-distro/releases/tag/0.9.0

to use:

RussTedrake commented 10 years ago

I just verified that the 0.9.0alpha release worked fine on my work laptop (which did not build the system). Hoorah!

JavadHasaneini commented 10 years ago

Russ,

YES it worked! Thanks a lot.

I also tried to run "runAllTests.m". It gave the following results:

runAllTests crawling E:\Software\Drake\drake crawling E:\Software\Drake\drake\solvers crawling E:\Software\Drake\drake\solvers\test gloptipoly_constrained_test Gloptipoly3 not found.

Warning: Cannot find required dependency: gloptipoly3

In unitTest>runTest at 670 In unitTest>runCommandLineTest at 581 In unitTest>crawlDir at 436 In unitTest>crawlDir at 383 In unitTest>crawlDir at 357 In unitTest at 110 In runAllTests at 5 [PASSED] sixHumpCamel SNOPT not found. SNOPT support will be disabled. To re-enable, add the SNOPT matlab folder to your path and rerun addpath_drake. SNOPT can be obtained from https://tig.csail.mit.edu/software/ .

Warning: Cannot find required dependency: snopt

In unitTest>runTest at 670 In unitTest>runCommandLineTest at 581 In unitTest>crawlDir at 436 In unitTest>crawlDir at 383 In unitTest>crawlDir at 357 In unitTest at 110 In runAllTests at 5 [PASSED] testQP **** min_x (.5_x'_A*x + x)


 solver        objval        exitflag   execution time

Warning: Your current settings will run a different algorithm (interior-point-convex) in a future release. In quadprog at 375 In QuadraticProgram>QuadraticProgram.solve at 61 In NonlinearProgram>NonlinearProgram.compareSolvers at 199 In QuadraticProgram>QuadraticProgram.compareSolvers at 98 In testQP>testSolvers at 31 In testQP at 10 In unitTest>feval_in_contained_workspace at 742 In unitTest>runTest at 660 In unitTest>runCommandLineTest at 581 In unitTest>crawlDir at 436 In unitTest>crawlDir at 383 In unitTest>crawlDir at 357 In unitTest at 110 In runAllTests at 5 quadprog -1.418 1 1.0059

GUROBI not found. GUROBI support will be disabled. To enable, install GUROBI and a free academic license from http://www.gurobi.com/download/licenses/free-academic . Then, you will need to set several environment variables. Please see http://drake.mit.edu/quickstart for more info.

GUROBI MEX not found. GUROBI MEX support will be disabled. To enable, install the GUROBI pod in your pod collection, and rerun make config; make in drake

GUROBI MEX not found. GUROBI MEX support will be disabled. To enable, install the GUROBI pod in your pod collection, and rerun make config; make in drake

SNOPT not found. SNOPT support will be disabled. To re-enable, add the SNOPT matlab folder to your path and rerun addpath_drake. SNOPT can be obtained from https://tig.csail.mit.edu/software/ .

.....

Javad Hasaneini Postdoctoral Associate Cornell University

On 04/03/2014 12:38 PM, RussTedrake wrote:

I just verified that the 0.9.0alpha release worked fine on my work laptop (which did not build the system). Hoorah!

— Reply to this email directly or view it on GitHub https://github.com/RobotLocomotion/drake/issues/42#issuecomment-36664703.

RussTedrake commented 10 years ago

excellent! here is a replacement checkDependency.m which I believe will fix it for you. if you like, you can restore your original addpath_drake (uncomment the line), and replace your drake/util/checkDependency.m with this file. https://raw.github.com/RussTedrake/drake/windows/util/checkDependency.m

On Mar 4, 2014, at 2:56 PM, Javad notifications@github.com wrote:

Russ,

YES it worked! Thanks a lot.

I also tried to run "runAllTests.m". It gave the following results:

runAllTests crawling E:\Software\Drake\drake crawling E:\Software\Drake\drake\solvers crawling E:\Software\Drake\drake\solvers\test gloptipoly_constrained_test Gloptipoly3 not found.

Warning: Cannot find required dependency: gloptipoly3

In unitTest>runTest at 670 In unitTest>runCommandLineTest at 581 In unitTest>crawlDir at 436 In unitTest>crawlDir at 383 In unitTest>crawlDir at 357 In unitTest at 110 In runAllTests at 5 [PASSED] sixHumpCamel SNOPT not found. SNOPT support will be disabled. To re-enable, add the SNOPT matlab folder to your path and rerun addpath_drake. SNOPT can be obtained from https://tig.csail.mit.edu/software/ .

Warning: Cannot find required dependency: snopt

In unitTest>runTest at 670 In unitTest>runCommandLineTest at 581 In unitTest>crawlDir at 436 In unitTest>crawlDir at 383 In unitTest>crawlDir at 357 In unitTest at 110 In runAllTests at 5 [PASSED] testQP **** min_x (.5_x'_A*x + x)


solver objval exitflag execution time

Warning: Your current settings will run a different algorithm (interior-point-convex) in a future release. In quadprog at 375 In QuadraticProgram>QuadraticProgram.solve at 61 In NonlinearProgram>NonlinearProgram.compareSolvers at 199 In QuadraticProgram>QuadraticProgram.compareSolvers at 98 In testQP>testSolvers at 31 In testQP at 10 In unitTest>feval_in_contained_workspace at 742 In unitTest>runTest at 660 In unitTest>runCommandLineTest at 581 In unitTest>crawlDir at 436 In unitTest>crawlDir at 383 In unitTest>crawlDir at 357 In unitTest at 110 In runAllTests at 5 quadprog -1.418 1 1.0059

GUROBI not found. GUROBI support will be disabled. To enable, install GUROBI and a free academic license from http://www.gurobi.com/download/licenses/free-academic . Then, you will need to set several environment variables. Please see http://drake.mit.edu/quickstart for more info.

GUROBI MEX not found. GUROBI MEX support will be disabled. To enable, install the GUROBI pod in your pod collection, and rerun make config; make in drake

GUROBI MEX not found. GUROBI MEX support will be disabled. To enable, install the GUROBI pod in your pod collection, and rerun make config; make in drake

SNOPT not found. SNOPT support will be disabled. To re-enable, add the SNOPT matlab folder to your path and rerun addpath_drake. SNOPT can be obtained from https://tig.csail.mit.edu/software/ .

.....

Javad Hasaneini Postdoctoral Associate Cornell University

On 04/03/2014 12:38 PM, RussTedrake wrote:

I just verified that the 0.9.0alpha release worked fine on my work laptop (which did not build the system). Hoorah!

— Reply to this email directly or view it on GitHub https://github.com/RobotLocomotion/drake/issues/42#issuecomment-36664703.

— Reply to this email directly or view it on GitHub.

JavadHasaneini commented 10 years ago

Which file? (link? attachment?)

On 04/03/2014 12:58 PM, RussTedrake wrote:

excellent! here is a replacement checkDependency.m which I believe will fix it for you. if you like, you can restore your original addpath_drake (uncomment the line), and replace your drake/util/checkDependency.m with this file.

  • Russ

On Mar 4, 2014, at 2:56 PM, Javad notifications@github.com wrote:

Russ,

YES it worked! Thanks a lot.

I also tried to run "runAllTests.m". It gave the following results:

runAllTests crawling E:\Software\Drake\drake crawling E:\Software\Drake\drake\solvers crawling E:\Software\Drake\drake\solvers\test gloptipoly_constrained_test Gloptipoly3 not found.

Warning: Cannot find required dependency: gloptipoly3

In unitTest>runTest at 670 In unitTest>runCommandLineTest at 581 In unitTest>crawlDir at 436 In unitTest>crawlDir at 383 In unitTest>crawlDir at 357 In unitTest at 110 In runAllTests at 5 [PASSED] sixHumpCamel SNOPT not found. SNOPT support will be disabled. To re-enable, add the SNOPT matlab folder to your path and rerun addpath_drake. SNOPT can be obtained from https://tig.csail.mit.edu/software/ .

Warning: Cannot find required dependency: snopt

In unitTest>runTest at 670 In unitTest>runCommandLineTest at 581 In unitTest>crawlDir at 436 In unitTest>crawlDir at 383 In unitTest>crawlDir at 357 In unitTest at 110 In runAllTests at 5 [PASSED] testQP **** min_x (.5_x'_A*x + x)


solver objval exitflag execution time

Warning: Your current settings will run a different algorithm (interior-point-convex) in a future release. In quadprog at 375 In QuadraticProgram>QuadraticProgram.solve at 61 In NonlinearProgram>NonlinearProgram.compareSolvers at 199 In QuadraticProgram>QuadraticProgram.compareSolvers at 98 In testQP>testSolvers at 31 In testQP at 10 In unitTest>feval_in_contained_workspace at 742 In unitTest>runTest at 660 In unitTest>runCommandLineTest at 581 In unitTest>crawlDir at 436 In unitTest>crawlDir at 383 In unitTest>crawlDir at 357 In unitTest at 110 In runAllTests at 5 quadprog -1.418 1 1.0059

GUROBI not found. GUROBI support will be disabled. To enable, install GUROBI and a free academic license from http://www.gurobi.com/download/licenses/free-academic . Then, you will need to set several environment variables. Please see http://drake.mit.edu/quickstart for more info.

GUROBI MEX not found. GUROBI MEX support will be disabled. To enable, install the GUROBI pod in your pod collection, and rerun make config; make in drake

GUROBI MEX not found. GUROBI MEX support will be disabled. To enable, install the GUROBI pod in your pod collection, and rerun make config; make in drake

SNOPT not found. SNOPT support will be disabled. To re-enable, add the SNOPT matlab folder to your path and rerun addpath_drake. SNOPT can be obtained from https://tig.csail.mit.edu/software/ .

.....

Javad Hasaneini Postdoctoral Associate Cornell University

On 04/03/2014 12:38 PM, RussTedrake wrote:

I just verified that the 0.9.0alpha release worked fine on my work laptop (which did not build the system). Hoorah!

— Reply to this email directly or view it on GitHub

https://github.com/RobotLocomotion/drake/issues/42#issuecomment-36664703.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/RobotLocomotion/drake/issues/42#issuecomment-36666958.

RussTedrake commented 10 years ago

i've posted a new release with the updated checkDependency.m https://github.com/RobotLocomotion/drake-distro/releases/tag/0.9.0alpha

also resolved the file permissions issue on my local build. but still have a linking issue. it looks like the mex compile flags are not being passed through to cl.exe. helpful for debugging (to be run from drake) % make clean; make configure; cd pod-build && nmake VERBOSE=1 | grep -A 5 cl.exe

JavadHasaneini commented 10 years ago

Russ,

I have the Simulink 3D Animation Toolbox installed in my machine but it seems that drake cannot find it and gives warning messages.

Javad

RussTedrake commented 10 years ago

it works fine for me. have you run vrinstall in matlab?
(i've edited checkDependency to give a more useful warning)

JavadHasaneini commented 10 years ago

Excellent troubleshooting!

I ran "vrinstall -install editor" and it worked!

Thanks, Javad

RussTedrake commented 10 years ago

Just so I don't forget. I lost an hour or two the other day because cmake's nmake generator adds a "@" symbol in the middle of the compile line, which has the effect of showing some of the arguments (when VERBOSE=1) but not all of the arguments. I had thought that my compiler options were somehow not getting passed through (since cmake's compiler flag handling is a kluge at best). I've confirmed that the arguments were getting through, even though they weren't showing on the command line, but have also switched to forcing the gnumake generator (aka "Unix makefiles").

Thank you cmake.

RussTedrake commented 10 years ago

resolved build issues on windows this morning. it turns out that i was calling a different version of cl.exe than the one that the matlab mex options were set for. I needed to remove the vsvars32.bar and vcvars32.bat from my path, and instead do

call "C:\Users\Russ Tedrake\AppData\Roaming\MathWorks\MATLAB\R2013b\mexopts.bat" > NUL:

(I got this path from running mex.bat -v at the command line... it's possible that I should write a more robust script which retreives this path, but for now I'm ok with hard-coding it)

that fixed it! hoorah!

ghost commented 10 years ago

Hi Russ,

I just tried the 0.9.0alpha windows version and it works great! Thank you!

RussTedrake commented 10 years ago

I will continue to restore support for the other (non-minimal) distributions of drake. but I think I can consider this initial effort resolved.

JavadHasaneini commented 10 years ago

Russ,

Sure. It works great. I also tried Sedumi and Snopt with drake and they work fine too. By the way, my 64 bit snopt works fine with Matlab 2013a (previously I had tried it with matlab 2010 and it did not work).

Thanks, Javad

RussTedrake commented 10 years ago

this might be the reason that make was not working on windows (and I had to use nmake). http://public.kitware.com/pipermail/cmake/2006-August/010617.html

RussTedrake commented 10 years ago

successfully compiled lcm on cygwin, but it was a bit painful: 1) having installed glib via cygwin, the pkgconfig and files use cygwin style paths. cl.exe doesn't understand cygwin style paths. Passing GLIB_CFLAGS into ./configure manually helped it find glib.h, but then it still couldn't find glib/subfiles.h , etc. Finally I decided that the path of least resistance was to install cygwin's gcc and build lcm using gcc.
2) In lcm-java, cygwin wrote down the jar and javac executables (which are in c:\Program Files... on my machine) without quotes. I went in and manually modified the Makefile in lcm-java to put " " around the JAR and JAVAC variable definitions. Then everything worked.

So my current plan is to use gcc for the autoconf builds and cl.exe for the cmake builds (this is why installing cmake from outside of cygwin was the way to go... it doesn't use cygwin paths). I need to use cl.exe for the mex builds, because that's what is supported by matlab.

lrozo commented 10 years ago

I just tried the binary version for WIN64, and it worked! I ran the four examples suggested in the Wiki and all of them worked properly! Just one comment about it, when I ran "addpath_drake", I got this warning message regarding LCM is missing.

LCM not found. LCM support will be disabled. To re-enable, add lcm-###.jar to your matlab classpath (e.g., by putting javaaddpath('/usr/local/share/java/lcm-0.9.2.jar') into your startup.m .

What should I do for fixing this? LCM may be downloaded directly from the repo?

Thanks!

RussTedrake commented 10 years ago

If you download drake-distro-lcm (instead of minimal) from the release page, then you should have lcm-java working (and this warning should not appear). However, I'm almost finished linking all of the C lcm types on windows, and will release a new windows binary in the next few days. If you don't need LCM today, then it might be worth waiting for that.

On May 12, 2014, at 4:40 AM, Leonel Rozo notifications@github.com wrote:

I just tried the binary version for WIN64, and it worked! I ran the four examples suggested in the Wiki and all of them worked properly! Just one comment about it, when I ran "addpath_drake", I got this warning message regarding LCM is missing.

LCM not found. LCM support will be disabled. To re-enable, add lcm-###.jar to your matlab classpath (e.g., by putting javaaddpath('/usr/local/share/java/lcm-0.9.2.jar') into your startup.m .

What should I do for fixing this? LCM may be downloaded directly from the repo?

Thanks!

— Reply to this email directly or view it on GitHub.

JavadHasaneini commented 10 years ago

Russ,

I cannot wait to try the new windows binary release. :)

Javad

On 12/05/2014 7:57 AM, RussTedrake wrote:

If you download drake-distro-lcm (instead of minimal) from the release page, then you should have lcm-java working (and this warning should not appear). However, I'm almost finished linking all of the C lcm types on windows, and will release a new windows binary in the next few days. If you don't need LCM today, then it might be worth waiting for that.

On May 12, 2014, at 4:40 AM, Leonel Rozo notifications@github.com wrote:

I just tried the binary version for WIN64, and it worked! I ran the four examples suggested in the Wiki and all of them worked properly! Just one comment about it, when I ran "addpath_drake", I got this warning message regarding LCM is missing.

LCM not found. LCM support will be disabled. To re-enable, add lcm-###.jar to your matlab classpath (e.g., by putting javaaddpath('/usr/local/share/java/lcm-0.9.2.jar') into your startup.m .

What should I do for fixing this? LCM may be downloaded directly from the repo?

Thanks!

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/RobotLocomotion/drake/issues/42#issuecomment-42823175.