patchGNU Octave - Patches: patch #8314, Patch to build system to use...


patch #8314: Patch to build system to use @rpath for Mac liboctave/libinterp

Submitter:  Michael C. Grant <mcgrant>
Submitted:  Thu 13 Feb 2014 04:22:13 PM UTC
Category:  Core : other Priority:  5 - Normal
Status:  Need Info Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Fri 03 Jan 2020 03:28:07 AM UTC, comment #7: 

Hi Rik,

Its isn't necessary, but is desirable. The RPATH allows the bundled executable to run from any location. For now, it must reside in the standard application directory.

Ben Abbott <bpabbott>
Group Member
Fri 03 Jan 2020 12:36:51 AM UTC, comment #6: 

This patch is originally from 2014, and the last comments were in 2016.  Is it still necessary for Mac systems to modify the rpath variable?

Rik <rik5>
Group administrator
Fri 05 Aug 2016 08:36:39 PM UTC, comment #5: 

This patch needs to be updated to work with the current build system.

It seems to me that things like

-$(INSTALL_NAME_TOOL) -id @rpath/liboctinterp.2.dylib .libs/liboctinterp.2.dylib

should not be hard-coding the library version number.  There are now variables for those.

the liboctave, libinterp, libgui, and src directories now have files instead of separate files.  So there can be only one all-local target, in the top-level Makefile.  I suggest adding {lib{octave,interp,gui},src}-all-local targets as dependencies of all-local, and defining those targets in teh corresponding files.

John W. Eaton <jwe>
Group administrator
Thu 07 Jul 2016 11:15:15 PM UTC, comment #4: 

Ben, could you comment on whether this should go into 4.2.0?

Lachlan Andrew <lachlan>
Tue 25 Mar 2014 02:22:08 PM UTC, comment #3: 

Hey, is there any chance we can get this patch committed to gui-release? Since John has designated that branch as a sort of a "sandbox" for making Octave and CVX play friendly with each other, it would be helpful to have this in there.

This particular makes MEX files portable across Mac installations (assuming no other external dependencies). It has no impact on Linux or Windows. It is similar to the approach employed by Octave-Forge, I believe, when building a Mac app bundle for Octave.

Michael C. Grant <mcgrant>
Sat 22 Feb 2014 05:14:55 PM UTC, comment #2: 

Added liboctgui.0.dylib to the @rpath treatment. Necessary if the end goal is to make the package relocatable.

(file #30641)

Michael C. Grant <mcgrant>
Thu 13 Feb 2014 07:33:29 PM UTC, comment #1: 

Patch amended slightly to bypass errors that occur if "install_name_tool -add_rpath" is run twice on the same executable (as will happen with, say, "make all; make install"). Please use rpath2.diff instead of rpath.diff.

(file #30541)

Michael C. Grant <mcgrant>
Thu 13 Feb 2014 04:22:13 PM UTC, original submission:  

The following patch inserts additional build steps (using "all-local") in libinterp/Makefile, liboctave/Makefile, and src/Makefile so that these internal libraries and the binaries use the @rpath construct.

Specifically, the libraries' "install names" are changed to @rpath/liboctinterp.2.dylib and @rpath/liboctave.2.dylib, and the executables add $(octlibdir) to their RPATH list.

Why does this matter? It enables MEX/OCT files to be shared between users without recompilation and without having to resort to DYLD_LIBRARY_PATH tricks. I believe this is already possible for Linux and/or Windows, but these steps are needed for the Mac. (Indeed, Octave Forge's app bundles have to do something like this on a larger scale).

If you study the patch you will see I attempted to ensure that this is engaged ONLY on a Mac, only when shared libraries are being built, and only when the 'install_name_tool' utility is available. So this should leave builds for all other platforms unchanged.

Michael C. Grant <mcgrant>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #30641:  rpath3.diff added by mcgrant (3KiB - application/octet-stream)
file #30541:  rpath2.diff added by mcgrant (3KiB - application/octet-stream)
file #30538:  rpath.diff added by mcgrant (3KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by lachlan
  • -email is unavailable- added by mcgrant (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-01-03 rik5 StatusNone Need Info
    2016-07-07 lachlan CategoryNone Core : other
    2016-07-07 lachlan Carbon-Copy- Added bpabbott
    2014-02-22 mcgrant Attached File- Added rpath3.diff, #30641
    2014-02-13 mcgrant Attached File- Added rpath2.diff, #30541
    2014-02-13 mcgrant Attached File- Added rpath.diff, #30538

    Back to the top

    Powered by Savane 3.13-1277.
    Corresponding source code