winterhell's picture

Is there a way to reduce external dependencies on Linux and OS X?

Currently my project uses .Net 2.0 and OpenAL.

On Ubuntu 12+ it needs mscorlib.dll despite it having mono already, and also It seems Linux wants those files to be in specific folders that I dont have write permissions for(even as admin) so one has to install "libmono2.0-cil mono-runtime" and "libopenal1". My Launcher checks if these are installed and then prompts the user to agree. The problem is that it requres both a password and an internet connection. I've heard on SteamOS its even harder to install.

Also on OS X one needs to download and install Mono, which also requres a password.
Is there a way to reduce those installations, while still having the same .exe running on the major desktop platforms? I dont mind if every platform needs a separate launcher.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Yes, this is absolutely possible.

For unmanaged dependencies, such as OpenAL, you can modify the lookup paths in OpenTK.dll.config to point to local subdirectories, e.g:

<dllmap os="linux" cpu="x86" dll="openal32.dll" target="lib/x86/"/>
<dllmap os="linux" cpu="x86_64" dll="openal32.dll" target="lib/x64/"/>

Using paths like "lib/[cpu]/[library]" makes porting to Android simpler. (See

For Mono, I have had great results embedding the runtime into a tiny C++ launcher. There is an extensive tutorial on the topic plus a github project that implements this (albeit in a slightly overcomplicated fashion.) The nice thing in this case is that you can use monolinker to detect and minimize the set of managed assemblies required by your application:

cd opentk/Dependencies/managed
mono monolinker.exe -a [path-to-your-exe] -c copy -l none -out output

This will shrink OpenTK.dll down to a few hundred kilobytes. Experiment with "-c link" to also reduce the size of system assemblies.

On Linux, you can also use mkbundle to create a self-contained executable. I do not know how well this works.

For Mac OS X, I would also suggest bundling SDL2 with your application. It works much better than the native Carbon backend on modern systems with retina displays.

Finally, opentk/develop now contains fixes for almost all windowing issues on Linux and Mac OS X, so make sure you are using an up-to-date version. There will be another beta release very soon and a stable release will follow within this month.

winterhell's picture

Thanks, I'll try those suggestions.