-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release new osqp-cpp version with osqp and suitesparse fixes (#2419)
With the existing version of osqp-cpp, it uses `long long`. Although osqp works with `long long`, another dependency of osqp, SuiteSparse doesn't. Therefore, although the code compiled, the program that depends on osqp-cpp fails while linking them. There are two errors primarily: 1. Cannot find symbol amd_l_order used by qdldl_interface.c in osqp - Fix: define -DDLONG as cxxopt for building SuiteSparse. The current latest version 0.6.3.bcr.1 doesn't work and has been yanked. 2. Cannot find symbol osqp_is_interrupted used by osqp++.c - Fix: Add src/ctrlc.c and include/ctrlc.h and define "CTRLC" while building. This is why a new version of osqp is needed with these ctrl-c interrupt definitions.
- Loading branch information
Showing
18 changed files
with
300 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module( | ||
name = "osqp-cpp", | ||
version = "0.0.0-20231004-4343373.bcr.1", | ||
) | ||
bazel_dep(name = "abseil-cpp", version = "20240116.2") | ||
bazel_dep(name = "eigen", version = "3.4.0.bcr.1") | ||
bazel_dep(name = "osqp", version = "0.6.3.bcr.2") | ||
bazel_dep(name = "rules_license", version = "0.0.8") |
11 changes: 11 additions & 0 deletions
11
modules/osqp-cpp/0.0.0-20231004-4343373.bcr.1/patches/add_module_dot_bazel.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- MODULE.bazel | ||
+++ MODULE.bazel | ||
@@ -0,0 +1,8 @@ | ||
+module( | ||
+ name = "osqp-cpp", | ||
+ version = "0.0.0-20231004-4343373.bcr.1", | ||
+) | ||
+bazel_dep(name = "abseil-cpp", version = "20240116.2") | ||
+bazel_dep(name = "eigen", version = "3.4.0.bcr.1") | ||
+bazel_dep(name = "osqp", version = "0.6.3.bcr.2") | ||
+bazel_dep(name = "rules_license", version = "0.0.8") |
18 changes: 18 additions & 0 deletions
18
modules/osqp-cpp/0.0.0-20231004-4343373.bcr.1/presubmit.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
matrix: | ||
platform: | ||
- debian10 | ||
- ubuntu2004 | ||
- macos | ||
- macos_arm64 | ||
bazel: | ||
- 7.x | ||
- 6.x | ||
tasks: | ||
verify_targets: | ||
name: Verify build targets | ||
platform: ${{ platform }} | ||
bazel: ${{ bazel }} | ||
build_flags: | ||
- '--cxxopt=-std=c++17' | ||
build_targets: | ||
- '@osqp-cpp//...' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"url": "https://github.com/google/osqp-cpp/archive/43433736334d6b515ea4b0247156fea9e56c0d3f.tar.gz", | ||
"integrity": "sha256-Ye1aTRuJMM0T6u6Z/qZLAt8iCEzmRArQVxOUPAHkwSQ=", | ||
"strip_prefix": "osqp-cpp-43433736334d6b515ea4b0247156fea9e56c0d3f", | ||
"patches": { | ||
"../../0.0.0-20231004-4343373/patches/add-build-file.patch": "sha256-h4DBMwvSkV+caG2l/KGwBnrrM0UcbdgjEr2Dn9YTZTw=", | ||
"add_module_dot_bazel.patch": "sha256-UC3WaukJ3gDMF6gtUDkFJ6HpL/p6Y4d79uYnLRU34ds=" | ||
}, | ||
"patch_strip": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module(name = "osqp", version = "0.6.3.bcr.2") | ||
|
||
bazel_dep(name = "rules_cc", version = "0.0.9") | ||
bazel_dep(name = "platforms", version = "0.0.8") | ||
bazel_dep(name = "qdldl", version = "0.1.7.bcr.1") | ||
bazel_dep(name = "suitesparse", version = "7.6.0.bcr.1") | ||
bazel_dep(name = "cmake_configure_file", version = "0.1.0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
diff --git BUILD.bazel BUILD.bazel | ||
new file mode 100644 | ||
index 00000000..00cc62f8 | ||
--- /dev/null | ||
+++ BUILD.bazel | ||
@@ -0,0 +1,110 @@ | ||
+load("@rules_cc//cc:defs.bzl", "cc_library") | ||
+ | ||
+package(default_visibility = ["//visibility:public"]) | ||
+ | ||
+licenses(["notice"]) | ||
+ | ||
+load( | ||
+ "@cmake_configure_file//:cmake_configure_file.bzl", | ||
+ "cmake_configure_file", | ||
+) | ||
+exports_files([ | ||
+ "include/osqp.h", | ||
+ "include/ctrlc.h", | ||
+]) | ||
+# Generates osqp_configure.h based on the defines= we want in Drake. | ||
+cmake_configure_file( | ||
+ name = "configure_file", | ||
+ src = "configure/osqp_configure.h.in", | ||
+ out = "include/osqp_configure.h", | ||
+ defines = [ | ||
+ "PRINTING", | ||
+ "PROFILING", | ||
+ "CTRLC", | ||
+ "DLONG", | ||
+ # In addition to the default primitive size of `double` and `int`, | ||
+ # also define 'DLONG' which is required for @osqp-cpp. Don't define | ||
+ # 'DFLOAT' unless @qdldl_internal and @scs_internal are | ||
+ # also changed to use those primitive sizes. | ||
+ # See drake/tools/workspace/qdldl_internal/README.md. | ||
+ ] + select({ | ||
+ "@platforms//os:windows": [ | ||
+ "IS_WINDOWS", | ||
+ ], | ||
+ "@platforms//os:osx": [ | ||
+ "IS_MAC", | ||
+ ], | ||
+ "//conditions:default": [ | ||
+ "IS_LINUX", | ||
+ ], | ||
+ }), | ||
+ undefines = [ | ||
+ "OSQP_CUSTOM_MEMORY", | ||
+ ], | ||
+ visibility = ["//visibility:private"], | ||
+) | ||
+ | ||
+cc_library( | ||
+ name = "osqp", | ||
+ # Our hdrs match OSQP's ./include/CMakeLists.txt variable `osqp_headers`. | ||
+ hdrs = [ | ||
+ # These headers are always enabled in CMakeLists. | ||
+ "include/auxil.h", | ||
+ "include/constants.h", | ||
+ "include/ctrlc.h", | ||
+ "include/error.h", | ||
+ "include/glob_opts.h", | ||
+ "include/lin_alg.h", | ||
+ "include/osqp.h", | ||
+ "include/osqp_configure.h", | ||
+ "include/proj.h", | ||
+ "include/scaling.h", | ||
+ "include/types.h", | ||
+ "include/util.h", | ||
+ "include/version.h", | ||
+ # These headers are enabled in CMakeLists only when building in normal | ||
+ # mode. | ||
+ "include/kkt.h", | ||
+ # These headers are enabled in CMakeLists only when building in | ||
+ # non-embedded mode. | ||
+ "include/cs.h", | ||
+ "include/polish.h", | ||
+ "include/lin_sys.h", | ||
+ ], | ||
+ srcs = [ | ||
+ # From ./lin_sys/direct/qdldl/CMakeLists.txt at `qdldl_interface_src`. | ||
+ "lin_sys/direct/qdldl/qdldl_interface.h", | ||
+ "lin_sys/direct/qdldl/qdldl_interface.c", | ||
+ # From ./src/CMakeLists.txt at `osqp_src`. | ||
+ # These sources are always enabled in CMakeLists. | ||
+ "src/auxil.c", | ||
+ "src/ctrlc.c", | ||
+ "src/error.c", | ||
+ "src/lin_alg.c", | ||
+ "src/osqp.c", | ||
+ "src/proj.c", | ||
+ "src/scaling.c", | ||
+ "src/util.c", | ||
+ # These sources are enabled in CMakeLists only when building in normal | ||
+ # mode. | ||
+ "src/kkt.c", | ||
+ # These sources are enabled in CMakeLists only when building in | ||
+ # non-embedded mode. | ||
+ "src/cs.c", | ||
+ "src/polish.c", | ||
+ "src/lin_sys.c", | ||
+ ], | ||
+ includes = [ | ||
+ "include", | ||
+ "lin_sys/direct/qdldl", | ||
+ ], | ||
+ copts = [ | ||
+ "-fvisibility=hidden", | ||
+ "-w", | ||
+ "-Werror=incompatible-pointer-types", | ||
+ ], | ||
+ deps = [ | ||
+ "@qdldl//:qdldl", | ||
+ "@suitesparse//:amd", | ||
+ ], | ||
+) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git MODULE.bazel MODULE.bazel | ||
new file mode 100644 | ||
index 00000000..44caadb7 | ||
--- /dev/null | ||
+++ MODULE.bazel | ||
@@ -0,0 +1,7 @@ | ||
+module(name = "osqp", version = "0.6.3.bcr.2") | ||
+ | ||
+bazel_dep(name = "rules_cc", version = "0.0.9") | ||
+bazel_dep(name = "platforms", version = "0.0.8") | ||
+bazel_dep(name = "qdldl", version = "0.1.7.bcr.1") | ||
+bazel_dep(name = "suitesparse", version = "7.6.0.bcr.1") | ||
+bazel_dep(name = "cmake_configure_file", version = "0.1.0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
matrix: | ||
platform: | ||
- debian10 | ||
- ubuntu2004 | ||
- macos | ||
- macos_arm64 | ||
bazel: [6.x, 7.x] | ||
tasks: | ||
verify_targets: | ||
name: Verify build targets | ||
platform: ${{ platform }} | ||
bazel: ${{ bazel }} | ||
build_targets: | ||
- "@osqp//:osqp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"url": "https://github.com/osqp/osqp/releases/download/v0.6.3/osqp-v0.6.3-src.tar.gz", | ||
"integrity": "sha256-KFsqYPaNEToQkHZ+yKnIGmWzry0lj4x4oxzD+YulhFY=", | ||
"patches": { | ||
"add_build_file.patch": "sha256-kldF6tsqE6rvZmk7j+qiWAfkQhuOVbBfId7Kfkp7J54=", | ||
"module_dot_bazel.patch": "sha256-4cnZszG7pcoBe5EhhGpcjvDw3n49ObGHCcP+N7EoD6E=" | ||
}, | ||
"patch_strip": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,7 @@ | |
"github:osqp/qdldl" | ||
], | ||
"versions": [ | ||
"0.1.7", | ||
"0.1.7.bcr.1" | ||
"0.1.7" | ||
], | ||
"yanked_versions": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module(name = "suitesparse", version = "7.6.0.bcr.1") |
46 changes: 46 additions & 0 deletions
46
modules/suitesparse/7.6.0.bcr.1/patches/add_build_file.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
diff --git BUILD.bazel BUILD.bazel | ||
new file mode 100644 | ||
index 000000000..14b84cd84 | ||
--- /dev/null | ||
+++ BUILD.bazel | ||
@@ -0,0 +1,40 @@ | ||
+licenses(["notice"]) # BSD-3-Clause | ||
+ | ||
+package(default_visibility = ["//visibility:private"]) | ||
+ | ||
+cc_library( | ||
+ name = "config", | ||
+ srcs = ["SuiteSparse_config/SuiteSparse_config.c"], | ||
+ hdrs = ["SuiteSparse_config/SuiteSparse_config.h"], | ||
+ strip_include_prefix = "SuiteSparse_config", | ||
+ copts = ["-fvisibility=hidden"], | ||
+ visibility = ["//visibility:public"], | ||
+) | ||
+ | ||
+# The header for libamd. | ||
+cc_library( | ||
+ name = "amd_hdrs", | ||
+ hdrs = [ | ||
+ "AMD/Include/amd_internal.h", | ||
+ "AMD/Include/amd.h", | ||
+ ], | ||
+ strip_include_prefix = "AMD/Include", | ||
+ deps = [ | ||
+ ":config", | ||
+ ], | ||
+) | ||
+ | ||
+# The libamd sources are compiled twice, once as 32-bit and once as 64-bit. | ||
+_AMD_SRCS = glob( | ||
+ ["AMD/Source/amd_*.c"], | ||
+ exclude = ["AMD/Source/amd_l*.c"], | ||
+ allow_empty = False, | ||
+) | ||
+ | ||
+cc_library( | ||
+ name = "amd", | ||
+ srcs = _AMD_SRCS, | ||
+ copts = ["-fvisibility=hidden", "-DDLONG"], | ||
+ deps = [":amd_hdrs"], | ||
+ visibility = ["//visibility:public"], | ||
+) |
7 changes: 7 additions & 0 deletions
7
modules/suitesparse/7.6.0.bcr.1/patches/module_dot_bazel.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
diff --git MODULE.bazel MODULE.bazel | ||
new file mode 100644 | ||
index 000000000..dd5383095 | ||
--- /dev/null | ||
+++ MODULE.bazel | ||
@@ -0,0 +1 @@ | ||
+module(name = "suitesparse", version = "7.6.0.bcr.1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
matrix: | ||
platform: | ||
- debian10 | ||
- ubuntu2004 | ||
- macos | ||
- macos_arm64 | ||
bazel: [6.x, 7.x] | ||
tasks: | ||
verify_targets: | ||
name: Verify build targets | ||
platform: ${{ platform }} | ||
bazel: ${{ bazel }} | ||
build_targets: | ||
- "@suitesparse//:amd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"url": "https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/v7.6.0.tar.gz", | ||
"integrity": "sha256-GcvrmWTr5DlBPdZtgqzh+QStxfJdioI8G0jDS9DSnqU=", | ||
"strip_prefix": "SuiteSparse-7.6.0", | ||
"patches": { | ||
"add_build_file.patch": "sha256-9ZjpYTk5upEKyChEYOF/cYNKeEPn3eBlL6e2uDQ+IG4=", | ||
"module_dot_bazel.patch": "sha256-yu2EF5hSQKkIjbLh1bfhgvBEyoPiWYVByrV4tPGvZcg=" | ||
}, | ||
"patch_strip": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters