shsajjadi / OctaveCoder

Octave Coder __ A code generator and build system that converts Octave to C++
Other
25 stars 3 forks source link

Clarification on the usage (standalone Octave programs) #14

Closed AlbiBone closed 2 years ago

AlbiBone commented 2 years ago

Hello, may I use this library for create a standalone .exe program created from a generic .m file already written? If yes, how can I do that? My aim is to share with other person my scripts wihtout instilling Octave on their PC. I want to create a simple interface with few inputs and few outputs and my script as black-box hidden on the .exe file (the users are not expert of Octave so it is not relevant giving them the entire .m file). Thank you

shsajjadi commented 2 years ago

Hello, GNU Octave can run multiple types of files including .m, .oct and .mex. In order to create .oct and .mex file a user writes C/C++ programs using the provided mex/oct APIs and compiles those sources using mkoctfile. But here we simplified this process and automatically convert .m code to c++ code and compile it to .oct file. A .oct file is just a .dll file that can run in Octave. After conversion you don't need the original .m file and the .oct file can be considered as a black-box. In the Octave download page you can download .zip version of Octave that can be extracted without installation. After extraction open the folder and you can see a file named "octave.vbs". You can use the command-line to run your .m or .oct file:

octave.vbs --eval "disp('Hello')" --persist

Instead of disp('Hello') You can use every command or function name including the name of compiled .oct file. If you don't want to use the command line create a text file and place the above command and save it as, for example, myprogram.bat and place it and the .oct file in the same folder as octave.vbs. You don't need a .exe file. Just double click the myprogram.bat and enjoy Octave!.

Note: --eval and --persist are command-line options of Octave. Other options can be found at https://octave.org/doc/v6.3.0/Command-Line-Options.html.

JaimeGeoPi commented 2 years ago

Hello, First of all, thanks a lot for your work. I am very interested on your topic and I really believe it is crucial for octave workers. I have installed the package succesuflly. I wanted to make a little test so I have written a little function:

function SAY
  a=questdlg('cucur')
  sprintf(a)
end

Then I run octave2oct("SAY",'verbose','true'). I expected it to be very fast as the function is very small. It takes several minutes and at certain point, crushes and octave quits. May I be doing something wrong though it is a simple function? Thank you in advance

shsajjadi commented 2 years ago

Thanks for your interests!

The function is very small but consider questdlg function that is placed in questdlg.m. It calls other functions and the other functions calls some other functions and so on. It means that "SAY" depends on 196 .m files. The code generator translates all of them to c++ and more than 46000 lines of code are generated. Octave Coder supports three build modes : single, static and dynamic. The default mode is single. As you used the default mode a cpp source file of 46000 lines of code should be compiled that requires a lot of memory and it may result is a crash. For such cases the static and dynamic build modes are useful. Please run octave2oct('SAY', 'mode', 'static', 'cache', 'cache1', 'verbose', true);. It runs in static mode and a cache folder in the current directory "cache1" is created that you can delete or use for later compilation tasks. The coder runtime so designed to minimize the compilation time and three build modes are provided but I recommend that use coder for translation of the critical parts of your program and handling the input/output or working with the interpreter can be left untranslated to reduce the compilation time and to prevent possibly unexpected results.

JaimeGeoPi commented 2 years ago

Thanks a lot! I have tested your suggestion. It still crashes with 'SAY' function and the cache1 folder is completely empty. I must say I am running in windows 10 ( i7-3820 CPU @ 3.60GHz 3.80 GHz), 64 bits and RAM 64 Gb.

I have tried the simplest function I have been able to imagine, a simple sum:

function [c]=codertest1(a,b)
  c=a+b;
end

At least now Octave hasn't quitted and I have some information that I hope it helps to discover any problem.

analysing dependencies ...

building codertest1.oct ...
  compiling coder runtime
cache1/src/coder.cpp: In member function 'coder::coder_value coder::Endindex::compute_end() const':
cache1/src/coder.cpp:731:32: error: call of overloaded 'coder_value_list(int)' is ambiguous
  731 |         coder_value_list args(3);
      |                                ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In member function 'virtual coder::coder_value coder::Symbol::evaluate(int, const coder::Endindex&, bool)':
cache1/src/coder.cpp:1033:47: error: call of overloaded 'coder_value_list(int)' is ambiguous
 1033 |                 coder_value_list first_args (0);
      |                                               ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:1052:47: error: call of overloaded 'coder_value_list(<brace-enclosed initializer list>)' is ambiguous
 1052 |                 coder_value_list first_args {0};
      |                                               ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In member function 'virtual void coder::Symbol::evaluate_n(coder::coder_value_list&, int, const coder::Endindex&, bool)':
cache1/src/coder.cpp:1096:47: error: call of overloaded 'coder_value_list(int)' is ambiguous
 1096 |                 coder_value_list first_args (0);
      |                                               ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:1104:41: error: call of overloaded 'coder_value_list(int)' is ambiguous
 1104 |                 coder_value_list args (0);
      |                                         ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'coder::coder_value_list coder::convert_to_const_vector(const Ptr_list&, coder::Endindex)':
cache1/src/coder.cpp:1156:38: error: call of overloaded 'coder_value_list(const int&)' is ambiguous
 1156 |     coder_value_list result_list (len);
      |                                      ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'coder::coder_value_list coder::make_value_list(const Ptr_list&, const coder::Endindex&)':
cache1/src/coder.cpp:1250:31: error: call of overloaded 'coder_value_list(int)' is ambiguous
 1250 |     return coder_value_list (0);
      |                               ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In member function 'virtual void coder::Index::evaluate_n(coder::coder_value_list&, int, const coder::Endindex&, bool)':
cache1/src/coder.cpp:1341:62: error: call of overloaded 'coder_value_list(int)' is ambiguous
 1341 |                         first_args.append (coder_value_list(0));
      |                                                              ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:1354:63: error: call of overloaded 'coder_value_list(int)' is ambiguous
 1354 |                         first_args.append (coder_value_list (0));
      |                                                               ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:1523:43: error: call of overloaded 'coder_value_list(int)' is ambiguous
 1523 |             coder_value_list final_args (0);
      |                                           ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In member function 'virtual void coder::MultiAssign::evaluate_n(coder::coder_value_list&, int, const coder::Endindex&, bool)':
cache1/src/coder.cpp:2409:55: error: call of overloaded 'coder_value_list(int)' is ambiguous
 2409 |                     retval.append (coder_value_list (0));
      |                                                       ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:2426:55: error: call of overloaded 'coder_value_list(const int&)' is ambiguous
 2426 |         retval.append (coder_value_list(nargout_retval));
      |                                                       ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'void coder::make_return_list(coder::coder_value_list&, coder::Ptr_list&&, int)':
cache1/src/coder.cpp:3022:43: error: call of overloaded 'coder_value_list(int)' is ambiguous
 3022 |         output.append (coder_value_list (0));
      |                                           ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:3029:38: error: call of overloaded 'coder_value_list(int&)' is ambiguous
 3029 |     coder_value_list retval1 (nargout);
      |                                      ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'void coder::make_return_list(coder::coder_value_list&, coder::Ptr)':
cache1/src/coder.cpp:3102:43: error: call of overloaded 'coder_value_list(int)' is ambiguous
 3102 |         output.append (coder_value_list (0));
      |                                           ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'void coder::make_return_list(coder::coder_value_list&)':
cache1/src/coder.cpp:3116:39: error: call of overloaded 'coder_value_list(int)' is ambiguous
 3116 |     output.append (coder_value_list (0));
      |                                       ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'void coder::make_return_val(coder::coder_value_list&)':
cache1/src/coder.cpp:3128:39: error: call of overloaded 'coder_value_list(int)' is ambiguous
 3128 |     output.append (coder_value_list (0));
      |                                       ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'void coder::call_narginchk(coder::coder_value_list&, int, const octave_value_list&)':
cache1/src/coder.cpp:3166:43: error: call of overloaded 'coder_value_list(int)' is ambiguous
 3166 |         output.append (coder_value_list (0));
      |                                           ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:3188:39: error: call of overloaded 'coder_value_list(int)' is ambiguous
 3188 |     output.append (coder_value_list (0));
      |                                       ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(octave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(bool)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(const coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
warning: mkoctfile: building exited with failure status
error: coder: compile error

Probably it was not necessary to copy all the lines, sorry. Thanks a lot and my apologies becasue I cannot help you in any other way as I have not the knowledge.

I can do more tests both in windows and in linux (kubuntu), the O.S. I have at home.

shsajjadi commented 2 years ago

Thanks for reporting the bug. I pushed some fixes here and released version 1.6.4. Could you please try it?

JaimeGeoPi commented 2 years ago

My complete admiration to your work. It is still a bit difficult to understand how github works and I do not know c++, I hope I can help properly!

I have downloaded the new version to two PCs. PC A is the one I mentioned previously. Windows 10, 64 GbRAM PC B is my laptop toshiba more than 10 years old, kubuntu an 4 Gb RAM

In my pc B I have been able to install Coder, load it and compile VERY FAST both functions "SAY" and "coertest1". It looks it works perfectly, I will push it to the limit.

In PC A I still have the errors I copy below. Hopefully I will try it in other windows computer this evening and let you know.

This is the error in PC A today:

analysing dependencies ...

building codertest1.oct ...
  compiling coder runtime
cache1/src/coder.cpp: In member function 'coder::coder_value coder::Endindex::compute_end()
 const':
cache1/src/coder.cpp:731:32: error: call of overloaded 'coder_value_list(int)' is ambiguous

  731 |         coder_value_list args(3);
      |                                ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In member function 'virtual coder::coder_value coder::Symbol::evaluat
e(int, const coder::Endindex&, bool)':
cache1/src/coder.cpp:1033:47: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 1033 |                 coder_value_list first_args (0);
      |                                               ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:1052:47: error: call of overloaded 'coder_value_list(<brace-enclosed i
nitializer list>)' is ambiguous
 1052 |                 coder_value_list first_args {0};
      |                                               ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In member function 'virtual void coder::Symbol::evaluate_n(coder::cod
er_value_list&, int, const coder::Endindex&, bool)':
cache1/src/coder.cpp:1096:47: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 1096 |                 coder_value_list first_args (0);
      |                                               ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:1104:41: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 1104 |                 coder_value_list args (0);
      |                                         ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'coder::coder_value_list coder::convert_to_const_vector(c
onst Ptr_list&, coder::Endindex)':
cache1/src/coder.cpp:1156:38: error: call of overloaded 'coder_value_list(const int&)' is a
mbiguous
 1156 |     coder_value_list result_list (len);
      |                                      ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'coder::coder_value_list coder::make_value_list(const Ptr
_list&, const coder::Endindex&)':
cache1/src/coder.cpp:1250:31: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 1250 |     return coder_value_list (0);
      |                               ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In member function 'virtual void coder::Index::evaluate_n(coder::code
r_value_list&, int, const coder::Endindex&, bool)':
cache1/src/coder.cpp:1341:62: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 1341 |                         first_args.append (coder_value_list(0));
      |                                                              ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:1354:63: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 1354 |                         first_args.append (coder_value_list (0));
      |                                                               ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:1523:43: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 1523 |             coder_value_list final_args (0);
      |                                           ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In member function 'virtual void coder::MultiAssign::evaluate_n(coder
::coder_value_list&, int, const coder::Endindex&, bool)':
cache1/src/coder.cpp:2409:55: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 2409 |                     retval.append (coder_value_list (0));
      |                                                       ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:2426:55: error: call of overloaded 'coder_value_list(const int&)' is a
mbiguous
 2426 |         retval.append (coder_value_list(nargout_retval));
      |                                                       ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'void coder::make_return_list(coder::coder_value_list&, c
oder::Ptr_list&&, int)':
cache1/src/coder.cpp:3022:43: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 3022 |         output.append (coder_value_list (0));
      |                                           ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:3029:38: error: call of overloaded 'coder_value_list(int&)' is ambiguo
us
 3029 |     coder_value_list retval1 (nargout);
      |                                      ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'void coder::make_return_list(coder::coder_value_list&, c
oder::Ptr)':
cache1/src/coder.cpp:3102:43: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 3102 |         output.append (coder_value_list (0));
      |                                           ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'void coder::make_return_list(coder::coder_value_list&)':

cache1/src/coder.cpp:3116:39: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 3116 |     output.append (coder_value_list (0));
      |                                       ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'void coder::make_return_val(coder::coder_value_list&)':
cache1/src/coder.cpp:3128:39: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 3128 |     output.append (coder_value_list (0));
      |                                       ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp: In function 'void coder::call_narginchk(coder::coder_value_list&, int
, const octave_value_list&)':
cache1/src/coder.cpp:3166:43: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 3166 |         output.append (coder_value_list (0));
      |                                           ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:3188:39: error: call of overloaded 'coder_value_list(int)' is ambiguou
s
 3188 |     output.append (coder_value_list (0));
      |                                       ^
cache1/src/coder.cpp:169:5: note: candidate: 'coder::coder_value_list::coder_value_list(oct
ave_idx_type, bool)'
  169 |     coder_value_list (octave_idx_type n, bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:163:5: note: candidate: 'coder::coder_value_list::coder_value_list(boo
l)'
  163 |     coder_value_list (bool multiassign = false):
      |     ^~~~~~~~~~~~~~~~
cache1/src/coder.cpp:160:9: note: candidate: 'coder::coder_value_list::coder_value_list(con
st coder::coder_value_list&)'
  160 |   class coder_value_list
      |         ^~~~~~~~~~~~~~~~
warning: mkoctfile: building exited with failure status
error: coder: compile error
shsajjadi commented 2 years ago

Thanks! If the new version is properly installed in PC A I think the problem is related to the old cache folder that contains previous buggy sources. Please delete the"cache1" folder and let me to know if it solves the problem.

JaimeGeoPi commented 2 years ago

Hi, Please find attached an image with a table of my tests.

I have been testing with 3 computer. Two with windows and other, very old one, with kubuntu. PC1 The first windows PC is about to be formatted (tomorrow), PC2 the second one was formatted yesterday and the first thing I did was to install octave and make the test. The third one PC3 is the simplest, kubuntu installed from several months ago.

The two codes tested has been:

function SAY
  a=questdlg('cucur')
  disp(a)
end

and

function [c]=codertest1(a,b)
  c=a+b;
end

The linux PC has worked perfectly and fast with both codes. Windows PCs fail with "SAY" code but work fine with "codertest1". The only difference between them is that the first one is far much slower than the second (that's the reason PC1 is going to be formatted).

It fails at the second steps , I have the feeling that analysing dependencies is done properly. One of the times (I think it was in static mode) I have run the compilation of SAY it has appeared an error saying that a *.dll was missing or whatever; it has not happened anymore, it simply crashes.

Before each test the "cache1" folder and previous results were removed. Here you have the summary. X=failed, V=worked

image

shsajjadi commented 2 years ago

Thank you very much for your extensive tests! Let me to find the bug and provide fix as soon as possible.

shsajjadi commented 2 years ago

I pushed a fix here and version 1.6.5 is released.

JaimeGeoPi commented 2 years ago

It works very good! thanks a lot, it is very promising, specially with nested fors. Excuse my delay.

Here I have 2 tests:

TEST1 with previous code (SAY.m and codertest1.m function)

I have made worked with 2 computers (windows 64 GB and laptop kubuntu 4Gb).

The tool is incredibly faster in kubuntu than in a good windows computer (times for SAY.m). image

The compilation semms to work fine. However, the functions compiled with dynamic give an error when are executed:

error: opening the library 'C:\Users\Usuario\Desktop\instalacion\02_Octave\CTest1_dynamic.oct' failed (error 126):

TEST 2

I have the feeling that functions where GUI or figures are involved are more difficult to work with so my intention would be to locate the limitations so that they can be solved or well known because, although it has limitations, I like a lot the potential of this tool.

I have used the next code:

function randomplot(x,z)
  f1=figure(1);
  tic
  for q=1:z
    y=randn(1,x);
    plot(y);
    saveas(1,'caca.jpg','jpeg')
  end
  toc
end

The compilation works fine a priori but when it is executed in its oct version, octave directly crashes.

I hope it to be useful. And if you have any interest aon any specific kind of tools I can try to deal with it. Thanks a good luck

shsajjadi commented 2 years ago

Thanks for reporting the bug! I'm trying to provide a fix.

shsajjadi commented 2 years ago

I pushed multiple bug fixes here and here and here and here and version 1.6.6 is released. However if you call the generated .oct file randomplot.oct from the command line an error is shown because one of the compiled .m files calls "mlock" function that Octave says that it must be called from a .m file instead of the current .oct file. so you can create a .m function file like "runrp.m" that contain this:

function runrp
  randomplot (3,4)
end

With that workaround the error message won't be shown.

shsajjadi commented 2 years ago

@JaimeGeoPi A new version released with 2X speed-up in compilation!

JaimeGeoPi commented 2 years ago

Dear @shsajjadi , These are very good news!!! As soon as I have the opportunity I will check it. I do not have time right now but I wanted to let you know how much I appreaciate your effort and that I will be your tester as soon as posible. Kind regards :)

shsajjadi commented 2 years ago

Dear @JaimeGeoPi , I also appreciate your effort and issue is closed.