Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yarn build without OSQP broken #60

Open
Archer6621 opened this issue May 5, 2023 · 0 comments
Open

Yarn build without OSQP broken #60

Archer6621 opened this issue May 5, 2023 · 0 comments

Comments

@Archer6621
Copy link

Archer6621 commented May 5, 2023

Hey there, I tried forking this repo and building without OSQP as instructed in the readme using the latest version of emscripten:

emcc -D NO_OSQP -I lib/eigen -Isrc -s DISABLE_EXCEPTION_CATCHING=0 -s ASSERTIONS=0 -O3 -s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE=1 --bind -o build/eigen_gen.js src/cpp/embind.cc

Then I indeed did a yarn build, pushed the new index.js that got generated, and tried to install the fork.

Upon trying to use it, I get greeted by the following error:

index.js:1  Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'prototype')
    at D.initClass (index.js:1:935979)
    at index.js:1:936495
    at Set.forEach (<anonymous>)
    at index.js:1:936476
initClass @ index.js:1
(anonymous) @ index.js:1
(anonymous) @ index.js:1
Promise.then (async)
(anonymous) @ HSWFC.js:36

I suspected that it was because of the following piece of code at the end of eigen.mjs that adds the GC to the classes, since it still has the QuadProgSolver in there:

eig.ready = Module.then(module => {
  const classes = new Set([
    "Vector",
    "Vector2d",
    "Complex",
    "Matrix",
    "SparseMatrix",
    "TripletVector",
    "ComplexDenseMatrix",
    "Solvers",
    "Decompositions",
    "QuadProgSolver",
    "Random",
  ]);
  classes.forEach(className => {
    eig[className] = GC.initClass(classes, module[className])
  })
  addHelpers(eig);
})

After removing "QuadProgSolver" it indeed started working. I'm not savvy enough in web build tools to come up with a nicer solution for this, but maybe it is good to put a disclaimer/warning in the readme for now about it, so people can still perform a functioning yarn build without OSQP in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant