[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] making a standalone fluidsynth plugin on Mac

From: Antoine Schmitt
Subject: Re: [fluid-dev] making a standalone fluidsynth plugin on Mac
Date: Wed, 28 Mar 2012 15:38:34 +0200

Just to be clear for future developers in the same situation (building a standalone executable on MacOSX dependent on fluidsynth), the solution for me was to copy all the fluidsynth dependencies (recursively) into the executable package and use install_name_tool to have the executable point to them instead of the system ones.

In details :
- install glib (using homebrew, but it could have been fink), which installs all glib dependencies (like iconv, gettext/intl) - compile a static version of libfluidsynth, using cmake options to remove all unneeded dependencies like readline, dbus and libsndfile, leaving only glib (and gthread, which is part of glib). I guess that it could have been the shlib version too of fluidsynth, in which case I would have needed to include it as well inside the executable package. - build my product (a shared library, but it could have been an executable), linked with this fluidsynth library - copy all the dependencies (recursively) of fluidsynth, i.e. : the glib, gthread, iconv and intl shlibs inside the generated package, and use install_name_tool to change the internal references of executables and shlibs towards the other shlibs. Use otool -L to find the dependencies of a lib/shlib. Here is my install_name_tool script, knowing that my executable package is fluidXtra.xtra, and its executable file is fluidXtra.xtra/ Contents/MacOS/fluidXtra.

mkdir -p fluidXtra.xtra/Contents/Frameworks

// libgthread-2.0.0.dylib (fluidXtra depends on it)
cp /usr/local/Cellar/glib/2.30.3/lib/libgthread-2.0.0.dylib fluidXtra.xtra/Contents/Frameworks/
chmod +w fluidXtra.xtra/Contents/Frameworks/libgthread-2.0.0.dylib
install_name_tool -id @loader_path/../Frameworks/ libgthread-2.0.0.dylib fluidXtra.xtra/Contents/Frameworks/ libgthread-2.0.0.dylib install_name_tool -change /usr/local/Cellar/glib/2.30.3/lib/ libgthread-2.0.0.dylib @loader_path/../Frameworks/ libgthread-2.0.0.dylib fluidXtra.xtra/Contents/MacOS/fluidXtra

// libglib-2.0.0.dylib (fluidXtra and libgthread depend on it)
cp /usr/local/Cellar/glib/2.30.3/lib/libglib-2.0.0.dylib fluidXtra.xtra/Contents/Frameworks/
chmod +w fluidXtra.xtra/Contents/Frameworks/libglib-2.0.0.dylib
install_name_tool -id @loader_path/../Frameworks/libglib-2.0.0.dylib fluidXtra.xtra/Contents/Frameworks/libglib-2.0.0.dylib install_name_tool -change /usr/local/Cellar/glib/2.30.3/lib/ libglib-2.0.0.dylib @loader_path/../Frameworks/libglib-2.0.0.dylib fluidXtra.xtra/Contents/MacOS/fluidXtra install_name_tool -change /usr/local/Cellar/glib/2.30.3/lib/ libglib-2.0.0.dylib @loader_path/../Frameworks/libglib-2.0.0.dylib fluidXtra.xtra/Contents/Frameworks/libgthread-2.0.0.dylib

// libiconv.2.dylib (libglib and libgthread depend on it)
cp /usr/lib/libiconv.2.dylib fluidXtra.xtra/Contents/Frameworks/
chmod +w fluidXtra.xtra/Contents/Frameworks/libiconv.2.dylib
install_name_tool -id @loader_path/../Frameworks/libiconv.2.dylib fluidXtra.xtra/Contents/Frameworks/libiconv.2.dylib install_name_tool -change /usr/lib/libiconv.2.dylib @loader_path/../ Frameworks/libiconv.2.dylib fluidXtra.xtra/Contents/Frameworks/ libglib-2.0.0.dylib install_name_tool -change /usr/lib/libiconv.2.dylib @loader_path/../ Frameworks/libiconv.2.dylib fluidXtra.xtra/Contents/Frameworks/ libgthread-2.0.0.dylib

// libintl.8.dylib (libglib and libgthread depend on it)
cp /usr/local/Cellar/gettext/ fluidXtra.xtra/Contents/Frameworks/
chmod +w fluidXtra.xtra/Contents/Frameworks/libintl.8.dylib
install_name_tool -id @loader_path/../Frameworks/libintl.8.dylib fluidXtra.xtra/Contents/Frameworks/libintl.8.dylib install_name_tool -change /usr/local/Cellar/gettext/ libintl.8.dylib @loader_path/../Frameworks/libintl.8.dylib fluidXtra.xtra/Contents/Frameworks/libglib-2.0.0.dylib install_name_tool -change /usr/local/Cellar/gettext/ libintl.8.dylib @loader_path/../Frameworks/libintl.8.dylib fluidXtra.xtra/Contents/Frameworks/libgthread-2.0.0.dylib


Le 28 mars 12 à 14:55, Antoine Schmitt a écrit :

Ok !
Cross-reading your answer, adn Ebrahim's, I figured that I needed to include all the closure of the dependencies along with my delivery : glib and gthread, but also iconv and intl, and use install_name_tool to modify all mutual interdependencies between the executable and all the libs, and between the libs themselves too.
And it works ! Thank you very much.

Now, Windows... Any advice to save me some sweat ?


Le 28 mars 12 à 05:05, R.L. Horn a écrit :

On Wed, 28 Mar 2012, Antoine Schmitt wrote:

Or is glib installed on all linux machines by default,

Pretty much.

As far as libffi is concerned, you could try an older version of glib (earlier than April, 2011, or thereabouts) that doesn't have that dependency. FWIW, you're not alone in your frustration...a lot of us ophidiophobes were royally POd about that.

The mandatory gettext dependency is also just plain obnoxious if you don't require NLS. Unfortunately, short of providing a dummy libintl, I'm not sure what can be done about it. The good news is that, if you only want English, you can safely throw away the locale files.

Just for kicks, I built a static version of glib-2.16.5 (the newest "old" version I had at hand) and was able to build a functional fluidsynth with no special dependencies (well, except for gettext and iconv, which are built into glibc).

It can be done. Fairly easily. Under linux. Which may or may not be of any relevance whatsoever.

The threads error is a real mystery. What do you get when you run "otool -L" on fluidsynth versus your app?

fluid-dev mailing list

++ as :: Antoine Schmitt

++ as :: Antoine Schmitt

reply via email to

[Prev in Thread] Current Thread [Next in Thread]