Closed Muxelmann closed 7 years ago
Let me know how it goes.
It failed on MacOS:
https://travis-ci.org/tshort/OpenDSSDirect.jl/jobs/259339483#L93
I don't have a way to test this locally, and using Travis to try to debug is tough.
I haven't tried Linux, yet. I'm sure that'll work. My only question there is whether it'll work on my cluster which is an older version of Red Hat.
Along those lines, for macOS, is there a way that klusolve can be compiled into libopendssdirect, like it is on Linux? Any reason there for the difference?
I had a long attempt at statically linking the libraries in macOS. However, that doesn't seem to be supported by Apple (link). This means, we have two options of using them:
libklusolve.dylib
into e.g. /usr/local/bin
,@rpath
or @executable_path
to find each other.At least that's how I understood it for now...
Also, I forgot to address your second last comment (sorry about that). Have you tried loading libklusolve.dylib
before libopendssdirect.dylib
? Because if I don't do this (in Python), then is the result is similar to yours:
Traceback (most recent call last):
File "test.py", line 3, in <module>
ctypes.CDLL('_lib/x86_64-darwin/libopendssdirect.dylib')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(_lib/x86_64-darwin/libopendssdirect.dylib, 6): Library not loaded: @rpath/libklusolve.dylib
Referenced from: /Users/maxi/Documents/git/OpenDSSDirect.make/_lib/x86_64-darwin/libopendssdirect.r1993.dylib
Reason: image not found
Otherwise I get no prompt, i.e. it appears to work. And that's the test code:
import ctypes
ctypes.CDLL('_lib/x86_64-darwin/libklusolve.dylib') # load KLUSolve
ctypes.CDLL('_lib/x86_64-darwin/libopendssdirect.dylib') # load OpenDSSDirect
Thanks, @Muxelmann. I think I'm loading libklusolve.dylib first.
Maybe Julia works differently than Python here. Without a local testbed, I probably can't debug this effectively. I may end up copying the libklusolve to a standard location. It's not great, but that works.
Awesome! I'll give it a try.