bugGNU Octave - Bugs: bug #42002, pkg/mkoctfile need to support...

 
 

bug #42002: pkg/mkoctfile need to support '-framework' flags; patch supplied

Submitter:  Michael C. Grant <mcgrant>
Submitted:  Sun 30 Mar 2014 02:18:57 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Michael C. Grant Open/Closed:  * Closed
Release:  * 3.8.1 Operating System:  * Mac OS
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 22 Feb 2015 05:50:48 PM UTC, comment #9: 

I think this is now fixed, mkoctfile for the upcoming 4.0 release will accept any options that start with "-":

http://hg.savannah.gnu.org/hgweb/octave/rev/b59aabc08e63

Mike Miller <mtmiller>
Group Member
Mon 31 Mar 2014 08:25:12 PM UTC, comment #8: 

Changeset attached.

(file #31091)

Michael C. Grant <mcgrant>
Mon 31 Mar 2014 07:36:20 PM UTC, comment #7: 

That sounds reasonable. As I indicated earlier, consistency is the key. I will work on a patch.

Michael C. Grant <mcgrant>
Mon 31 Mar 2014 07:25:16 PM UTC, comment #6: 

Thanks for the detailed explanation, that does clear things up for me. Especially the package example that fails.

Ok, let me rephrase a little bit what I said: mkoctfile should be able to produce oct-files that work with Octave without the user needing to specify indirect dependencies. Whether that means all deps are linked in implicitly (link-all-deps) or not, however it's done under the hood. But you've shown that's not the case here.

I'm guessing that odepkg is using some BLAS functions directly and so that's why it needs to link with BLAS itself, which makes perfect sense. The communications package does the same thing with HDF5_LIBS. I agree that this is a valid use case and should be addressed somehow.

On a related note, I see that -framework and -Wl,-framework are used inconsistently in Octave's configure.ac, m4/acinclude.m4, and m4/ax_blas.m4.

You seem to prefer -framework to -Wl,-framework, and as you said GNU libtool supports it, so maybe you should also make a patch and make a case for consistency in the Octave build as well, so all frameworks are linked in using the same syntax, and then the case for mkoctfile to support whichever way Octave's build considers "official" becomes easier. Right now it's half and half, so it's easy to say "don't use -framework".

Mike Miller <mtmiller>
Group Member
Mon 31 Mar 2014 06:54:53 PM UTC, comment #5: 

Oops, the last verbatim line didn't get pasted properly (and sorry for the lousy formatting). Here is the relevant line from odepkg/src/Makefile:


LAPACK_LIBS := $(shell $(MKOCTFILE) -p BLAS_LIBS) $(shell $(MKOCTFILE) -p LAPACK_LIBS)


BLAS_LIBS and LAPACK_LIBS are far from the only variables queried from mkoctfile. In the Makefile, I'm seeing FLAG, FFLAGS, FLIBS, LFLAGS; and in the configure script, I'm seeing CC, CFLAGS, CPPFLAGS, CPICFLAG, LDFLAGS, LIBS, F77...

I don't know how consistent this is across packages, but it does seem clear that this package at least expects to be able to trust the output of mkoctfile -p .

Michael C. Grant <mcgrant>
Mon 31 Mar 2014 06:51:22 PM UTC, comment #4: 

"The mkoctfile command should automatically link in all dependency libraries (or frameworks) that Octave was built with."

I do not agree with this at all, but that's because I am a firm believer in the benefit of binary redistributable OCT/MEX files. Yes, I know people should be able to recompile from source, and I never distribute my MEX files without source. But I can tell you that it is a huge benefit to people not to have to do so---especially on Windows, but even on Linux.

In order to maximize the likelihood of binary compatibility, the MEX/OCT file should link to as few libraries as possible, because you can't know for sure that a given installation has the libraries you're expecting to see. Obviously, Octave's internal libraries are a bare minimum here; and in fact, mkoctfile forces these files to be linked to liboctave/liboctinterp, no matter what the settings are. But if a MEX/OCT file doesn't need BLAS, suite-sparse, qrupdate, ARPACK, fftw, etc., it should not be linking to it.

Now, what seems to be happening is this: mkoctfile contains within it a variety of the configuration's key compilation variables. Presumably this is so the OCT file builder can use the proper versions of the arguments as it needs to. So for instance, in this case, you have this:

>> mkoctfile -p BLAS_LIBS
-framework vecLib

Apparently, these variables are then used by some of the packages to specify extra compiler or linker dependencies; and that's the issue:

>>pkg install -auto -forge -verbose odepkg
...
mkoctfile: unrecognized argument -frameworkmake: *** [dldsolver.oct] Error 1

Here's the relevant line from the Makefile in the odepkg source:

$(shell $(MKOCTFILE) -p BLAS_LIBS) $(shell $(MKOCTFILE) -p LAPACK_LIBS)



Michael C. Grant <mcgrant>
Mon 31 Mar 2014 06:38:41 PM UTC, comment #3: 

First off, I'm not a Mac user, but I understand that -framework is Apple's way of linking libraries, that's fine.

Wouldn't something like BLAS, or vecLib in this case, already be known to Octave so it should already be linked in as an implicit link dependency of all future calls to mkoctfile? What's the interaction between linking Octave with vecLib, using the link-all-deps option, and using mkoctfile to build oct-files?

What Octave Forge packages rely on passing "-framework vecLib" to mkoctfile to install? Or is this added to the build as a Mac packaging thing?

Or are you just using vecLib as an example, but maybe a user would be building an oct-file and linking with some other framework that Octave doesn't know about?

Just trying to understand the actual use case that results in this bug. For example, if I had to somehow pass -lblas to a pkg install command on Linux, I would consider that a bug in the build system for oct-files and packages. The mkoctfile command should automatically link in all dependency libraries (or frameworks) that Octave was built with.

Mike Miller <mtmiller>
Group Member
Sun 30 Mar 2014 02:29:45 PM UTC, comment #2: 

Yes, I indicated that was one possible solution. The problem is that libtool is then prevented from processing the "-framework" flag.

Either way, a fix is needed, either to mkoctfile.in.cc or to the configure system. My preference is to leave off the "-Wl,".

Michael C. Grant <mcgrant>
Sun 30 Mar 2014 02:27:10 PM UTC, comment #1: 

I use


-Wl,-framework -Wl,vecLib


c.

Carlo de Falco <cdf>
Group Member
Sun 30 Mar 2014 02:18:57 PM UTC, original submission:  

If BLAS_FLAGS=-framework vecLib, then attempts to install packages from Octave Forge that rely on this flag will fail, because mkoctfile does not support the "-framework" command-line option.

I supplied a patch here:
https://savannah.gnu.org/patch/?8427
https://savannah.gnu.org/patch/download.php?file_id=31072

I decided to make this a bug because it is indeed breaking typical use of the "pkg" command. One of the Homebrew users has rectified the problem for his own distribution by using "--with-blas='-Wl,-framework -Wl,vecLib". So in theory, the solution could be to fix configure instead. But libtool does a good (though not perfect) job of supporting the -framework flag, so it woudl be better to leave it bare.

Michael C. Grant <mcgrant>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #31091:  WlFramework.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 mtmiller (Posted a comment)
  • -email is unavailable- added by cdf (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 group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-02-22 mtmiller StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2014-03-31 mcgrant Attached File- Added WlFramework.diff, #31091
    2014-03-31 mtmiller StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code