samuelpowell / Spinnaker.jl

A Julia interface to the FLIR/PointGrey Spinnaker SDK
MIT License
15 stars 7 forks source link

Add env var for delaying init #82

Closed IanButterworth closed 2 years ago

IanButterworth commented 2 years ago

Given Spinnaker is a non-JLL managed dependency, it is sometimes helpful to delay the lib init so that julia has preference over which libraries are loaded, to avoid Spinnaker loading deps that are incompatible with JLL-provided libs

Like this one, from loading VideoIO

ERROR: LoadError: InitError: could not load library "/home/ian/.julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so"
/home/ian/.julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so: undefined symbol: g_uri_ref

The simple way to do this is to load Spinnaker before other packages.

However, if Spinnaker is in a sysimage and thus has its __init__() called on julia load, this PR is needed so you can delay the lib init by setting env var JULIA_SPINNAKER_MANUAL_INIT to "true" and loading julia packages before calling Spinnaker.init() manually.