[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #49548] mkoctfile fails to link Fortran source
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #49548] mkoctfile fails to link Fortran sources without -lgfortran on Windows |
Date: |
Tue, 31 Dec 2019 10:57:43 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko |
Follow-up Comment #13, bug #49548 (project octave):
This is tedious, but maybe we need to change mkoctfile link with Fortran
libraries explicitly when doing the link step. The code is in
src/mkoctfile.in.cc. At the very bottom the link step is done:
{
#if defined (OCTAVE_USE_WINDOWS_API) || defined(CROSS)
octave_libs = "-L" + quote_path (vars["OCTLIBDIR"])
+ ' ' + vars["OCTAVE_LIBS"];
#endif
std::string cmd
= (vars["CXXLD"] + ' ' + vars["ALL_CXXFLAGS"] + ' '
+ vars["DL_LDFLAGS"] + ' ' + vars["LDFLAGS"] + ' ' +
pass_on_options
+ " -o " + octfile + ' ' + objfiles + ' ' + libfiles + ' '
+ ldflags + ' ' + vars["LFLAGS"] + ' ' + octave_libs + ' '
+ vars["OCT_LINK_OPTS"] + ' ' + vars["OCT_LINK_DEPS"]);
int status = run_command (cmd, printonly);
You can see that we already have a special workaround for adding the path to
the Octave libraries on Windows. The list of Fortran files is in the variable
f77files so some pseudocode might be
if (! f77files.empty ())
{
... Do Something Special
}
Someone like Mike Miller who is good at build systems should probably comment.
I could see this as a possible block.
if (f77files.empty ())
vars["FLIBS"] = "";
And then change the link command to use FLIBS
std::string cmd
= (vars["CXXLD"] + ' ' + vars["ALL_CXXFLAGS"] + ' '
+ vars["DL_LDFLAGS"] + ' ' + vars["LDFLAGS"] + ' ' +
pass_on_options
+ " -o " + octfile + ' ' + objfiles + ' ' + libfiles + ' '
+ ldflags + ' ' + vars["LFLAGS"] + ' ' + octave_libs + ' '
+ vars["OCT_LINK_OPTS"] + ' ' + vars["OCT_LINK_DEPS"]
+ ' ' + vars["FLIBS"]);
Or, if we want to really isolate Windows from other systems you could place
the entire link command under #ifdef protection such as
#if defined (OCTAVE_USE_WINDOWS_API) || defined(CROSS)
octave_libs = "-L" + quote_path (vars["OCTLIBDIR"])
+ ' ' + vars["OCTAVE_LIBS"];
std::string cmd
= (vars["CXXLD"] + ' ' + vars["ALL_CXXFLAGS"] + ' '
+ vars["DL_LDFLAGS"] + ' ' + vars["LDFLAGS"] + ' ' +
pass_on_options
+ " -o " + octfile + ' ' + objfiles + ' ' + libfiles + ' '
+ ldflags + ' ' + vars["LFLAGS"] + ' ' + octave_libs + ' '
+ vars["OCT_LINK_OPTS"] + ' ' + vars["OCT_LINK_DEPS"]
+ ' ' + vars["FLIBS"]);
#else
std::string cmd
= (vars["CXXLD"] + ' ' + vars["ALL_CXXFLAGS"] + ' '
+ vars["DL_LDFLAGS"] + ' ' + vars["LDFLAGS"] + ' ' +
pass_on_options
+ " -o " + octfile + ' ' + objfiles + ' ' + libfiles + ' '
+ ldflags + ' ' + vars["LFLAGS"] + ' ' + octave_libs + ' '
+ vars["OCT_LINK_OPTS"] + ' ' + vars["OCT_LINK_DEPS"]);
#endif
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?49548>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/