drake

Is it possible to compile Drake with SNOPT 7.7 (full version) or is 7.4/7.6 required?


System: M4 Pro

Drake Version: master

I have a full licensed version of SNOPT 7.7 with sources and have attempted to match the expected file structure as described in SNOPT Build Issue with Drake.

SNOPT by itself compiles fine on the system with ./configure; make

Unzipping of snopt-7.7.tar.gz:

snopt-7.7
├── ampl
...
├── interfaces
│   ├── aclocal.m4
│   ├── autogen.sh
│   ├── cexamples
│   ├── config
│   ├── configure.ac
│   ├── cppexamples
│   ├── include
│   ├── LICENSE
│   ├── Makefile.in
│   ├── README.md
│   └── src
├── snopt-7.7
│   └── interfaces
├── src
...
└── win64

I set the export SNOPT_PATH=/Users/ksuresh/Downloads/snopt-7.7.tar.gz

But it seems to have some issues applying the patches:

ksuresh@Krishnas-MacBook-Pro-8 drake % bazel build //solvers:snopt_solver --config snopt
INFO: Invocation ID: 7700639e-fcfb-4f70-8c5d-e14f82a7a105
WARNING: Build option --//tools/flags:with_snopt has changed, discarding analysis cache (this can be expensive, see https://bazel.build/advanced/performance/iteration-speed).
INFO: Repository +drake_dep_repositories+snopt instantiated at:
  <builtin>: in <toplevel>
Repository rule _snopt_repository defined at:
  /Users/ksuresh/drake/tools/workspace/snopt/repository.bzl:218:36: in <toplevel>
ERROR: /private/var/tmp/_bazel_ksuresh/d2402211dc5003f73d93041d171d79ed/external/bazel_tools/tools/build_defs/repo/utils.bzl:217:21: An error occurred during the fetch of repository '+drake_dep_repositories+snopt':
   Traceback (most recent call last):
    File "/Users/ksuresh/drake/tools/workspace/snopt/repository.bzl", line 189, column 29, in _impl
        _setup_local_archive(repo_ctx, snopt_path)
    File "/Users/ksuresh/drake/tools/workspace/snopt/repository.bzl", line 155, column 35, in _setup_local_archive
        error = _extract_local_archive(repo_ctx, snopt_path)
    File "/Users/ksuresh/drake/tools/workspace/snopt/repository.bzl", line 136, column 10, in _extract_local_archive
        patch(repo_ctx)
    File "/private/var/tmp/_bazel_ksuresh/d2402211dc5003f73d93041d171d79ed/external/bazel_tools/tools/build_defs/repo/utils.bzl", line 217, column 21, in patch
        fail("Error applying patch %s:\n%s%s" %
Error in fail: Error applying patch @@//tools/workspace/snopt:patches/snopt-openmp.patch:
patching file 'interfaces/src/snopt_wrapper.f90'
1 out of 1 hunks failed--saving rejects to 'interfaces/src/snopt_wrapper.f90.rej'
ERROR: no such package '@@+drake_dep_repositories+snopt//': Error applying patch @@//tools/workspace/snopt:patches/snopt-openmp.patch:
patching file 'interfaces/src/snopt_wrapper.f90'
1 out of 1 hunks failed--saving rejects to 'interfaces/src/snopt_wrapper.f90.rej'
ERROR: /Users/ksuresh/drake/solvers/BUILD.bazel:916:25: //solvers:snopt_solver depends on @@+drake_dep_repositories+snopt//:snopt_cwrap in repository @@+drake_dep_repositories+snopt which failed to fetch. no such package '@@+drake_dep_repositories+snopt//': Error applying patch @@//tools/workspace/snopt:patches/snopt-openmp.patch:
patching file 'interfaces/src/snopt_wrapper.f90'
1 out of 1 hunks failed--saving rejects to 'interfaces/src/snopt_wrapper.f90.rej'
INFO: Analyzed target //solvers:snopt_solver (0 packages loaded, 2055 targets configured).
WARNING: errors encountered while analyzing target '//solvers:snopt_solver', it will not be built.
Analysis failed
INFO: Found 0 targets...
ERROR: command succeeded, but there were loading phase errors
INFO: Elapsed time: 0.523s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully

Is the only way to build Drake with SNOPT with version 7.4, 7.6? If so, what is the correct file structure for the snopt archive?


Solution

  • It is not strictly impossible to use SNOPT 7.7, but the Drake build system (patch system, expectations) is tightly coupled to earlier versions, so you will have to do nontrivial patch adaptation