quil-lang / quilc

The optimizing Quil compiler.
Apache License 2.0
454 stars 73 forks source link

Load foreign libraries at run time #724

Closed notmgsk closed 3 years ago

notmgsk commented 3 years ago
  1. Back in #702 I tried to get foreign libraries to load at run time vs. hard-coding library paths in the compiled executable. It was broken, however, so I reverted it a while back. Today I figured out how it was broken: when the libraries are "unloaded" and saved into a list, they're saved in reverse order. So when quilc is compiled the last library it links to is expokit because it depends on lapack which is loaded earlier. When I was loading from that list at run time I would end up trying to load expokit before lapack, and CFFI would fail with an unhelpful error: instead of saying why a library couldn't be loaded, it would just say that it couldn't be loaded. Anyhow, reversing the list fixes the problem. Have a good weekend.

  2. I've changed the tests here to use a specific version of QVM. This fixes a compatibility issue (see #723).