1

im create subdir template for Qt (5.2.0) project as described in this answer

i can build this on win and linux platform with minGW and GCC but on mac os im getting next error

dyld: Library not loaded: libfile-helpers.1.dylib
Referenced from: /Users/myusername/Programming/Qt/build-ProjectName-qt-Desktop_Qt_5_2_0_clang_64bit-Debug/build/project
Reason: image not found

The program has unexpectedly finished.

otool -L on main executable gives next output

libfile-helpers.1.dylib (compatibility version 1.0.0, current version 1.0.0)
libgui.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/Users/myusername/Qt/5.2.0/clang_64/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.2.0, current version 5.2.0)
/Users/myusername/Qt/5.2.0/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.2.0, current version 5.2.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

but files *.dylib placed in subdirs and cant be found in current setup

how to setup project for proper run after build without manual file manipulations one change i make in build.pro (see answer in beginning ) is adding next text

macx {
   CONFIG -= app_bundle
} 

(uname -a)

Darwin MacBook.local 13.0.2 Darwin Kernel Version 13.0.2: Sun Sep 29 19:38:57 PDT 2013; root:xnu-2422.75.4~1/RELEASE_X86_64 x86_64

with qmake ( -v )

QMake version 3.0
Using Qt version 5.2.0 in /Users/myusername/Qt/5.2.0/clang_64/lib

and clang ( -v )

Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.2
Thread model: posix

Im nooby in osX native development and cant solve this by myself. Thanks for answers!

Community
  • 1
  • 1
llCorvinuSll
  • 242
  • 3
  • 12

2 Answers2

0

On Mac OS X deployment process is a bit different then on other platforms. Mostly you will create application bundle that must contain all required libraries with it. Qt documentation describes whole process very well. Here are some resources:

Qt for Mac OS X - Deployment

Take a look at The Mac Deployment Tool

Kamil Klimek
  • 12,884
  • 2
  • 43
  • 58
0

I assume you have such a subdirs project with this directory structure:

subdirs
  + app
  + lib

That is, a subdirs project (here, creatively called subdirs) with an app (called app) and a lib (called lib) project.

Now, if your app uses the dynamically linked/shared lib project within your subdirs project on OSX, you will get the following error:

dyld: Library not loaded: libLIBTARGET.1.dylib
  Referenced from: /path/to/qt/build/dir/build-PROJECT-DETAILS/APPDIR/APPTARGET
  Reason: image not found
The program has unexpectedly finished.

where

  • LIBTARGET is the TARGET value of your lib project,
  • PROJECT is the name of your subdirs project,
  • DETAILS are your build & run details,
  • APPDIR is the directory of the app project, and
  • APPTARGET is the TARGET value of your app project.

To get rid of this problem on OSX during the development of the project, you need to set the (OSX-specific) DYLD_LIBRARY_PATH to the lib directory to the entire project's run settings in Projects -> Build & Run -> Run Environment and add the Variable DYLD_LIBRARY_PATH with Value ../LIBDIR/ - or, if you are working from the command line, export that variable.

Then, for deploying the app, you need to make sure the dynamic library is placed within your app bundle or create a statically compiled bundle. More here on Digia: Mac OSX Deployment.

fnl
  • 4,861
  • 4
  • 27
  • 32