-1

Ok so I am an engineer / applied-math guy and someone only mildly technical was impressed by a linux version of some software but wants it for Mac (Doctors...)

Can someone point me at how to redistribute an executable for Mac? Before I ditched Windows the atomic solution was to copy a bunch of DLL's into their System32 folder. Some sub-questions:

1) Ok I see "sudo macports install XYZ". Will this allow me to statically build QT apps? Or, suppose they have QT installed, how do I get my app to find it on their comp?

2) Maybe there's an example out there, using VTK + QT + Boost, for building application for Mac?

My apologies with the vague question, if I knew what to methodically search for I would have done so.

  • 2
    Have you read [Qt’s Deploying an Application on Mac OS X](http://doc.qt.nokia.com/stable/deployment-mac.html)? –  Oct 23 '11 at 04:16

1 Answers1

2

Is there any specific reason why you want to statically link Qt+VTK+Boost with the app? On the Mac, for libraries like these I can't think of any reason (except licensing) why static linking would be preferable to dynamic.

Take a look at the "Deploying an Application on Mac OS X" link that Bavarious posted. It explains how Mac apps are stored in bundles, allowing an app made up of many files to appear to the user as a single file. Libraries can also be stored in a bundle (along with their header files), in which case it's called a framework. Any needed frameworks can be stored inside the app bundle, making the app self-contained.

Qt comes with a utility called macdeployqt which automatically copies the Qt frameworks (plus plugins) into the bundle, then fixes up the app binary (using install_name_tool) so the dynamic linker knows to look in the app bundle. You'll probably need to do this manually for VTK and Boost, which could be more complicated if they aren't built automatically as frameworks. They are popular libraries though, there should be guides on the Internet about deploying Mac apps with VTK/Boost.

Also, I would not use MacPorts to install Qt for this purpose. The Qt binaries available from Nokia work just fine, and they are universal (built for both 32-bit and 64-bit, in case you need to target both).

By the way, I'm not particularly a Windows guy, but I don't think throwing DLLs into System32 is a good way to deploy libraries on Windows. For a Qt app I made, we put the Qt DLLs (and mingw/gcc DLLs) into the same folder as the .exe, and it worked fine.

Brendan Shanks
  • 3,141
  • 14
  • 13
  • Why static: because I would rather waste 200MB of someone's disk space than deal with compatibility issues / runtime crashes. If the demo works well, they can assign an actual "software guy" to do this and leave me alone. – user695917 Oct 23 '11 at 17:21
  • I guess I'm really looking for an equivalent to the "DLLs and exe in one folder" on the Mac, but even this has limitations I'm sure since the system has to provide the Cocoa GUI stuff. – user695917 Oct 23 '11 at 17:53
  • The Mac equivalent of "DLLs and exe in a folder" is to make an app, copy all the frameworks/dylibs into the bundle, then do the `install_name_tool` fixup so all the library dependencies are satisfied by the libraries in the bundle. If you use `qmake`, it will generate a .app bundle, then you run `macdeployqt` to copy in the Qt libraries. For VTK and Boost, you can probably copy the dylibs (maybe built by MacPorts) into the Frameworks folder, then do `install_name_tool` manually. Just be careful about i386 vs. x86_64 for your app and VTK/Boost. – Brendan Shanks Oct 23 '11 at 21:13
  • ok getting close, I think. I'd be willing to pay a couple hundred $ though if someone could bang out a Mac package if I show how to build in ubuntu, this is really wasting a disproportionate amount of time for me. contact: karasevpa@gmail.com – user695917 Oct 24 '11 at 17:29