bugGNU Octave - Bugs: bug #55033, mkoctfile link failure on macos


bug #55033: mkoctfile link failure on macos

Submitted by:  Carlo de Falco <cdf>
Submitted on:  Fri 16 Nov 2018 06:38:47 AM UTC  
Category:  Configuration and Build System Severity:  5 - Blocker
Priority:  5 - Normal Item Group:  Other
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  Mac OS

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Sat 05 Jan 2019 06:30:05 PM UTC, comment #29:

@Ben: I've pushed your change. Let's see if anyone reports any problems when we push 5.0 release candidates. I think the code does the right thing and that we are okay.

Rik <rik5>
Project Administrator
Sat 05 Jan 2019 05:00:06 PM UTC, comment #28:


If the changed to configure.ac causes problems with other platforms, the change can be made in src/mkoctfile.in.cc in a manner similar to Windows.

I expect the current implementation which removes the la-files and adds liboctave and liboctinterp is correct.

Ben Abbott <bpabbott>
Project Member
Wed 02 Jan 2019 07:11:11 PM UTC, comment #27:

Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Wed 02 Jan 2019 05:55:37 PM UTC, comment #26:


I just pulled revision 16607f64eea1 (stable) I made a completely
clean new build and installed it.

given the file pippo.cc

the following test works for me

I think it would be OK to mark this as fixed.
Thanks to Ben for the patch!

Carlo de Falco <cdf>
Project Member
Wed 02 Jan 2019 05:24:01 PM UTC, comment #25:

Yes, please test stable as that will become the new 5.0 release.

Rik <rik5>
Project Administrator
Wed 02 Jan 2019 04:53:25 PM UTC, comment #24:


I just started a new build of the default branch with Ben's
patch a few minutes before you pushed.

I now see you pushed to stable and did not merge to default,
would it be more useful if I test the stable branch instead of default?

Carlo de Falco <cdf>
Project Member
Wed 02 Jan 2019 04:44:09 PM UTC, comment #23:

@Ben: I pushed your changeset to stable. The only change I made was to be a bit more specific in the commit message. These changes don't affect everyone, just Mac users and those who have configure to link all dependencies. The commit message I used was

I'm marking this as ready for test which really means Carlo since neither Mike nor I have a Mac system.

Rik <rik5>
Project Administrator
Wed 02 Jan 2019 06:31:45 AM UTC, comment #22:

Updated changeset.

(file #45833)

Ben Abbott <bpabbott>
Project Member
Wed 02 Jan 2019 03:21:51 AM UTC, comment #21:

Below in mkoctfile.in.cc is a possibility.

But I don't know how to check if link_all_deps is true.

OCT_LINK_OPTS looks to be setup for building octave, and not for mkoctfile by users.

I'm attached the diff converted to a changeset.

(file #45831)

Ben Abbott <bpabbott>
Project Member
Tue 01 Jan 2019 04:03:44 PM UTC, comment #20:

@Ben: I don't have any problems wit the diff you submitted so why don't you turn it in to a full changeset.

As for where to place linker options like "-Ldirectory", I think I would defer to Mike on that. The command in mkoctfile.in.cc is

If this is known at configure time it could go in to the variable OCT_LINK_OPTS.

Alternatively, it could go into a regular shell environment variable LFLAGS.

The naming convention of LFLAGS (which are really for lex flags) rather than using the stand LDFLAGS is already the subject of bug report #48678.

Rik <rik5>
Project Administrator
Tue 01 Jan 2019 01:56:39 PM UTC, comment #19:

I have a patch that works for me. I'm still too unfamiliar with this part of the code to be comfortable, and expect changes will be needed.

I'm happy to convert to a changeset once problems are resolved.

(file #45822)

Ben Abbott <bpabbott>
Project Member
Tue 01 Jan 2019 12:17:49 PM UTC, comment #18:

The patch below almost works.

It is still necessary to add the path to Octave's libs.

I don't see how to include the OCTLIBDIR in configure.ac. If there isn't a way, I'll need to add the -L$OCTLIBDIR in mkoctfile.in.cc. Thoughts?

Ben Abbott <bpabbott>
Project Member
Tue 01 Jan 2019 03:51:19 AM UTC, comment #17:



Sorry, you are correct. I misunderstood, and was under the impression that MKOCTFILE_OCT_LINK_DEPS should be set to "libinterp/liboctinterp.la liboctave/liboctave.la" with --enable-link-all-dependencies. That obviously created a conundrum for me.

Thanks for the repeating until it sunk in.


As my build on macOS is now stable, I'm installing 6.0.0.

Thanks for tracing the symbols. I'm left with the impression that there is an incomplete work in progress. I'd be more comfortable moving forward if I understood the what was intended. In any event, the definitions below exist.

LIBOCTAVE = "-loctave"
LIBOCTINTERP = "-loctinterp"

Thus, I’m inclined to make the change …


Does that make sense?


Ben Abbott <bpabbott>
Project Member
Mon 31 Dec 2018 11:15:00 PM UTC, comment #16:

It sounds as though the following is true:

1) --enable-link-all-dependencies is required on Mac platforms.

This adds "libinterp/liboctinterp.la liboctave/liboctave.la" to the link command when creating a .oct file in the build system when compiling an Octave distribution.

2) Run 'make install'

I wasn't sure if this was actually getting run on Ben's machine.

3) mkoctfile helloworld.cc

The installed version of mkoctfile should use MKOCTFILE_OCT_LINK_DEPS. This is the code in mkoctfile.in.cc which looks correct.

4) The variable %OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS% is substituted by build-aux/subst-config-vals.in.sh

5) MKOCTFILE_OCT_LINK_DEPS is defined in configure.ac by the following.

I think the line that defines MKOCTFILE_OCT_LINK_DEPS is where I would start. I don't think it should include $OCT_LINK_DEPS because that is what is getting you liboctinterp.la and liboctave.la. Secondarily, MKOCTFILE_LIBOCTINTERP_LINK_DEPS doesn't exist anywhere in the source tree so it is useless. As a start, maybe try

Rik <rik5>
Project Administrator
Mon 31 Dec 2018 06:51:15 PM UTC, comment #15:

I hope it doesn't look like I'm repeating myself, but the task needed is to make sure that MKOCTFILE_OCT_LINK_DEPS has the right contents. "libinterp/liboctinterp.la liboctave/liboctave.la" is clearly not the right contents.

Mike Miller <mtmiller>
Project Administrator
Mon 31 Dec 2018 12:31:12 PM UTC, comment #14:

Based upon what I saw below (comment #13), I tried adding the expected content of OCTAVE_LIBS and their path. The result was successful.

I also modified mkoctfile (lines 304-305)

OCTAVE_LIBS contains the intended symbols.


Should OCTAVE_LIBS and OCTLIBDIR being finding their way into the link phase automatically?

Ben Abbott <bpabbott>
Project Member
Mon 31 Dec 2018 09:49:42 AM UTC, comment #13:

Comparing verbose output from mkoctfile. Octave 4.2.1 works and Octave 6.0.0 fails.

Octave-6.0.0 Compile:

Octave-4.2.1 Compile:

Octave-6.0.0 Link:

Octave-4.2.1 Link:

There are other differences, but the two that stands out are " -loctinterp -loctave" is missing from 6.0.0 and "ibinterp/liboctinterp.la liboctave/liboctave.la" is present.

For both 4.2.1 and 6.0.0 "mkoctfile -p OCTAVE_LIBS" returns "-loctinterp -loctave". But the link phase for 6.0.0 does not include these libs.

Ben Abbott <bpabbott>
Project Member
Mon 31 Dec 2018 08:18:11 AM UTC, comment #12:

Hi Carlo,

I've played a bit. I don't see a simple fix. From the default branch ...

Now with the proper path to the la-files

Ben Abbott <bpabbott>
Project Member
Mon 31 Dec 2018 06:45:45 AM UTC, comment #11:

Hi Ben,

I think -—enable-link-all-dependencies is needed on macos.

without -—enable-link-all-dependencies mkoctfile.cc has

but the build fails at the linking stage


Carlo de Falco <cdf>
Project Member
Mon 31 Dec 2018 04:32:31 AM UTC, comment #10:

From what I can tell MKOCTFILE_OCT_LINK_DEPS and OCT_LINK_DEPS are empty during the build process for Octave 5.0 ... in case it matters, I'm using --disable-link-all-dependencies now.

You mentioned your OCT_LINK_DEPS on line 304 of mkoctfile.cc is empty. Does that mean ...

MKOCTFILE_OCT_LINK_DEPS is not used by mkoctfile for Octave 5.0, and did not exist for Octave 4.2.

Any idea which systems would have non-empty MKOCTFILE_OCT_LINK_DEPS and/or OCT_LINK_DEPS? Would "libinterp/liboctinterp.la liboctave/liboctave.la" ever be a valid for post install mkoctfile?

Ben Abbott <bpabbott>
Project Member
Mon 31 Dec 2018 03:59:48 AM UTC, comment #9:

You'll want to trace those variables yourself to see what the values are and where they come from.

mkoctfile.cc comes from mkoctfile.in.cc by way of a set of sed substitions. The script that calls sed is build-aux/subst-cross-config-vals.sh, which is in turn built from build-aux/subst-cross-config-vals.in.sh. I think you'll see that it all traces back to variables defined in configure.

Like I said, there needs to be one set of linker options for building oct files inside of the Octave build tree, before mkoctfile exists, and another set of linker options for building oct files outside of the Octave build, after Octave is installed and mkoctfile exists.

On my system these are all empty strings so I can't easily compare notes against a system where they need to be defined correctly.

Mike Miller <mtmiller>
Project Administrator
Mon 31 Dec 2018 03:08:59 AM UTC, comment #8:

mkoctfile includes the part below.

I don't see MKOCTFILE_OCT_LINK_DEPS in my mkoctfile.cc (not in 4.4 or 5.0).

Are they each present in yours?

Ben Abbott <bpabbott>
Project Member
Mon 31 Dec 2018 02:51:31 AM UTC, comment #7:

Yes, I meant --enable-link-all-dependencies.

No, they are not valid after installing Octave, that's what I understand is the intended difference between OCT_LINK_DEPS (for building oct files in-tree) and MKOCTFILE_OCT_LINK_DEPS (for building oct files with mkoctfile). If these two variables have the same value, then that's probably where to start.

Mike Miller <mtmiller>
Project Administrator
Mon 31 Dec 2018 02:45:50 AM UTC, comment #6:

@Mike, I assume you meant --enable-link-all-dependencies?

Are libinterp/liboctinterp.la liboctave/liboctave.la valid on linux after install? I don't see those directories in my macOS install (I'm looking at Octave 4.4).

@Carlo, building with --disable-link-all-dependencies results in ...

Can you check if this breaks mkoctfile on macOS?

Ben Abbott <bpabbott>
Project Member
Mon 31 Dec 2018 02:01:12 AM UTC, comment #5:

We have two sets of variables, OCT_LINK_DEPS and MKOCTFILE_OCT_LINK_DEPS. On a GNU/Linux system, these are both empty by default, oct files can be built with undefined symbols, and they will be resolved at run time.

On a system with --enable-all-link-dependencies, I think that OCT_LINK_DEPS should be set to "libinterp/liboctinterp.la liboctave/liboctave.la" and MKOCTFILE_OCT_LINK_DEPS should be set to "-loctinterp -loctave", plus whatever system libraries are needed. Otherwise the oct file build will fail with undefined symbols.

Mike Miller <mtmiller>
Project Administrator
Mon 31 Dec 2018 01:30:25 AM UTC, comment #4:


I'll comment, please correct if I leave anything relevant out.

The mkoctfile on macOS has spurious libs ('libinterp/liboctinterp.la' and 'libinterp/liboctave.la') appended to the link command.

These will in general not exist, UNLESS launching mkoctfile from the root of the build tree.


Would anything break if we skipped appending these libs when OCT_LINK_DEPS is empty?

Ben Abbott <bpabbott>
Project Member
Sun 30 Dec 2018 09:45:08 PM UTC, comment #3:

@Ben, @Carlo: I saw traffic on the Octave-Maintainer's list related to mkoctfile on Mac platforms. Is there a solution we can make a part of the Octave build system?

Rik <rik5>
Project Administrator
Wed 21 Nov 2018 03:30:28 PM UTC, comment #2:

Hi Carlo,

I'd been hoping to find time to look at this since you first posted. Unfortunately, my free time for Octave is too sparse and I don't have 5" installed. Have you tried looking at the setting of variables that mkoctfille depends on to see what changed? For example in Makefile.in ...

I haven't tried before, but "mkoctfile --print VAR" should be what is needed. Also the doc-string list more variables.

Ben Abbott <bpabbott>
Project Member
Wed 21 Nov 2018 09:37:12 AM UTC, comment #1:


Is anyone else experiencing anything like this?
It is really a blocker for testing Octave 5 on the mac
because package installation does not work.

I tried all obvious workaround patches that I could think of
but cannot make up anything that works

Carlo de Falco <cdf>
Project Member
Fri 16 Nov 2018 06:38:47 AM UTC, original submission:

With a recent revision of the development branch,
building an oct-file with mkoctfile fails at the
linking stage

for comparison, see the output from mkoctfile-4.4.1

the issue seems to be that " libinterp/liboctinterp.la liboctave/liboctave.la " appended to the command

Carlo de Falco <cdf>
Project Member


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

Attach Files:

Attached Files
file #45833:  changeset.patch added by bpabbott (1KiB - application/octet-stream)
file #45831:  changeset.patch added by bpabbott (2KiB - application/octet-stream)
file #45822:  bug55033.diff added by bpabbott (2KiB - 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 rik5 (Posted a comment)
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by cdf (Submitted the item)
  • -email is unavailable- added by cdf
  • -email is unavailable- added by cdf

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-01-02 rik5 StatusPatch Submitted => Fixed
        Open/ClosedOpen => Closed
    2019-01-02 cdf StatusReady For Test => Patch Submitted
    2019-01-02 rik5 StatusPatch Submitted => Ready For Test
    2019-01-02 bpabbott Attached File- => Added changeset.patch, #45833
        StatusPatch Reviewed => Patch Submitted
    2019-01-02 bpabbott Attached File- => Added changeset.patch, #45831
    2019-01-01 rik5 StatusNeed Info => Patch Reviewed
    2019-01-01 bpabbott Attached File- => Added bug55033.diff, #45822
    2018-12-30 rik5 StatusNone => Need Info
    2018-11-16 cdf Carbon-Copy- => Added -email is unavailable-
        Carbon-Copy- => Added -email is unavailable-

    Back to the top

    Powered by Savane 3.4