octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53627] build: oct files should not need to li


From: Andrew Janke
Subject: [Octave-bug-tracker] [bug #53627] build: oct files should not need to link with -loctinterp -loctave
Date: Fri, 3 Aug 2018 15:17:38 -0400 (EDT)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

Follow-up Comment #24, bug #53627 (project octave):

Here's a revised attempt at this, which sets -no-undefined conditionally based
on which OS it's running on, with it on by default only on
Windows/BeOS/OS2/AIX. file #44700: 
macos-bundle-undefined-dynamic_lookup-v3.patch

I've added "-bind_on_load" because I think that will produce better fail-fast
behavior when loading octfiles with undefined symbols that cannot be
resolved.

> What happens if you omit that option and do have undefined symbols? Does the
program fail to load and run, or fail if it attempts to call an undefined
function? 

On macOS, with -no-undefined omitted, mkoctfile can compile files that have
undefined symbols, but when they're called, it will produce an
unresolved-symbol error (without crashing Octave). Also, you can build Octave
without passing --enable-link-all-dependencies to configure.


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

// Intentionally undefined function
int undefined_function (void);

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

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

  undefined_function ();

  return octave_value_list ();
}



octave:4> mkoctfile helloworld_with_undef.cc
octave:5> helloworld_with_undef
error: /Users/janke/tmp/octave/helloworld_with_undef.oct: failed to load:
dlopen(/Users/janke/tmp/octave/helloworld_with_undef.oct, 10): Symbol not
found: __Z18undefined_functionv
  Referenced from: /Users/janke/tmp/octave/helloworld_with_undef.oct
  Expected in: flat namespace
 in /Users/janke/tmp/octave/helloworld_with_undef.oct
octave:5>


I expect stuff in libinterp/dldfcn would behave similarly, but I'm not sure
how to test that.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53627>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]