Editing Create a MacOS X App Bundle Using MacPorts

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{Warning|This page is outdated (October 2019).  For more recent information, see [[Octave for macOS]].}}
 
 
== Caveats ==
 
 
Since the initial success with producing a bundle, two things have changed on the Macports end.
 
* gcc-4.7 must be used, as some dependencies are no longer supported by gcc-4.5. To look for ports using a <code>gcc45</code> variant, type <code>port rdeps gcc45</code> at the terminal's command line.
 
* The <code>sudo port mdmg octave-devel @3.6.4+atlas+docs+fltk+gcc47</code> command fails when bundling the <code>xorg-libx11</code> port.  Review the output of the command <code>port rdeps octave-devel @3.6.4+atlas+fltk+gcc47-x11+no_x11-metis</code> to identify the ports whose variants must be modified to avoid <code>gcc45</code> and <code>xorg-libx11</code>.  There is one dependency (<code>Transfig</code>) for which <code>x11</code> is not optional.  To resolve this, the <code>octave-devel</code> Portfile must be modified and the <code>Transfig</code> run-time dependency removed. This means that Xfig output is not available using Octave's <code>print()</code> function/command.
 
* While editing the Portfile for <code>octave-devel</code>, the references to <code>metis</code> should also be removed to avoid a GPL violation.
 
* Once the dependencies are resolved, the DMG may be created by <code>sudo port mdmg octave-devel @3.6.4+atlas+fltk+gcc47-x11+no_x11-metis</code>.
 
 
 
==Install MacPorts==
 
==Install MacPorts==
  
Line 19: Line 9:
 
* MacPorts has good support for Octave. A list of what MacPorts has available for Octave is [http://www.macports.org/ports.php?by=name&substr=octave here]. To install the most recent version of Octave, type {{Codeline|<nowiki>sudo port install octave-devel</nowiki>}} at the Terminal's command line. Octave has many dependencies which will be downloaded and installed prior to Octave. The entire installation process can take a few hours.
 
* MacPorts has good support for Octave. A list of what MacPorts has available for Octave is [http://www.macports.org/ports.php?by=name&substr=octave here]. To install the most recent version of Octave, type {{Codeline|<nowiki>sudo port install octave-devel</nowiki>}} at the Terminal's command line. Octave has many dependencies which will be downloaded and installed prior to Octave. The entire installation process can take a few hours.
  
MacPorts has historically been rather good a maintaining their Octave portfiles. However, there are times when the maintainers fall behind. If the current version of the [http://www.macports.org/ports.php?by=name&substr=octave-devel octave-devel] port isn't current, it will be necessary to produce a local portfile. For the remainder of this page, it is assume a local portfile is being used and that the port name is {{Codeline|<nowiki>octave-local</nowiki>}}.
+
MacPorts has historically been rather good a maintaining their Octave portfiles. However, there are times when the maintainer fall behind. If the current version of the [http://www.macports.org/ports.php?by=name&substr=octave-devel octave-devel] port isn't current, it will be necessary to produce a local portfile. For the remainder of this page, it is assume a local portfile is being used and that the port name is {{Codeline|<nowiki>octave-local</nowiki>}}.
  
 
===Install an Octave Port===
 
===Install an Octave Port===
  
MacPorts' Octave port includes the non-GPL [http://glaros.dtc.umn.edu/gkhome/views/metis METIS]. To avoid license violations do not bundle Metis with Octave and then distribute to others. In order to eliminate the Metis dependency, a local portfile may be used, and edited to remove metis. A second motivation to use a local portfile is that the portfiles for the 3.4.x and 3.6.x series did not include all dependencies for the <code>print</code> feature.  The missing dependencies are [http://www.macports.org/ports.php?by=name&substr=epstool epstool], [http://www.macports.org/ports.php?by=name&substr=pstoedit pstoedit], and [http://www.macports.org/ports.php?by=name&substr=transfig transfig].  A third motivation for a local portfile is to provide additional flexibility in resolving problems with creating an Octave DMG using the <code>port mdmg ...</code> command.  For macports 2.1.3, having the <code>xorg-libx11</code> as a dependency for Octave has been found to cause the <code>port mdmg octave-local ...</code> command to fail.  The <code>xorg-libx11</code> dependency may be avoided by specifying <code>-x11+no_x11-docs</code> as variants and by dropping the dependence to <code>transfig</code> (which has <code>xpm</code> as a dependency and <code>xpm</code> depends upon several <code>xorg-*</code> ports.
+
For the purpose of creating an App bundle using MacPorts, an Octave port must be installed. A standard MacPorts port or a local port may be used. For a local portfile it is first required that a [http://guide.macports.org/chunked/development.local-repositories.html local portfile repository be created] and the local portfile placed there.
  
A [[Prototype MacPorts PortFile|prototype portfile]] has been prepared, which does not depend upon METIS and does depend upon <code>epstool</code>, and <code>pstoedit</code> (there is no <code>transfig</code> dependency since it generates an <code>xorg-libx11</code> dependency). After [http://guide.macports.org/chunked/development.local-repositories.html creating a local portfile repository] an Octave portfile may be added to the local repository using the commands below.
+
MacPorts' Octave port includes the non-GPL [http://glaros.dtc.umn.edu/gkhome/views/metis METIS]. To avoid license violations do not bundle Metis with Octave and then distribute to others. A second motivation to use a local portfile is that the portfiles for the 3.4.x and 3.6.x series did not include all dependencies for the {{Codeline|<nowiki>print</nowiki>}} feature.  The missing dependencies are [http://www.macports.org/ports.php?by=name&substr=epstool epstool], [http://www.macports.org/ports.php?by=name&substr=pstoedit pstoedit], and [http://www.macports.org/ports.php?by=name&substr=transfig transfig]. A [[Prototype MacPorts PortFile|prototype portfile]] which does not depend upon METIS and does depend upon epstool, pstoedit, and transfig has been prepared.
 +
 
 +
After [http://guide.macports.org/chunked/development.local-repositories.html creating a local portfile repository] an Octave portfile may be added to the local repository using the commands below.
 
  <nowiki>mkdir -p ~/ports/math/octave-local
 
  <nowiki>mkdir -p ~/ports/math/octave-local
 
cp ~/Desktop/portfile ~/ports/math/octave-local</nowiki>
 
cp ~/Desktop/portfile ~/ports/math/octave-local</nowiki>
This assumes the Octave portfile had been placed on the user's Desktop, and that the local portfile repository is located in the users home folder and named <code>ports</code>. After adding the portfile, the local repository must be indexed for MacPorts to recognize it.
+
This assumes the Octave portfile had been placed on the users Desktop, and that the local portfile repository is located in the users home folder and named {{Codeline|<nowiki>ports</nowiki>}}. After adding the portfile, the local repository must be indexed for MacPorts to recognize it.
  <nowiki>cd ~/ports
+
  <nowiki>cd ~/portfile
 
portindex -f</nowiki>
 
portindex -f</nowiki>
 
Once indexed the local Octave port may be installed.
 
Once indexed the local Octave port may be installed.
  <nowiki>sudo port install octave-local @3.6.4+atlas+fltk+gcc47</nowiki>
+
  <nowiki>sudo port install octave-local +accelerate+gcc45</nowiki>
  
The use of the <code>+atlas</code> variant is encouraged as bugs exist for Apple's accelerate framework in both MacOS 10.6 and 10.7.  Octave's developers have included a fix for MacOS 10.6, but the fix does not work for MacOS 10.7.  There is some commentary on this in various developers discussion forums.  For example, see [https://github.com/mxcl/homebrew/issues/6649 this Homebrew thread (Octave 3.4 fails on lion)], [https://stat.ethz.ch/pipermail/r-sig-mac/2011-September/008564.html this R-Sig-Mac thread (R 2.13.1-patched, vecLib problem on Lion)], and [http://list.coin-or.org/pipermail/ipopt/2011-October/002610.html the COIN-OR thread (Ipopt - problems on OS X 10.7 Lion)]Use of Apple's accelerate framework should also be avoided for <code>arpack</code> and <code>qrupdate</code>.  To install the recommended variants, use the <code>port</code> commands below.
+
As a precaution against unexpected problems and a bloated App bundle, using consistent variants for Octave and its dependents is suggested.  For example, when using {{Codeline|+accelarate}} make sure none of the dependents are using {{Codeline|+atlas}}. Also, make sure no dependents are using the {{Codeline|+universal}} variant.  Using the {{Codeline|+gcc45}} variant is also recommended as all of Octave's dependents have a {{Codeline|+gcc45}} variant. At the very least, following these suggestions will reduce the size of the bundleThe name of Octave's dependent ports may be determined by the command below.
  
  <nowiki>port install arpack +atlas+gcc47
+
  <nowiki>port deps octave-local</nowiki>
port install qrupdate +atlas+gcc47</nowiki>
 
  
As a precaution against unexpected problems and a bloated App bundle, using consistent variants for Octave and its dependents is suggestedFor example, when using <code>+atlas</code> make sure none of the dependents are using <code>+accelarate</code>. Also, make sure no dependents are using the <code>+universal</code> variant.  Using the <code>+gcc47</code> variant is also recommended as all of Octave's dependents have a <code>+gcc47</code> variant.  At the very least, following these suggestions will reduce the size of the bundle.  The name of Octave's dependent ports may be determined by the command below.
+
The installed variants for each port may be determined by the command belowBe sure to replace "portname" with the name of the port.
  
  <nowiki>port rdeps octave-local</nowiki>
+
  <nowiki>port installed portname</nowiki>
  
The installed variants for each port may be determined by the command below.  Be sure to replace "<portname>" with the name of the port.
+
Once an Octave port is installed the command below may be used to determine / verify the version and variants of {{Codeline|<nowiki>octave-local</nowiki>}} which are installed.
 
 
<nowiki>port installed <portname></nowiki>
 
 
 
Once an Octave port is installed the command below may be used to determine / verify the version and variants of <code>octave-local</code> which are installed.
 
  
 
  <nowiki>port installed octave-local</nowiki>
 
  <nowiki>port installed octave-local</nowiki>
 
===Install Dependencies with Specific Variants===
 
 
There may be problems bundling some dependencies.  For example, bundling the <code>xorg-libx11</code> port may fail.  To alleviate this problem (or similar ones), the problematic port can be avoided as a dependency.  The command used to produce the octave-local DMG, <code>port mdmg octave-local +variant1+variant2+etc</code>, applies the listed variants to each of the dependencies.  Therefore, it is necessary to provide a proper aggregate list of dependencies.  For Octave 3.6.4, the list below were sufficient.
 
 
<pre>sudo port mdmg octave-devel @3.6.4+atlas+fltk+gcc47-x11+no_x11-metis+llvm32+ssl+qt</pre>
 
 
<span style="color: green;"> If run from a fresh macports installation (i.e. no ports have yet been installed), then this command should complete with no errors.</span>  If ports have already been installed, then errors during the execution of this command are likely and may be resolved by modifying the variant(s) of installed packages, and/or modifying the list of variants used to produce the <code>octave-local</code> DMG.  <span style="color: red;">One of Octave's dependencies, <code>transfig</code>, requires port <code>xpm</code>, which requires many xorg ports that may cause the <code>port mdmg ...</code> command to fail.  To alleviate this problem, the <code>transfig</code> port can be eliminated as a run-time dependency for Octave </span> (can the <code>transfig</code> portfile be modified to eliminate the <code>xpm</code> dependency?).
 
  
 
==Create the MacOS X App Bundle==
 
==Create the MacOS X App Bundle==
  
There are effectively four tasks needed to produce the App bundle. First, Octave and all its build and run-time dependencies must be extracted from the MacPorts installation. Second a App bundle template for running a shell script is required. This may be done using the MacOS X AppleScript Editor. Third, the shell script which the App bundle runs is needed. This script will be used to launch the [http://en.wikipedia.org/wiki/Terminal_(OS_X) MacOS X Terminal app]. This script is referred to as the ''App's shell script''. Finally, a script for setting up the shell environment for Octave and running Octave is required. This script is referred to as the ''Octave shell script''.
+
There are effectively four tasks needed to produce the App bundle. First, Octave and all its build and run-time dependencies must be extracted from the MacPorts installation. Second a App bundle template for running a shell script is required. This may be done using the MacOS X developer tool, Platypus. Third, the shell script which the App bundle runs is needed. This script will be used to launch the [http://en.wikipedia.org/wiki/Terminal_(OS_X) MacOS X Terminal app]. This script is referred to as the ''App's shell script''. Finally, a script for setting up the shell environment for Octave and running Octave is required. This script is referred to as the ''Octave shell script''.
  
 
===Produce a DMG for Octave and its dependencies===
 
===Produce a DMG for Octave and its dependencies===
Line 67: Line 46:
 
MacPorts provides a feature for [http://guide.macports.org/index.html#using.binaries.binary-packages producing binary packages] with standalone binary installers that are precompiled; they do not require MacPorts on the target system. Binary files created with MacPorts may be either .pkg (Mac OS X Installer Packages), or RPM (RPM Package Manager) format. MacPorts may also process a .pkg package into a Mac OS X .dmg disk image file.  The port command shown below will create a DMG type binary installer for the Octave port and all its dependencies.
 
MacPorts provides a feature for [http://guide.macports.org/index.html#using.binaries.binary-packages producing binary packages] with standalone binary installers that are precompiled; they do not require MacPorts on the target system. Binary files created with MacPorts may be either .pkg (Mac OS X Installer Packages), or RPM (RPM Package Manager) format. MacPorts may also process a .pkg package into a Mac OS X .dmg disk image file.  The port command shown below will create a DMG type binary installer for the Octave port and all its dependencies.
  
  <nowiki>sudo port mdmg octave-devel @3.6.4+atlas+fltk+gcc47-x11+no_x11-metis+llvm32+ssl+qt</nowiki>
+
  <nowiki>sudo port mdmg octave-local</nowiki>
 
 
In the event errors such as the one below are encountered, the ports implicated (<code> gtk2 </code> in this case) must be clean prior to creating the dmg.
 
  
<nowiki>
+
If more than one version of Octave is installed, or if more than one variant of Octave has been installed, the version and variant should be included.
Error: Requested variants "+quartz" do not match original selection "".
 
Please use the same variants again, perform 'port clean gtk2' or specify the force option (-f).
 
Error: org.macports.mpkg for port octave-local returned: Processing of port gtk2 failed</nowiki>
 
  
Be sure to clean each of the problematic ports prior to each attempt to create the dmg.
+
<nowiki>sudo port mdmg octave-local @<version>+variant1+variant2</nowiki>
  
  <nowiki>sudo port clean gtk2</nowiki>
+
The DMG will be placed in the port's {{Codeline|<nowiki>work</nowiki>}} directory. If a local portfile is used, a symbolic link to the {{Codeline|<nowiki>work</nowiki>}} directory will be placed in the directory containing the portfile.  In this instance the DMG can be found in {{Codeline|<nowiki>~/ports/math/octave-local/work</nowiki>}}.
  
The ports <code>cctools</code> and <code>curl</code> consistently need to be cleaned prior to the <code>port mdmg octave-local ...</code> commandThe reason for this is not understood (yet), but one hint is seen during the compilation of the DMG.
+
The DMG produced using the [http://www.octave.org/wiki/index.php?title=Prototype_MacPorts_PortFile prototype portfile's] does not include everything needed for Octave.  Both {{Codeline|macros.texi}}, {{Codeline|octave.info}}, and the {{Codeline|octave.info-#}} files are missingUntil the cause for these missing files is identified and resolved, they will have to be copied manually to the App bundle.
  
<pre>Portfile changed since last build; discarding previous state.</pre>
+
===Use Platypus to produce a template for the App bundle===
  
The DMG will be placed in the port's <code>work</code> directory. If a local portfile is used, a symbolic link to the <code>work</code> directory will be placed in the directory containing the portfile.  In this instance the DMG can be found in <code>~/ports/math/octave-local/work</code>.
+
[[File:Platypus.png|400px|thumb|right|Initial Platypus Dialog (click to enlarge)]]
  
The DMG produced using the [http://www.octave.org/wiki/index.php?title=Prototype_MacPorts_PortFile prototype portfile's] does not include everything needed for Octave.  Both <code>macros.texi</code>, <code>octave.info</code>, and the <code>octave.info-#</code> files are missingUntil the cause for these missing files is identified and resolved, they will have to be copied manually to the App bundle (one possibility is that the <code>+docs</code> variant is not used.  Including the <code>+docs</code> variant would bundle <code>texlive</code> port as well as <code>xorg-libx11</code> and several other <code>xorg-*</code> ports.
+
To creating an application bundle for MacOS X the utility, [http://sveinbjorn.org/platypus Platypus], is usedPlatypus is a developer tool for the Mac OS X operating system which is intended to create native Mac OS X applications from interpreted scripts such as shell scripts or Perl, Ruby and Python programs.
  
===Create an Application Template for Octave===
+
A shell script intended to launch a [http://en.wikipedia.org/wiki/Terminal_(OS_X) MacOS X Terminal] and run Octave will be used as the basis for the MacOS X App bundle.  The itemize list below describes how to produce an App bundle template for Octave.  Once this has been done, it the App bundle template must be populated with Octave and its dependencies.
  
[[File:AppleScriptEditor.png|350px|thumb|right|Apple Script Editor Dialog (click to enlarge)]]
+
* Run the Platypus application.
 
+
* Import Octave's [http://www.octave.org/wiki/index.php?title=File:Icon.png icon].
The itemized instructions below describe how to create an application template for Ocave using the AppleScript Editor.
+
** The icon linked to above is a png with a transparent background.  This feature is needed to produce a MacOS X application icon.
* Run the "AppleScript Editor" and enter the script below.
+
** Using the icon linked to above the ''Icon Composer'' developers utility may be used to create a MacOS X icon. The Icon Composer is part of Xcode's developer's tools. Its home is {{Codeline|<nowiki>/Developer/Applications/Icon Composer.app</nowiki>}}
<nowiki># Run the octave shell script that has be bundled.
+
* Set the "Script Type" to "Shell"
tell application "Terminal"
+
* Specify the "Script Path".
# The script "launch_octave" will call the octave shell script and then close
+
** Click on the "Select" button and select the [[MacOS_X_App_Launcher_Script|App shell script]] used to launch the Terminal app.
# this AppleScript when octave exits.
+
* Set the "Output" to "None".
do script quoted form of POSIX path of (path to me) & "Contents/Resources/bin/launch_octave '" & (name of me) & "'; sleep 1; exit"
+
* Specify App Name (Octave-3.7.0+).
end tell</nowiki>
+
* Click the "Create" button.
* Choose "Save As..." from the <b>File</b> menu.
+
* Save the App bundle template to the location of your choice.
** Specify the application name in the <b>Save As:</b> field.  For this example, use "Octave-3.7.0+.app".
 
** The <b>Where:</b> field specifies the location the application template will be saved to.
 
** The <b>File Format:</b> pull down should be set to "Application".
 
** Of the <b>Options</b>, only "Stay Open" should be checked.
 
** Click on <b>Save</b>.
 
 
 
The [[launch_octave|launch_octave]] shell script runs the Octave shell script and uses AppleScript to tell the App bundle to quit when Octave exits.
 
 
 
The default applet.icns file which is included in the App bundle template by the AppleScript editor should be replaced by a MacOS X version of [http://www.octave.org/wiki/index.php?title=File:Icon.png Octave's icon].  This MacOS version was produced using the ''Icon Composer'' developers utility and a png with a transparent background. The Icon Composer is part of Xcode's developer's tools. Its home is {{Codeline|<nowiki>/Developer/Applications/Icon Composer.app</nowiki>}}.
 
  
 
===Populate the App Bundle===
 
===Populate the App Bundle===
Line 118: Line 83:
 
  <nowiki>sudo mv /opt /opt-save</nowiki>
 
  <nowiki>sudo mv /opt /opt-save</nowiki>
 
* Install the MacPorts Octave DMG, which as placed on the MacOS X Desktop.  Installing the DMG will create a new {{Codeline|<nowiki>/opt</nowiki>}} directory containing Octave and all its build and run-time dependencies. To avoid conflict with the original MacPorts installation.
 
* Install the MacPorts Octave DMG, which as placed on the MacOS X Desktop.  Installing the DMG will create a new {{Codeline|<nowiki>/opt</nowiki>}} directory containing Octave and all its build and run-time dependencies. To avoid conflict with the original MacPorts installation.
* Place the [[MacOS_X_App_Octave_Shell_Script| Octave shell script]] in the same directory as the App bundle template created using the AppleScript Editor.
+
* Place the [[MacOS_X_App_Octave_Shell_Script| Octave shell script]] in the same directory as the App bundle template created using Platypus.
* Populate the App bundle by running the script below from the directory containing the App bundle template and the [[MacOS_X_App_Octave_Shell_Script| Octave shell script]].
+
* Populate the App bundle by running the script below from the directory containing the Platypus App bundle template and the [[MacOS_X_App_Octave_Shell_Script| Octave shell script]].
 
  <nowiki>#! /bin/sh
 
  <nowiki>#! /bin/sh
 
VERSION=3.7.0+
 
VERSION=3.7.0+
Line 126: Line 91:
 
MACPORTS_PREFIX="/opt/local/"
 
MACPORTS_PREFIX="/opt/local/"
 
cp -pRf ${MACPORTS_PREFIX} ${FULLAPP}/Contents/Resources/.
 
cp -pRf ${MACPORTS_PREFIX} ${FULLAPP}/Contents/Resources/.
rm ${FULLAPP}/Contents/Resources/lib/*.a
 
 
rm ${FULLAPP}/Contents/Resources/bin/octave
 
rm ${FULLAPP}/Contents/Resources/bin/octave
cp launch_octave ${FULLAPP}/Contents/Resources/bin/.
 
 
cp octave ${FULLAPP}/Contents/Resources/bin/.
 
cp octave ${FULLAPP}/Contents/Resources/bin/.
 
mkdir ${FULLAPP}/Contents/Resources/Applications
 
mkdir ${FULLAPP}/Contents/Resources/Applications
Line 137: Line 100:
  
 
The Octave App bundle for MacOS X is now ready to run.
 
The Octave App bundle for MacOS X is now ready to run.
 
===Create an Installer DMG===
 
 
The GPL'd [http://dmgcreator.sourceforge.net/en/ dmgCreater] is a Mac OS X Application which allows simple and easy creation of customized dmg disk images with custom background images. It ensures the correct presentation of the disk image's content irrespective of the current Finder configuration.
 
 
A short list of features from the dmgCreator sourceforge page are;
 
 
* Create compressed and internet enabled DMG files, i.e. for software distribution.
 
* Add a background image and a custom volume icon to your disk image.
 
* Add a symbolic link to the Applications folder for easy installation.
 
* Show localized license agreements when mounting the disk image. They have to be accepted by the user in order to access the contents.
 
* Content positioning at a pixel level.
 
* The disk image's content will always look the same, irrespective of the user's finder configuration.
 
  
 
==Running Octave from the Terminal's Command Line==
 
==Running Octave from the Terminal's Command Line==
Line 168: Line 118:
 
* When Octave is running, clicking on Octave's icon in the dock has no effect. This is because the App bundle runs a shell script which launches Terminal.app which runs Octave. To locate the Octave session, click on the Terminal.app.
 
* When Octave is running, clicking on Octave's icon in the dock has no effect. This is because the App bundle runs a shell script which launches Terminal.app which runs Octave. To locate the Octave session, click on the Terminal.app.
 
* Only one instance of the App may be run by clicking on the app.  Multiple instances may be run from the command line.
 
* Only one instance of the App may be run by clicking on the app.  Multiple instances may be run from the command line.
* The Octave binary may attempt to load an library whose version number is older than the one it intended to link to (at build time).  This will produce an error like to one below. If this happens, please report the error.
+
* In some instances, the Octave binary attempts to load an library whose version number is older than the one it intended to link to (at build time).  This will produce an error like to one below. The developer utility, [http://macdylibbundler.sourceforge.net/ dylibbundler], is useful in pointing to and/or bundling dynamic libraries in an App bundle.  This utility automates the use of [https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man1/install_name_tool.1.html {{Codeline|install_name_tool}}].  These errors may linger as the application of this tool requires some experimentation in this case.
 
  <nowiki>dyld: Library not loaded: /opt/local/libiconv.2.dylib</nowiki>
 
  <nowiki>dyld: Library not loaded: /opt/local/libiconv.2.dylib</nowiki>
  
 
===Fixing "{{Codeline|dyld: Library not loaded}}" Errors===
 
===Fixing "{{Codeline|dyld: Library not loaded}}" Errors===
If an error such as the one above is encountered, it is likely due to the Bundle looking in the original install path rather than in the App bundle for the library. This can be fixed using the developer utility [https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man1/install_name_tool.1.html {{Codeline|install_name_tool}}].
+
If an error such as the one below is encountered;
 +
<nowiki>dyld: Library not loaded: /opt/local/libiconv.2.dylib</nowiki>
 +
It is likely due to the Bundle looking in the original install path rather than in the App bundle for the library. This can be fixed using the developer utility [https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man1/install_name_tool.1.html {{Codeline|install_name_tool}}].
  
 
To point to the correct location for the library, first determine the library's location in the App bundle. In this instance the library's path is {{Codeline|Octave-3.7.0+.app/Contents/Resources/lib/libiconv.2.dylib}}. Next open a Terminal session, {{Codeline|cd}} to the Resources directory and repair Octave's binary.
 
To point to the correct location for the library, first determine the library's location in the App bundle. In this instance the library's path is {{Codeline|Octave-3.7.0+.app/Contents/Resources/lib/libiconv.2.dylib}}. Next open a Terminal session, {{Codeline|cd}} to the Resources directory and repair Octave's binary.
Line 259: Line 211:
 
  <nowiki>dylibs_fix ("bin/octave-3.7.0+", "lib", false)</nowiki>
 
  <nowiki>dylibs_fix ("bin/octave-3.7.0+", "lib", false)</nowiki>
 
The script will mirror each of the {{Codeline|otool}} commands to the screen.  Errors and/or warnings are given if any libraries are found to be missing in the bundle.
 
The script will mirror each of the {{Codeline|otool}} commands to the screen.  Errors and/or warnings are given if any libraries are found to be missing in the bundle.
 
===Reducing the Size===
 
The App bundle is large.  It's size may be significantly reduced by deleting the static libraries.
 
<nowiki>find "Octave-3.7.0+.app/Contents/Resources/lib/." -name "*.a" -exec rm -f {} \;</nowiki>
 
  
 
==Testing==
 
==Testing==
Those interested in testing an App bundle can try [https://dl.dropbox.com/u/14845154/Octave-X86_64-3.7.0%2Bv12.dmg (Dated: Sep  8, 2012 at 15:46 PM)].  The link will be periodically updated.  The DMG is large (472+ MB).  I kindly ask those with the patience to download it, to report results to bpabbott at mac dot com.  Alternatively, if a bug is found [https://savannah.gnu.org/bugs/?group=octave file a bug report]. When reporting on your experience, please include;
+
Those interested in testing an App bundle can try [https://dl.dropbox.com/u/14845154/Octave-X86_64-3.7.0%2Bv5.dmg Octave-X86_64-3.7.0+v5.dmg (Dated: Jun 29, 2012 4:23 PM)].  The link will be periodically updated.  The DMG is large (525+ MB).  I kindly ask those with the patience to download it, to report results to bpabbott at mac dot com.  Alternatively, if a bug is found [https://savannah.gnu.org/bugs/?group=octave file a bug report]. When reporting on your experience, please include;
 
* The version of MacOS X you are running.
 
* The version of MacOS X you are running.
 
** Note: This App bundle will ''not'' run on Mac OS 10.5 or earlier.
 
** Note: This App bundle will ''not'' run on Mac OS 10.5 or earlier.
Line 274: Line 222:
 
* For intricate problems, please provide enough information so that others may duplicate it.
 
* For intricate problems, please provide enough information so that others may duplicate it.
 
===Testing Results===
 
===Testing Results===
Results reported by some volunteers testing an App bundle are below.  As some of the reported results are inconsistent, individuals are cautioned not interpret these results as definitive. However, the App bundle does appear to run reliably on X86_64 based Macs running MacOS 10.6 and above.
+
Results reported by some volunteers testing an App bundle are below.  As some of the reported results are inconsistent, individuals are cautioned to not interpret these results as definitive.
 
* An App bundle built for arch=X86_64 on an Intel Core i7 MacBook Pro running MacOS 10.7 was found to run on the following;
 
* An App bundle built for arch=X86_64 on an Intel Core i7 MacBook Pro running MacOS 10.7 was found to run on the following;
:* Macbook Pro (X86_64 architecture) running MacOS 10.8.1.
 
 
:* MacBook Pro (Intel Core i7) running MacOS 10.7 with MacPorts installed.
 
:* MacBook Pro (Intel Core i7) running MacOS 10.7 with MacPorts installed.
 
:* MacBook Pro (Intel Core i7) running MacOS 10.7 with no MacPorts, and no Fink, installed.
 
:* MacBook Pro (Intel Core i7) running MacOS 10.7 with no MacPorts, and no Fink, installed.
* The App bundle did not run on Intel Core (2) Duo processors, as [http://en.wikipedia.org/wiki/X86-64#Intel_64_implementations they are not 64 bit].;
+
:* Macbook Pro (Intel Core-2 Duo 2.5 GHz) MacOS 10.6.8 with 64 bit support enabled, and with MacPorts installed.
 +
::* To enable 64bit see Apple's support page &rArr; [http://support.apple.com/kb/HT3773 OS X: Starting up with the 32-bit or 64-bit kernel].
 +
* The App bundle did not run on;
 
:* MacBook (Intel Core Duo) running MacOS 10.6 with no MacPorts, and no Fink, installed. The error encountered is below.
 
:* MacBook (Intel Core Duo) running MacOS 10.6 with no MacPorts, and no Fink, installed. The error encountered is below.
 
  <nowiki>$ cd /Applications/Octave-3.7.0+.app/Contents/Resources/bin/
 
  <nowiki>$ cd /Applications/Octave-3.7.0+.app/Contents/Resources/bin/
Line 292: Line 241:
 
what():  __gnu_cxx::__concurrence_lock_error</nowiki>
 
what():  __gnu_cxx::__concurrence_lock_error</nowiki>
 
* If anyone has advice on how to resolve any of the above errors, please send an email to bpabbott at mac dot com.
 
* If anyone has advice on how to resolve any of the above errors, please send an email to bpabbott at mac dot com.
 
+
==Plans==
==TODO List==
 
 
List of what can be done to improve the MacOS X App bundle.
 
List of what can be done to improve the MacOS X App bundle.
* The {{Codeline|macros.texi}} file doesn't install properly.  It should be in {{Codeline|share/octave/3.7.0+/etc}}, but doesn't show up.
+
* Determine which static libraries can be removed from the bundle without impacting Octave, mkoctfile, etc. Removing the static libraries should significantly reduce the size of the bundled App.
* [[Enable "linestyle" functionality for Gnuplot's x11 terminal]]
+
* Resolved the {{Codeline|__gnu_cxx::__concurrence_lock_error}} error.
* Test the ability to compile mex-files and oct-files.
+
** What is the source/cause of the {{Codeline|__gnu_cxx::__concurrence_lock_error}} error?
** Necessary changes
 
*** Use the environment variable OCTAVE_HOME in mkoctfile to point to the bundled developer tools and libraries.
 
*** Same for octave_confgure-3.7.0+
 
*** Over-ride the built-in octave_configure_info and use an m-file version that replaces the original MacPorts prefix with the OCTAVE_HOME environment variable set by the bundle.
 
*** The bundled mkoctfile references the gcc4.4 libraries instead of the gcc4.7 libraries that are actually bundled.  This needs to be corrected.
 
** With the above changes [http://www.gnu.org/software/octave/doc/interpreter/Getting-Started-with-Oct_002dFiles.html {{Codeline|mkoctfile helloworld.cc}}] fails with the error below.  This is likely due to the {{Codeline|Octave-3.7.0+.app/Contents/Resources/bin/octave}} script over-riding the build environment variables normally set by {{Codeline|mkoctfile}}.
 
*** Rely on {{Codeline|mkoctfile}} to setup the oct-file build environment (i.e. don't set any of it up in the {{Codeline|.../Octave-3.7.0+.app/Contents/Resources/bin/octave}} script.
 
*** Since {{Codeline|mkoctfile}} uses it, {{Codeline|gsed}} needs to be added as a run time dependency in the [[Prototype MacPorts PortFile|MacPorts portfile]].  Check to verify that other build time dependencies are not also need.
 
<nowiki>mkoctfile -v helloworld.cc
 
 
 
ld: library not found for -lgcc
 
collect2: ld returned 1 exit status
 
 
 
"/Applications/Octave-3.7.0+.app/Contents/Resources/bin/g++-mp-4.7" \
 
-c -I"/Applications/Octave-3.7.0+.app/Contents/Resources/include/curl" \
 
-I"/Applications/Octave-3.7.0+.app/Contents/Resources/include/readline" -fPIC \
 
-I"/Applications/Octave-3.7.0+.app/Contents/Resources/include/Octave-3.7.0+/octave"/.. \
 
-I"/Applications/Octave-3.7.0+.app/Contents/Resources/include/Octave-3.7.0+/octave" \
 
-I"/Applications/Octave-3.7.0+.app/Contents/Resources/include/Octave-3.7.0+" \
 
-I"/Applications/Octave-3.7.0+.app/Contents/Resources/include/curl" \
 
-I"/Applications/Octave-3.7.0+.app/Contents/Resources/include/readline" \
 
helloworld.cc -o helloworld.o
 
 
 
"/Applications/Octave-3.7.0+.app/Contents/Resources/bin/g++-mp-4.7" -bundle -bundle_loader \
 
"/Applications/Octave-3.7.0+.app/Contents/Resources/bin/octave-3.7.0+" -o helloworld.oct helloworld.o \
 
-L"/Applications/Octave-3.7.0+.app/Contents/Resources/lib/octave/3.7.0+" \
 
-L"/Applications/Octave-3.7.0+.app/Contents/Resources/lib" -loctinterp -loctave -lcruft \
 
"/Applications/Octave-3.7.0+.app/Contents/Resources/lib/gcc47/libstdc++.6.dylib"</nowiki>
 
 
* Should the contents of the la-files, in {{Codeline|Octave-3.7.0+.app/Resources/lib}}, be changed to reflect to use the {{Codeline|@executable_path}} token.
 
* Should the contents of the la-files, in {{Codeline|Octave-3.7.0+.app/Resources/lib}}, be changed to reflect to use the {{Codeline|@executable_path}} token.
** These files are from libtool.  For limited development, such as building oct-files and mex-files, are they needed at all?
+
[[Category:Mac]]
* Use AppleScript Editor to record the creation of the App bundle template.
 
** This will allow for a fully automatic build of an App bundle from a shell script.
 
* Also use an AppleScript to record the creation of a MacOS X Octave icon.
 
 
 
[[Category:Outdated pages]]
 

Please note that all contributions to Octave may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Octave:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Templates used on this page: