error: feval: function 'pkg.m' not found

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

error: feval: function 'pkg.m' not found

ashwin damle
Hi Support,

Could you please help me with this? I execute the script embedded.cc from https://octave.org/doc/v4.4.0/Standalone-Programs.html as is with added line of  octave::feval ("pkg.m", ovl ("load", "control"), 0);  to load the control package. The executable is generated but on execution I get the error

"
error: feval: function 'pkg.m' not found
error encountered in Octave evaluator!

"
The reference used for the package load line is http://octave.1599824.n4.nabble.com/Use-package-in-standalone-programs-td4686221.html where in a interval package is loaded.

I was using an older version of Octave before but now I am running 
GNU Octave 4.4.0 on Windows-10 64 bit.

Attached is the embedded.cc file I am using. Before running mkoctfile in the command window the environment variable is to be set using setenv('OCTAVE_LINK_DEPS', " -liconv"). I have given reference in the .cc file.

I was wanting to execute use this in the latest Octave. Could you please help?

Thanks,
Ashwin Damle



embedded.cc (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

Doug Stewart-4


On Sun, Jul 29, 2018 at 7:51 AM, ashwin damle <[hidden email]> wrote:
Hi Support,

Could you please help me with this? I execute the script embedded.cc from https://octave.org/doc/v4.4.0/Standalone-Programs.html as is with added line of  octave::feval ("pkg.m", ovl ("load", "control"), 0);  to load the control package. The executable is generated but on execution I get the error

"
error: feval: function 'pkg.m' not found
error encountered in Octave evaluator!

"
The reference used for the package load line is http://octave.1599824.n4.nabble.com/Use-package-in-standalone-programs-td4686221.html where in a interval package is loaded.

I was using an older version of Octave before but now I am running 
GNU Octave 4.4.0 on Windows-10 64 bit.

Attached is the embedded.cc file I am using. Before running mkoctfile in the command window the environment variable is to be set using setenv('OCTAVE_LINK_DEPS', " -liconv"). I have given reference in the .cc file.

I was wanting to execute use this in the latest Octave. Could you please help?

Thanks,
Ashwin Damle


did you try:
  octave::feval ("pkg", ovl ("load", "control"), 0); 



--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

ashwin damle
Hello,

Yes, I tried with octave::feval ("pkg", ovl ("load", "control"), 0); It does not work.

In order to try one or other option, I tried "pkg.m" and mistakenly sent the same file - "pkg.m" nor "pkg" works.

Did it work for you?

Please let me know.

Thanks,

On Sun, 29 Jul 2018 at 18:19, Doug Stewart <[hidden email]> wrote:


On Sun, Jul 29, 2018 at 7:51 AM, ashwin damle <[hidden email]> wrote:
Hi Support,

Could you please help me with this? I execute the script embedded.cc from https://octave.org/doc/v4.4.0/Standalone-Programs.html as is with added line of  octave::feval ("pkg.m", ovl ("load", "control"), 0);  to load the control package. The executable is generated but on execution I get the error

"
error: feval: function 'pkg.m' not found
error encountered in Octave evaluator!

"
The reference used for the package load line is http://octave.1599824.n4.nabble.com/Use-package-in-standalone-programs-td4686221.html where in a interval package is loaded.

I was using an older version of Octave before but now I am running 
GNU Octave 4.4.0 on Windows-10 64 bit.

Attached is the embedded.cc file I am using. Before running mkoctfile in the command window the environment variable is to be set using setenv('OCTAVE_LINK_DEPS', " -liconv"). I have given reference in the .cc file.

I was wanting to execute use this in the latest Octave. Could you please help?

Thanks,
Ashwin Damle


did you try:
  octave::feval ("pkg", ovl ("load", "control"), 0); 



--
DASCertificate for 206392



--
Ashwin Damle


Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

Doug Stewart-4


On Sun, Jul 29, 2018 at 9:58 AM, ashwin damle <[hidden email]> wrote:
Hello,

Yes, I tried with octave::feval ("pkg", ovl ("load", "control"), 0); It does not work.

In order to try one or other option, I tried "pkg.m" and mistakenly sent the same file - "pkg.m" nor "pkg" works.

Did it work for you?
yes it does!

 mkoctfile --link-stand-alone embedded.cc -o embedded
doug@dougsp2:~$ ./embedded
warning: function ./erase.m shadows a core library function
GCD of [10, 15] is 5
doug@dougsp2:~$ 




 

Please let me know.

Thanks,

On Sun, 29 Jul 2018 at 18:19, Doug Stewart <[hidden email]> wrote:


On Sun, Jul 29, 2018 at 7:51 AM, ashwin damle <[hidden email]> wrote:
Hi Support,

Could you please help me with this? I execute the script embedded.cc from https://octave.org/doc/v4.4.0/Standalone-Programs.html as is with added line of  octave::feval ("pkg.m", ovl ("load", "control"), 0);  to load the control package. The executable is generated but on execution I get the error

"
error: feval: function 'pkg.m' not found
error encountered in Octave evaluator!

"
The reference used for the package load line is http://octave.1599824.n4.nabble.com/Use-package-in-standalone-programs-td4686221.html where in a interval package is loaded.

I was using an older version of Octave before but now I am running 
GNU Octave 4.4.0 on Windows-10 64 bit.

Attached is the embedded.cc file I am using. Before running mkoctfile in the command window the environment variable is to be set using setenv('OCTAVE_LINK_DEPS', " -liconv"). I have given reference in the .cc file.

I was wanting to execute use this in the latest Octave. Could you please help?

Thanks,
Ashwin Damle


did you try:
  octave::feval ("pkg", ovl ("load", "control"), 0); 



--
DAS



--
Ashwin Damle



--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

ashwin damle
Hello,

Is there anyone else who faces the same problem on Windows 10 64 bit on GNU Octave 4.4.0?

Please let me know if you find a solution.

Ashwin

On Mon, 30 Jul 2018 at 16:43, Doug Stewart <[hidden email]> wrote:


On Mon, Jul 30, 2018 at 4:09 AM, ashwin damle <[hidden email]> wrote:
Hi Doug,

Thanks for your email. 

I am using Windows 10, GNU Octave version 4.4.0 and it does not work. May be there is something which I cannot figure out. Which Windows are you using? It works on my xubuntu xenial 64-bit.

Let me know if there is anything I can do to solve this problem.

Thanks,
Ashwin


I am using Ubuntu16.04



 

On Sun, 29 Jul 2018 at 21:29, Doug Stewart <[hidden email]> wrote:


On Sun, Jul 29, 2018 at 9:58 AM, ashwin damle <[hidden email]> wrote:
Hello,

Yes, I tried with octave::feval ("pkg", ovl ("load", "control"), 0); It does not work.

In order to try one or other option, I tried "pkg.m" and mistakenly sent the same file - "pkg.m" nor "pkg" works.

Did it work for you?
yes it does!

 mkoctfile --link-stand-alone embedded.cc -o embedded
doug@dougsp2:~$ ./embedded
warning: function ./erase.m shadows a core library function
GCD of [10, 15] is 5
doug@dougsp2:~$ 




 

Please let me know.

Thanks,

On Sun, 29 Jul 2018 at 18:19, Doug Stewart <[hidden email]> wrote:


On Sun, Jul 29, 2018 at 7:51 AM, ashwin damle <[hidden email]> wrote:
Hi Support,

Could you please help me with this? I execute the script embedded.cc from https://octave.org/doc/v4.4.0/Standalone-Programs.html as is with added line of  octave::feval ("pkg.m", ovl ("load", "control"), 0);  to load the control package. The executable is generated but on execution I get the error

"
error: feval: function 'pkg.m' not found
error encountered in Octave evaluator!

"
The reference used for the package load line is http://octave.1599824.n4.nabble.com/Use-package-in-standalone-programs-td4686221.html where in a interval package is loaded.

I was using an older version of Octave before but now I am running 
GNU Octave 4.4.0 on Windows-10 64 bit.

Attached is the embedded.cc file I am using. Before running mkoctfile in the command window the environment variable is to be set using setenv('OCTAVE_LINK_DEPS', " -liconv"). I have given reference in the .cc file.

I was wanting to execute use this in the latest Octave. Could you please help?

Thanks,
Ashwin Damle


did you try:
  octave::feval ("pkg", ovl ("load", "control"), 0); 



--
DAS



--
Ashwin Damle



--
DASCertificate for 206392



--
Ashwin Damle



--
DASCertificate for 206392



--
Ashwin Damle


ola
Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

ola
I have the same problem on Linux Ubuntu 18.04 and Octave 4.2.2.
The calling  feval("pkg", ovl("load", "optim"), 0); in c++ code gives the
executable, but it doesn't work. The error is related to memory dump.
Is there other way to call pkg (for functions in other packages) from c++
code than using feval function?
or
Is there a way to call Fpkg using #include <octave/builtin-defun-decls.h> ?
or
Is there a known way to #include other packages eg. like <octave/optim.h> ?

There is output from gdb with errors:

Thread 1 "SRR_HDX" received signal SIGSEGV, Segmentation fault.
0x00007ffff6e570ea in octave::application::interactive() () from
/usr/lib/x86_64-linux-gnu/liboctinterp.so.4
(gdb) f 0
#0  0x00007ffff6e570ea in octave::application::interactive() () from
/usr/lib/x86_64-linux-gnu/liboctinterp.so.4
(gdb) f 1
#1  0x00007ffff7824806 in octave_pager_buf::sync() () from
/usr/lib/x86_64-linux-gnu/liboctinterp.so.4
(gdb) f 2
#2  0x00007ffff5703f5e in std::ostream::flush() () from
/usr/lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) f 3
#3  0x00007ffff78250e1 in flush_octave_stdout() () from
/usr/lib/x86_64-linux-gnu/liboctinterp.so.4
(gdb) f 4
#4  0x00007ffff7576525 in ?? () from
/usr/lib/x86_64-linux-gnu/liboctinterp.so.4
(gdb) f 5
#5  0x00007ffff7574393 in ?? () from
/usr/lib/x86_64-linux-gnu/liboctinterp.so.4
(gdb) f 6
#6  0x00007ffff757446e in ?? () from
/usr/lib/x86_64-linux-gnu/liboctinterp.so.4
(gdb) f 7
#7  0x00007ffff75744c7 in verror(char const*, __va_list_tag*) () from
/usr/lib/x86_64-linux-gnu/liboctinterp.so.4
(gdb) f 8
#8  0x00007ffff7574569 in error(char const*, ...) () from
/usr/lib/x86_64-linux-gnu/liboctinterp.so.4
(gdb) f 9
#9  0x00007ffff73d5c50 in feval(std::__cxx11::basic_string<char,
std::char_traits&lt;char>, std::allocator<char> > const&, octave_value_list
const&, int) () from /usr/lib/x86_64-linux-gnu/liboctinterp.so.4
(gdb) f 10
#10 0x000055555555939d in main (argc=<optimized out>, argv=0x7fffffffdf08)
at my_code.cc:58
58  feval("pkg", ovl("load", "optim"), 0);
(gdb) f 11
#0  0x0000000000000000 in ?? ()

Can someone help me?




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


ola
Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

Mike Miller-4
On Wed, Jan 09, 2019 at 12:10:38 -0600, ola wrote:
> I have the same problem on Linux Ubuntu 18.04 and Octave 4.2.2.
> The calling  feval("pkg", ovl("load", "optim"), 0); in c++ code gives the
> executable, but it doesn't work. The error is related to memory dump.
> Is there other way to call pkg (for functions in other packages) from c++
> code than using feval function?
> or
> Is there a way to call Fpkg using #include <octave/builtin-defun-decls.h> ?
> or
> Is there a known way to #include other packages eg. like <octave/optim.h> ?
[…]
> Can someone help me?

Can you provide a link to your program to allow others to help you?

--
mike



signature.asc (849 bytes) Download Attachment
ola
Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

ola
Of course, I will be grateful for any help. :)

I have two short code variants based on
http://octave.org/doc/interpreter/Standalone-Programs.html#Standalone-Programs
<http://octave.org/doc/interpreter/Standalone-Programs.html#Standalone-Programs>  
I would like to use the lsqlin function from the optim package in my c++
code. Unfortunately, I have a problem with importing this package into
octave at c++ code level. I have installed the main octave and optim
packages. My system is Ubuntu 18.04. The 'pkg load optim' command works in
the graphical octave interface, but I need to do it directly in my c++ code.

1) it compiles but returns an error related to memory dump: my_code.cc
#include <iostream>
#include <octave/oct.h>
#include <octave/octave.h>
#include <octave/parse.h>
#include <octave/interpreter.h>

int main(const int argc, const char* argv[]) {
  feval("pkg", ovl("load", "optim"), 0);                                                                      
//HERE I get memory dump
//  octave_value_list OUT = Ffeval("lsqlin", ovl(C, d, A, b, Aeq, beq, lb,
ub), 5);          //I need to use lsqlin function
}

2) it shall not be compiled: my_code.cc
#include <iostream>
#include <octave/oct.h>
#include <octave/builtin-defun-decls.h>

int main(const int argc, const char* argv[]) {
  octave_value_list out = Fcos(ovl(-1), 1);     //works
  std::cerr<<out(0).double_value()<<"\n";
  Ffeval("pkg", ovl("load", "optim"), 0);          //error: invalid
initialization of reference of type ‘const octave_value_list&’ from
expression of type ‘const char [4]’
//  octave_value_list OUT = Ffeval("lsqlin", ovl(C, d, A, b, Aeq, beq, lb,
ub), 5);            
}

Thank You!



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


ola
Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

Mike Miller-4
On Wed, Jan 09, 2019 at 14:04:47 -0600, ola wrote:

> 1) it compiles but returns an error related to memory dump: my_code.cc
> #include <iostream>
> #include <octave/oct.h>
> #include <octave/octave.h>
> #include <octave/parse.h>
> #include <octave/interpreter.h>
>
> int main(const int argc, const char* argv[]) {
>   feval("pkg", ovl("load", "optim"), 0);                                                                      
> //HERE I get memory dump
In this example, you are not initializing the Octave interpreter before
calling the feval function. If you read the Standalone Programs section
it clearly explains that in order to call script files and built in
functions you need to initialize the interpreter.

This example works in Octave 4.0 and earlier versions

    #include <iostream>
    #include <octave/oct.h>
    #include <octave/octave.h>
    #include <octave/parse.h>
    #include <octave/toplev.h>
   
    int
    main (void)
    {
      string_vector argv (2);
      argv(0) = "embedded";
      argv(1) = "-q";
   
      octave_main (2, argv.c_str_vec (), 1);
   
      feval ("pkg", ovl ("load", "optim"), 0);
   
      clean_up_and_exit (0);
    }

and this example works in Octave 4.4 and later versions

    #include <iostream>
    #include <octave/oct.h>
    #include <octave/octave.h>
    #include <octave/parse.h>
    #include <octave/interpreter.h>
   
    int
    main (void)
    {
      octave::interpreter interpreter;
   
      try
        {
          int status = interpreter.execute ();
   
          if (status != 0)
            {
              std::cerr << "creating embedded Octave interpreter failed!"
                        << std::endl;
              return status;
            }
   
          octave::feval ("pkg", ovl ("load", "optim"), 0);
   
        }
      catch (const octave::exit_exception& ex)
        {
          std::cerr << "Octave interpreter exited with status = "
                    << ex.exit_status () << std::endl;
        }
      catch (const octave::execution_exception&)
        {
          std::cerr << "error encountered in Octave evaluator!"
                    << std::endl;
        }
    }

Unfortunately I am not able to get any examples working with Octave 4.2
at the moment, and I seem to remember there were some problems with
embedding the interpreter in that release that simply couldn't be fixed.

If you can upgrade to the current version of 4.4, that would be best. If
not, you can try working with these examples to see what you can get
working in 4.2, but keep in mind that you have to either call
octave_main or create and initialize an interpreter object.

HTH,

--
mike



signature.asc (849 bytes) Download Attachment
ola
Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

ola
This post was updated on .
Thank you, Mike, for your help :)

So, I have updated the octave to version 4.4. and installed forge packages.
Command 'pkg list' returns correct list of packages. Your second example
code is compilable, but it returns an error during execution:
/error while loading shared libraries: liboctinterp.so.5: cannot open shared
object file: No such file or directory/

I compiled the code using:
/NAME=`basename $1 .cc`
mkoctfile --link-stand-alone $NAME.cc -o $NAME/

I also checked that I have liboctinterp.so.5 file on the path:
/usr/share/octave/octave-4.4.0/libinterp/.libs/liboctinterp.so.5
To be sure, I added this path directly by 'addpath("...")'

Is it a standard problem with this octave-4.4.0 version or am I doing
something wrong? The .libs problem is still not solved in my case.
I need your help.



-----
ola
--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


ola
Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

Mike Miller-4
On Thu, Jan 10, 2019 at 10:15:45 -0600, ola wrote:
> So, I have updated the octave to version 4.4. and installed forge packages.
> Command 'pkg list' returns correct list of packages. Your second example
> code is compilable, but it returns an error during execution:
> /error while loading shared libraries: liboctinterp.so.5: cannot open shared
> object file: No such file or directory/

This is a standard loader error when the shared library is not in one of
the standard lib directories searched by ldconfig.

If you install Octave from Ubuntu's repository, by e.g. upgrading to
Ubuntu 18.10, then Octave's libraries will be on the default library
load path.

Otherwise, you can use the LD_LIBRARY_PATH environment variable, add a
configuration file to /etc/ld.so.conf.d, or build your program with the
linker option -rpath.

See https://www.tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
for more details.

--
mike



signature.asc (849 bytes) Download Attachment
ola
Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

ola
This post was updated on .
*SOLVED*
Thank you! Your advice helped me to solve the problem.

Firstly, I added the path /usr/local/lib (with octave shared libraries) to /etc/ld.so.conf/local.conf. It didn't help much.
The real solution was to use the linker option -Wl,-rpath=/usr/local/lib/octave/4.4.0/ with mkoctfile.


ola
Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

Mike Miller-4
On Fri, Jan 11, 2019 at 09:44:30 -0600, ola wrote:
> If I use a random predefined field from optimset() in the program (e.g.
> 'ubound'), everything works, but this field is wrong for this function; if I
> use the function-specific field, the optimset() returns an error: /warning:
> optimset: unrecognized option: posdef/.

A warning is not an error. Does it return a structure you can use
despite the warning? Have you tested this in the Octave interpreter
itself? I don't know much about optimset so I can't help specifically
beyond that.

> one from any function) or can I create in other way a struct of opts('key',
> 'value') from the c++ code level (e.g. using #include <lo-regexp.h>?  What
> is the exact type of octave_struct opts - is it sth like
> std::vector<std::pair&lt;T, T>> or can I call exact octave_struct for opts
> (what is the name) just like I call the octave_struct 'Matrix'?

You can create an Octave struct in C++ from either a C++ std::map or by
using Octave's own octave_map type.

Something like this should work

    std::map<std::string, octave_value> s;
    s["A"] = 1;
    s["B"] = 2;

    octave_value_list args;
    args(0) = s;

If you want specific help about the optimset function and optimization
routines, you might want to start a new thread about your remaining
questions. The original topic here on how to load packages with feval
seems to be solved.

--
mike



signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

ashwin damle
In reply to this post by ashwin damle
Hello Support,

I am getting the exact same error I got with v 4.4.0 when I tried to load a package optim in a standalone program. Presently I am using Windows 10 64 bit on GNU Octave 5.1.0. The script I am running is the default from https://octave.org/doc/v5.1.0/Standalone-Programs.html#Standalone-Programs 

My addition to the default program is octave::feval ("pkg", ovl ("load", "control"), 0);

I was expecting the control package to load but I get
 error: feval: function 'pkg' not found
error encountered in Octave evaluator!

As before, this works on Linux but not with Windows 10 64 bit. Could you please let me know any steps I can try?

Please let me know.

Thank you.
Ashwin

On Tue, 31 Jul 2018 at 09:11, ashwin damle <[hidden email]> wrote:
Hello,

Is there anyone else who faces the same problem on Windows 10 64 bit on GNU Octave 4.4.0?

Please let me know if you find a solution.

Ashwin

On Mon, 30 Jul 2018 at 16:43, Doug Stewart <[hidden email]> wrote:


On Mon, Jul 30, 2018 at 4:09 AM, ashwin damle <[hidden email]> wrote:
Hi Doug,

Thanks for your email. 

I am using Windows 10, GNU Octave version 4.4.0 and it does not work. May be there is something which I cannot figure out. Which Windows are you using? It works on my xubuntu xenial 64-bit.

Let me know if there is anything I can do to solve this problem.

Thanks,
Ashwin


I am using Ubuntu16.04



 

On Sun, 29 Jul 2018 at 21:29, Doug Stewart <[hidden email]> wrote:


On Sun, Jul 29, 2018 at 9:58 AM, ashwin damle <[hidden email]> wrote:
Hello,

Yes, I tried with octave::feval ("pkg", ovl ("load", "control"), 0); It does not work.

In order to try one or other option, I tried "pkg.m" and mistakenly sent the same file - "pkg.m" nor "pkg" works.

Did it work for you?
yes it does!

 mkoctfile --link-stand-alone embedded.cc -o embedded
doug@dougsp2:~$ ./embedded
warning: function ./erase.m shadows a core library function
GCD of [10, 15] is 5
doug@dougsp2:~$ 




 

Please let me know.

Thanks,

On Sun, 29 Jul 2018 at 18:19, Doug Stewart <[hidden email]> wrote:


On Sun, Jul 29, 2018 at 7:51 AM, ashwin damle <[hidden email]> wrote:
Hi Support,

Could you please help me with this? I execute the script embedded.cc from https://octave.org/doc/v4.4.0/Standalone-Programs.html as is with added line of  octave::feval ("pkg.m", ovl ("load", "control"), 0);  to load the control package. The executable is generated but on execution I get the error

"
error: feval: function 'pkg.m' not found
error encountered in Octave evaluator!

"
The reference used for the package load line is http://octave.1599824.n4.nabble.com/Use-package-in-standalone-programs-td4686221.html where in a interval package is loaded.

I was using an older version of Octave before but now I am running 
GNU Octave 4.4.0 on Windows-10 64 bit.

Attached is the embedded.cc file I am using. Before running mkoctfile in the command window the environment variable is to be set using setenv('OCTAVE_LINK_DEPS', " -liconv"). I have given reference in the .cc file.

I was wanting to execute use this in the latest Octave. Could you please help?

Thanks,
Ashwin Damle


did you try:
  octave::feval ("pkg", ovl ("load", "control"), 0); 



--
DAS



--
Ashwin Damle



--
DASCertificate for 206392



--
Ashwin Damle



--
DASCertificate for 206392



--
Ashwin Damle


--
Ashwin Damle



embedded.cc (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

siko1056
On Mon, May 20, 2019 at 2:56 PM ashwin damle <[hidden email]> wrote:
Hello Support,

I am getting the exact same error I got with v 4.4.0 when I tried to load a package optim in a standalone program. Presently I am using Windows 10 64 bit on GNU Octave 5.1.0. The script I am running is the default from https://octave.org/doc/v5.1.0/Standalone-Programs.html#Standalone-Programs 

My addition to the default program is octave::feval ("pkg", ovl ("load", "control"), 0);

I was expecting the control package to load but I get
 error: feval: function 'pkg' not found
error encountered in Octave evaluator!

As before, this works on Linux but not with Windows 10 64 bit. Could you please let me know any steps I can try?

Please let me know.

Thank you.
Ashwin


Dear Ashwin,

Please answer at the bottom of each email, otherwise it is impossible to follow the discussions [1,2].

Unfortunately, I do not have a MS Windows system to test. But for reference, the attached program works on Linux (openSUSE 15.0), with Octave 5.1.0 and the OF package control 3.2.0 installed.

To me it looks like your m-File directory is not loaded by the embedded interpreter to the search path.  To verify this, try to compile run the attached program, which tries to locate the "pkg.m" function by calling

   octave::feval ("which", ovl ("pkg"), 0);

The output should be like:

'pkg' is a function from the file /usr/local/share/octave/5.1.0/m/pkg/pkg.m

Transfer function '' from input 'u1' to output ...

y1:  s

Continuous-time model.

Otherwise nothing about 'pkg' is displayed.

HTH,
Kai




standalone.cc (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

Mike Miller-4
On Mon, May 20, 2019 at 20:50:54 +0200, Kai Torben Ohlhus wrote:
> Unfortunately, I do not have a MS Windows system to test. But for
> reference, the attached program works on Linux (openSUSE 15.0), with Octave
> 5.1.0 and the OF package control 3.2.0 installed.
>
> To me it looks like your m-File directory is not loaded by the embedded
> interpreter to the search path.  To verify this, try to compile run the
> attached program, which tries to locate the "pkg.m" function by calling

If I had to guess, the problem on Windows is that the calling
environment doesn't set the OCTAVE_HOME environment variable. Note that
that variable is required on Windows for Octave to run correctly.

--
mike



signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: error: feval: function 'pkg.m' not found

ashwin damle


On Tue, 21 May 2019 at 00:30, Mike Miller <[hidden email]> wrote:
On Mon, May 20, 2019 at 20:50:54 +0200, Kai Torben Ohlhus wrote:
> Unfortunately, I do not have a MS Windows system to test. But for
> reference, the attached program works on Linux (openSUSE 15.0), with Octave
> 5.1.0 and the OF package control 3.2.0 installed.
>
> To me it looks like your m-File directory is not loaded by the embedded
> interpreter to the search path.  To verify this, try to compile run the
> attached program, which tries to locate the "pkg.m" function by calling

If I had to guess, the problem on Windows is that the calling
environment doesn't set the OCTAVE_HOME environment variable. Note that
that variable is required on Windows for Octave to run correctly.

--
mike

Hello Kai and Mike,

Thank you for your emails.

Mike's solution worked. I had to 
1. export the OCTAVE_HOME=C:\Octave\Octave-5.1.0.0\mingw64 in the system environment variables for my user name. On Windows 10 System properties -> Environment variables -> User variables for xxx user -> New -> variable name as OCTAVE_HOME and value as C:\Octave\Octave-5.1.0.0\mingw64.

2. compile the case again with mkoctfile --link-stand-alone embedded.cc -o embedded.exe

3. embedded.exe on command prompt in the working directory. I could execute this time without any errors. And, I checked that it loaded the package and executed the instructions too.

Thank you for your help Mike.

Thank you for your help.

Regards,

Ashwin Damle