Thursday, March 13, 2008

Where is libfbclient.dylib on MacOSX?

There was a post to the Firebird Support list, asking how you link Qt to the libfbclient.dylib on MacOSX Firebird SuperServer. The problem being, that libfbclient.dylib is not "shipped" as part of the MacOSX framework... heres the detailed answer on how it works.

Firebird on MacOSX is delivered as a framework,

For more information on a frameworks look on : http://developer.apple.com

In a nutshell - "A framework is a hierarchical directory that encapsulates shared resources, such as a dynamic shared library, nib files, image files, localized strings, header files, and reference documentation in a single package. Multiple applications can use all of these resources simultaneously. The system loads them into memory as needed and shares the one copy of the resource among all applications whenever possible."

This is the "best" way to deliver an application on MacOSX.

However to do this the main dylibs (shared libraries) that run Firebird become part of the framework itself.

The main dylib that drives Classic is libfbembed, for SuperServer its libfbclient.

With Classic we ship both libfbembed and libfbclient, libfbclient as a separate dylib can be found in the libraries directory.

for SuperServer we ship libfbclient

However libfbembed (Classic) and libfbclient (SuperServer) are not directly obvious as shared libraries, i.e. if you look for them by that name with a dylib extension you are not going to find them. However if you took a close look at postfix.darwin in the Firebird source builds/posix (this is the code that sets up the framework) you will find that they become Firebird.framework/Firebird which is a link to Firebird.framework/Versions/Current/Firebird.

Where
Firebird.framework/Firebird is libfbembed.dylib for Classic and
Firebird.framework/Firebird is libfbclient.dylib for SuperServer



4 comments:

Peter said...

Thanks for the info. Just for everybody else out there using Qt and Firebird... you need to tell Qt to use the framework when generating your makefile or xcode project.

So... the Qt docs need updating; the following will generate you a nice makefile that compiles against the Firebird 2.03 Superserver installer... haven't tried the classic installer.

qmake -spec macx-g++ -o Makefile "INCLUDEPATH+=/Library/Frameworks/Firebird.framework/Headers" "LIBS+= -framework Firebird" ibase.pro

Peter said...

(sorry - previous qmake command refers to the IBASE driver specifically but can be easily adapted to your own projects)

GiAndrea said...

Hi Paul,

i've tried to compile Firebird Plugin for QT but this is the result:

/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/libtool: internal link edit command failed
lipo: can't figure out the architecture type of: /var/tmp//cc9BJYsA.out
make[1]: *** [../../../../plugins/sqldrivers/libqsqlibase_debug.dylib] Error 1

GiAndrea said...

Solved!

I've removed from Makefile.Debug and Makefiel.Release all the -arch pcc entry!