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

Challenges setting up dev environment #136

Open
tomconnors opened this issue Aug 29, 2021 · 1 comment
Open

Challenges setting up dev environment #136

tomconnors opened this issue Aug 29, 2021 · 1 comment

Comments

@tomconnors
Copy link
Contributor

I'm on macOS Catalina, and had some trouble getting the compiled C code loaded.

I first hit this issue:

% lein repl
spire.core=> (clojure.lang.RT/loadLibrary "spire")
Execution error (UnsatisfiedLinkError) at java.lang.ClassLoader/loadLibrary (ClassLoader.java:2670).
no spire in java.library.path: [./]

project.clj has :jvm-opts ["-Djava.library.path=./"], but that's not where the libspire.dylib is on my system. I have that file at ~/.spire/libs. I copied the file to the spire repo and then (clojure.lang.RT/loadLibrary "spire") and the rest of Spire worked without issue. Think there's anything Spire can do to remove that obstacle?

Another note, ~/.spire/libs/libspire.dylib is created when installing spire, but not when starting up the dev environment. That makes sense in hindsight, but should probably be explicitly mentioned in whatever docs describe this process.

@retrogradeorbit
Copy link
Member

retrogradeorbit commented Feb 24, 2022

your libspire.dylib was created when spire ran for the first time. It was copied into that ~/.spire/libs location from an internal resource bundled inside the spire binary. And that bundled dylib file was built on the CircleCI servers.

You should be able to build the C code into a shared library by issuing make lib from the dev environment. It will make the shared library artefact inside the target/jni folder. That then needs to be on your java library path. Unfortunately you can't alter this path after JVM startup on some implementations of the JVM. It is considered read only. So if it's not in a location on the library path, and you want to alter your library path, you will need to adjust that on the jvm launch, such as in the leiningen project file.

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

2 participants