dylib issues in OSx

I’ve developed an application in XOJO on a MAC and now I’m trying to run it on another MAC. The application uses a third party library. On my MAC the application runs fine, but on the other one it gives the error:

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
Library not loaded: /usr/local/lib/libftd2xx.1.2.2.dylib
Referenced from: /Users/USER/Downloads/*/libuFCoder.dylib
Reason: no suitable image found. Did find:
/usr/local/lib/libftd2xx.1.2.2.dylib: stat() failed with errno=62
/usr/local/lib/libftd2xx.1.2.2.dylib: stat() failed with errno=62

They both have the latest software, both have the FTDI libraries installed. Any help would be appreciated.

perhaps this is a clue

It seems to be looking in the users DOWNLOAD folder… not a good place to keep external components

I setup it up to the Downloads folder just for convenience sake, but you’re absolutely right that its not a good practise.

[quote=277620:@Alexey Borisenko]Dyld Error Message:
Library not loaded: /usr/local/lib/libftd2xx.1.2.2.dylib
Referenced from: /Users/USER/Downloads/*/libuFCoder.dylib
Reason: no suitable image found. Did find:
/usr/local/lib/libftd2xx.1.2.2.dylib: stat() failed with errno=62
/usr/local/lib/libftd2xx.1.2.2.dylib: stat() failed with errno=62

[/quote]

I don’t know anything about your app or environment, but errno 62 maps to ELOOP. Is it possible you have some ‘broken’ symbolic links?

You’re going to have to include these in your application package. Ideally in the “Frameworks” sub folder of your application if you want to distribute the application. Means that your declares will have to be updated to point to dylib.

I’ve never linked directly to a dylib (only via a Xojo plugin wrapper before) so maybe joe can give you some tips on how to directly link to a dylib in the “Frameworks” folder.

[code]Declare Function dlopen Lib “/usr/lib/libdl.dylib” (path As CString, mode As Int32) As Ptr
Declare Function dlerror Lib “/usr/lib/libdl.dylib” () As CString
Declare Function dlsym Lib “/usr/lib/libdl.dylib” (handle As Ptr, symbol As CString) As Ptr
Declare Function dlclose Lib “/usr/lib/libdl.dylib” (handle As Ptr) As Integer

Const RTLD_LAZY = &h001
// Const RTLD_NOW = &h002

Dim handle As Ptr = dlopen(“libSystem.dylib”, RTLD_LAZY)

If handle = Nil Then
Dim exc As New RuntimeException()
exc.Message = dlerror()
Raise exc
End

Dim p As Ptr = dlsym(handle, “TheNameOfTheSymbolToLoad”)

Call dlclose(handle)[/code]