bugGNU Octave - Bugs: bug #40824, newly compiled mex / oct function...

 
 

bug #40824: newly compiled mex / oct function in private subdirectory not detected

Submitter:  Julien Bect <jbect>
Submitted:  Fri 06 Dec 2013 12:36:01 PM UTC
   
 
Category:  Interpreter Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 23 May 2019 12:26:07 PM UTC, comment #7: 

@Mike: I don't recall having seen this problem recently.

(I have a check for this hidden somewhere in stk_init.m.)

Thank you.

Julien Bect <jbect>
Mon 08 Apr 2019 03:09:05 PM UTC, comment #6: 

This seems to be fixed.  I tried Mike's example from comment #5 and it works find with 5.1.0 now.  Closing report.

--Rik

Rik <rik5>
Group administrator
Fri 05 Apr 2019 07:00:25 PM UTC, comment #5: 

I can't reproduce this bug anymore with Octave version 4.4 and 5. It may have been fixed since it was originally reported.

To test this I created publicfun.m and privfun.cc


$ cat publicfun.m
function y = publicfun (x)
  y = privfun (x);
endfunction

$ cat private/privfun.cc
#include <oct.h>

DEFUN_DLD(privfun, args, , "")
{
  octave_value_list retval;

  if (args.length () > 0)
    {
      double x = args(0).xdouble_value ("privfun: X must be a numeric scalar");
      double y = 3 * x;
      retval(0) = y;
    }

  return retval;
}


I only built the oct file in the same Octave session that I tried to call it, for example


octave:1> y = publicfun (2)
error: 'privfun' undefined near line 2 column 7
error: called from
    publicfun at line 2 column 5
octave:1> mkoctfile -o private/privfun.oct private/privfun.cc
octave:2> y = publicfun (2)
y =  6


or


octave:1> cd private
octave:2> mkoctfile privfun.cc
octave:3> cd ..
octave:4> y = publicfun (2)
y =  6


@Julien Is this bug resolved for you now?

Mike Miller <mtmiller>
Group Member
Tue 15 May 2018 05:05:34 PM UTC, comment #4: 

I'll work on this and similar bugs.  Most likely this will be fixed only on default.

John W. Eaton <jwe>
Group administrator
Tue 22 Aug 2017 06:38:20 PM UTC, comment #3: 

It took quite a few tries to reproduce this, I thought this was about an existing function being recompiled. But this only affects a new function that has never been compiled before. To reproduce, the object files have to be deleted before Octave is started, then the compilation done while Octave is still running.

I can confirm this is still present when a dynamic mex or oct function is in a private directory on the load path.

One workaround that solves this is


path (path ())


which forces a complete reload of the load path, more brute-force than rehash, and the newly compiled private functions are found.

This is similar to bug #36230, in which new functions added to a class definition @-directory are not loaded once the class has already been parsed, until the path is altered or completely reloaded using the same workaround.

Mike Miller <mtmiller>
Group Member
Fri 25 Nov 2016 10:37:37 PM UTC, comment #2: 

This might be connected to bug #40117 (m-files in private subfolder not found after changeing their timestamp).

Hartmut <hardy>
Sat 04 Jan 2014 05:31:40 AM UTC, comment #1: 

I used a .oct file generated with mkoctfile, but the result is the same.  The dynamic function in a private directory isn't seen until Octave is restarted.

Rik <rik5>
Group administrator
Fri 06 Dec 2013 12:36:01 PM UTC, original submission:  

If I compile a MEX file which is in a private folder, and the run a function from the parent folder, the compiled MEX file is not detected.


## First, I build a MEX-file which is in the 'private' directory

cd private
mex stk_dist_matrixx.c -I../../include
rehash  # with or without this, the result will be the same...
cd ..

## Second, I call a function that calls stk_dist_matrixx
## (the file stk_dist.m is in the current directory)

stk_dist (rand (10))

## Result: Octave doesn't find stk_dist_matrixx
#
# error: 'stk_dist_matrixx' undefined near line 76 column 13
# error: called from:
# error:   /media/data/svn/stk/sourceforge/svn/trunk/misc/dist/stk_dist.m at line 76, column 11
# error:   /media/data/svn/stk/sourceforge/svn/trunk/misc/dist/essai.m at line 6, column 1

## Note: if I restart Octave, stk_dist_matrixx is found

## Note: Ubuntu 12.04 with Octave 3.7.7+, but I have seen the same problem in all Octave releases that I have tried.


Julien Bect <jbect>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jbect (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-04-08 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2019-04-05 mtmiller Carbon-CopyRemoved 80942 -
    2017-08-22 mtmiller Severity3 - Normal 2 - Minor
        SummaryMEX functions in private folders not detected after compilation newly compiled mex / oct function in private subdirectory not detected
    2014-01-04 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code