On Mac, dlopen doesn't do a search, since (unlike linux) the actual install path gets baked into the dylib at compile (link) time: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/dlopen.3.html
Hence the error message: "Library not loaded: lib/libopencv_videoio.3.0.dylib" literally means "$pwd/lib/libopencv_videoio.3.0.dylib" did not exist. On Tue, May 5, 2015 at 6:53 PM <[email protected]> wrote: > > > On Wednesday, May 6, 2015 at 4:59:16 AM UTC+10, Jameson wrote: >> >> If I'm reading the error message correctly, when libopencv_videoio was >> built, it incorrectly specified it's path as a relative location to the >> current working directory. Accordingly, you need to chdir("/usr/local") to >> be able to use this library or use `install_name_tool` to fix the internal >> name of the library and/or relink everything. >> > > IIUC that should be ok, dlopen searches relative to /usr/lib, see the last > item on the list http://linux.die.net/man/3/dlopen > > > >> >> On Tue, May 5, 2015 at 2:42 PM Max Suster <[email protected]> wrote: >> >>> >>> I realize that it might be useful to include the code for the error I >>> observed, so here it is. >>> All .dylib libraries are listed by pkg-config in the terminal and work >>> with XCode. >>> >>> This works >>> julia> lib = "/usr/local/lib/libopencv_core" >>> "/usr/local/lib/libopencv_core" >>> >>> julia> Libdl.dlopen(lib, Libdl.RTLD_GLOBAL) >>> Ptr{Void} @0x00007fd4ad333de0 >>> >>> This does NOT work >>> julia> lib = "/usr/local/lib/libopencv_highgui" >>> "/usr/local/lib/libopencv_highgui" >>> >>> julia> Libdl.dlopen(lib, Libdl.RTLD_GLOBAL) >>> ERROR: could not load module /usr/local/lib/libopencv_highgui: >>> dlopen(/usr/local/lib/libopencv_highgui.dylib, 9): Library not loaded: >>> lib/libopencv_videoio.3.0.dylib >>> >>> Referenced from: /usr/local/lib/libopencv_highgui.dylib >>> Reason: image not found >>> in dlopen at ./libdl.jl:33 >>> >>> I will be grateful for any tips on what is going on. >>> >>> >>> On Tuesday, May 5, 2015 at 5:33:10 PM UTC+2, Max Suster wrote: >>>> >>>> >>>> When trying to load 8 shared .dylibs from my OpenCV.jl package on the >>>> most recent v0.4-dev (OSX 10.10.3), I got an error indicating that dlopen_e >>>> and dlopen are deprecated. So I added the Libdl. to each, and tried again. >>>> >>>> >>>> Now it seems that only the core library, libopencv-core.dylib, can be >>>> loaded but not the rest. I also tried adding the libs path to Julia, and >>>> cd to /usr/local/lib which contains the libraries, but still I can not load >>>> the libs. >>>> >>>> The error I get is "Image can not be found, see Lidl.jl line 33". The >>>> libs are properly compiled - pkg-config lists all of them and they work >>>> when linked to my C++ OpenCV projects in Xcode. >>>> >>>> Any thoughts on why dlopen is not working this way? Thanks in advance. >>>> >>>>
