3

I'm trying to build a qbs project using the leap motion library but on running the project am given the following error:

dyld: Library not loaded: @loader_path/libLeap.dylib
Referenced from: /Users/pball/Work/Code/Qt/build-LeapTest-Desktop-Debug/qtc_Desktop_95cbad6a-debug/install-root/LeapTest
Reason: image not found

My qbs file:

import qbs
CppApplication {
consoleApplication: true
files: "main.cpp"

Group {     // Properties for the produced executable
    fileTagsFilter: product.type
    qbs.install: true
}

cpp.includePaths: [".","/Users/pball/LeapSDK/include"]
cpp.libraryPaths: ["/Users/pball/LeapSDK/lib"]

cpp.dynamicLibraries: "Leap"
}

libLeap.dylib is in that location.

Using Qt 5.6.0

New to using qbs so any help / pointers greatly appreciated.

daamaam
  • 33
  • 4

1 Answers1

1

This is not a qbs-specific issue, but rather requires understanding of how dynamic libraries are loaded on macOS. Please check the documentation on dyld and Run-Path Dependent Libraries.

That said, based on the install name of your dependent shared library libLeap.dylib, if you copy it to the same directory as your LeapTest application binary, it should be loaded successfully.

Jake Petroules
  • 23,472
  • 35
  • 144
  • 225
  • Hey, "macOS" is even not released yet! – Anton Malyshev Aug 05 '16 at 22:18
  • The name "macOS" applied retroactively to every previous version of macOS the moment it was announced, so it's been released since 2001. – Jake Petroules Aug 06 '16 at 09:15
  • Thanks Jake, copying it into the directory worked. Appreciate the links as well – daamaam Aug 06 '16 at 19:10
  • For anyone wondering, if you're getting the error OP mentioned but are using `Depends { ... }` to add the dependency to the library rather than linking to an existing library outside the root project directory, ensure that "Install" is checked in the Build Steps section in Qt Creator. – Mitch May 10 '18 at 15:05