bugGNU Octave - Bugs: bug #41574, Current build approach causes...


bug #41574: Current build approach causes mkoctfile to link to too many libraries on the Mac (patch supplied)

Submitter:  Michael C. Grant <mcgrant>
Submitted:  Thu 13 Feb 2014 12:07:22 AM UTC
Category:  Configuration and Build System Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Michael C. Grant Open/Closed:  * Closed
Release:  * dev Operating System:  * Mac OS
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


( Jump to the original submission )

Fri 03 Aug 2018 07:03:39 PM UTC, comment #10: 

I think this seems to be fixed now.

When building a "helloworld" octfile using Octave 4.4.0 on macOS 10.13.6 built with Qt, it does not seem to be picking up links to additional dependencies. (Aside from liboct and liboctinterp, as discussed in #53627.)

$ cat helloworld.cc
#include <octave/oct.h>

DEFUN_DLD (helloworld, args, nargout,
           "Hello World Help String")
  int nargin = args.length ();

  octave_stdout << "Hello World has "
                << nargin << " input arguments and "
                << nargout << " output arguments.\n";

  return octave_value_list ();
$ otool -L helloworld.oct
        /usr/local/opt/octave-octave-app/lib/octave/4.4.0/liboctinterp.5.dylib (compatibility version 6.0.0, current version 6.0.0)
        /usr/local/opt/octave-octave-app/lib/octave/4.4.0/liboctave.5.dylib (compatibility version 6.0.0, current version 6.0.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)

Similarly, the octfiles generated as part of `pkg install -forge control` do not appear to have a bunch of extra linkages.

$ otool -L __control_helper_functions__.oct
        /usr/local/opt/octave-octave-app/lib/octave/4.4.0/liboctinterp.5.dylib (compatibility version 6.0.0, current version 6.0.0)
        /usr/local/opt/octave-octave-app/lib/octave/4.4.0/liboctave.5.dylib (compatibility version 6.0.0, current version 6.0.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
$ otool -L __control_slicot_functions__.oct
        /usr/local/opt/veclibfort/lib/libvecLibFort.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/local/opt/gcc/lib/gcc/8/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
        /usr/local/opt/gcc/lib/gcc/8/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
        /usr/local/opt/octave-octave-app/lib/octave/4.4.0/liboctinterp.5.dylib (compatibility version 6.0.0, current version 6.0.0)
        /usr/local/opt/octave-octave-app/lib/octave/4.4.0/liboctave.5.dylib (compatibility version 6.0.0, current version 6.0.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
        /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)

Or do I need to do something like write an octfile that actually uses Qt functions to trigger the bad behavior?

Andrew Janke <apjanke>
Thu 12 Jul 2018 02:46:50 PM UTC, comment #9: 

Try using "otool -L <filename>".

Michael C. Grant <mcgrant>
Thu 12 Jul 2018 02:41:23 PM UTC, comment #8: 

I'm not sure whether this is fixed properly.  If .oct files on the mac are still linked with all the dependencies, then that should still be fixed.  I revived the OS X buildbot (using buildbot version 1.1) so can check in a few hours.  On the mac, how do I find what libraries something is linked with?  What's the equivalent of ldd there?

John W. Eaton <jwe>
Project Administrator
Thu 12 Jul 2018 12:06:26 AM UTC, comment #7: 

@jwe: A whole lot of work has gone in to mkoctfile since this bug was last commented on in 2016.  Can we just close it?

Rik <rik5>
Project Administrator
Fri 05 Aug 2016 07:12:20 PM UTC, comment #6: 

Sorry for the long delay.  I applied the part about -framework here:


I'm not sure about the part for the link dependencies now since the build system has changed.  If this is still needed, it will have to be modified to set the variables in the configure script instead of in the libgui/link-deps.mk file (it's been removed).

John W. Eaton <jwe>
Project Administrator
Fri 28 Mar 2014 01:30:23 AM UTC, comment #5: 

Note: this effectively solves the issue in #41460 as well; but if one is to be closed as a duplicate, it should be that one, since this one at least has a patch.

Michael C. Grant <mcgrant>
Tue 25 Mar 2014 02:24:56 PM UTC, comment #4: 

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 patch help make MEX files portable across Mac installations (assuming no other external dependencies). In this case, it reduces the number of dependencies that are linked to MEX/Oct files on the Mac. It is designed to have no impact on Linux or Windows.


Michael C. Grant <mcgrant>
Fri 21 Feb 2014 08:04:44 PM UTC, comment #3: 

AMCOND_LINK_GUI_DEPS and AMCOND_LINK_ALL_DEPS diverge on the Mac when Qt is linked in via a non-system framework. In that case, AMCOND_LINK_GUI_DEPS becomes "true" no matter what happens to AMCOND_LINK_ALL_DEPS.

Michael C. Grant <mcgrant>
Fri 21 Feb 2014 08:03:15 PM UTC, comment #2: 

Since the new AMCOND_LINK_GUI_DEPS is set by the same variable ($link_all_deps) as AMCOND_LINK_ALL_DEPS, how does that change anything?

John W. Eaton <jwe>
Project Administrator
Fri 21 Feb 2014 07:05:54 PM UTC, comment #1: 

I've modified this patch based on new compilation errors that arise when it is combined with the QtHandles additions.

I noted that the "-framework Carbon" and the "-framework OpenGL" flags were wrapped in "-Wl," prefixes so they would be delivered directly to the linker. However, the current build of libtool knows how to handle "-framework" flags; and it needs to handle them so it can propagate dependencies properly.

Removing those prefixes eliminates the OpenGL linking errors I was seeing with the QtHandles library. (To be fair, I could have left -framework Carbon alone, but I do believe it is the right thing to remove them.)

(file #30634)

Michael C. Grant <mcgrant>
Thu 13 Feb 2014 12:07:22 AM UTC, original submission:  

Earlier I submitted a patch for bug #41236 that allowed the Mac to properly link octave-gui to Qt when made available as a non-system framework. Effectively, my patch required turning on the "---enable-link-all-deps" whenever this scenario is encountered.

Unfortunately, this had the consequence that mkoctfile would link MEX/OCT files to every Octave dependency. This makes distributing binary OCT/MEX files difficult. On octave-maintainers, JWE agreed this should be fixed, so I have sought a solution.

What I've done is create a new Automake variable AMCOND_LINK_GUI_DEPS that, nominally, obtains the same value as AMCOND_LINK_ALL_DEPS. However, whenever the above Qt scenario is encountered on a Mac, it is set to "true", even if AMCOND_LINK_ALL_DEPS is "false". The downstream Makefiles related to the GUI have been adjusted to include the GUI dependencies in the link list for octave-gui if this scenario is encountered.

This is a much gentler solution to the previous problem, then. I've successfully compiled on the Mac with this patch.

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 #30634:  qtmac2.diff added by mcgrant (3KiB - application/octet-stream)
file #30530:  macgui.diff added by mcgrant (2KiB - application/octet-stream)


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by apjanke (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by jwe (Posted a comment)
  • -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 project members can vote.





    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-03 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2014-03-28 mtmiller Dependencies- bugs #41460 is dependent
    2014-03-27 mtmiller StatusNone Patch Submitted
    2014-02-21 mcgrant Attached File- Added qtmac2.diff, #30634
    2014-02-13 mcgrant Attached File- Added macgui.diff, #30530

    Back to the top

    Powered by Savane 3.9