alphaville / alphaville/optimization-engine

Cross-compilation with Python bindings: PYO3_CROSS_LIB_DIR not set

Aperta
#369 0 commenti 0 reazioni 1 assegnatario Rivendicata da @alphaville Vedi su GitHub
codegen python raspberry pi
Lingua principale
Rust
Stelle
648
Fork
71
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Describe the bug**

When compiling with
```python
.with_target_system("rpi").with_build_python_bindings()
```
the following error is produced
```text
Must provide PYO3_CROSS_LIB_DIR environment variable when cross-compiling
```

**To Reproduce**

Complete example

```python
import sys
import os
import casadi.casadi as cs
import opengen as og

optimizers_dir = "my_optimizers"
optimizer_name = "rosenbrock"

def get_open_local_absolute_path():
cwd = os.getcwd()
return cwd.split('open-codegen')[0]

nu, np = 5, 2
u = cs.SX.sym("u", nu) # decision variable (nu = 5)
p = cs.SX.sym("p", 2) # parameter (np = 2)
phi = og.functions.rosenbrock(u, p) + 1500*cs.sum1(u)

# c_f1 = cs.vertcat(p[0] * u[0] - u[1], p[1]*u[2] - u[3] + 0.1)
c_f2 = cs.vertcat(0.2 + 1.5 * u[0] - u[1], u[2] - u[3] - 0.1)

bounds = og.constraints.Ball2(None, 1.5)
problem = og.builder.Problem(u, p, phi) \
.with_penalty_constraints(c_f2)\
.with_constraints(bounds)
meta = og.config.OptimizerMeta()\
.with_optimizer_name(optimizer_name)
build_config = og.config.BuildConfiguration() \
.with_build_directory(optimizers_dir) \
.with_build_mode(og.config.BuildConfiguration.DEBUG_MODE) \
.with_open_version(local_path=get_open_local_absolute_path()) \
.with_tcp_interface_config().with_target_system("rpi").with_build_python_bindings()
solver_cfg = og.config.SolverConfiguration() \
.with_preconditioning(True)

builder = og.builder.OpEnOptimizerBuilder(problem,
meta,
build_config,
solver_cfg)
builder.build()
```

**System information**

Tested on Linux and MacOS

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.