Without the octave-dev.conf fragment in place, compile the attached file using
$ mkoctfile --link-stand-alone embedded.cc -o embedded
when I run created executable I see
$ ./embedded
./embedded: error while loading shared libraries: liboctinterp.so.10: cannot
open shared object file: No such file or directory
After putting octave-dev.conf in /etc/ld.so.conf.d and running ldconfig I see
$ ./embedded
Available Octave Graphics Toolkits:
fltk
gnuplot
Please let me know if you have any other questions or need anything else from
me.
Thanks,
Antony
________________________________
From: Rafael Laboissière <[email protected]>
Sent: Sunday, January 28, 2024 4:18 PM
To: Antony N. Donovan <[email protected]>; [email protected]
<[email protected]>
Cc: Debian Bug Tracking System <[email protected]>
Subject: Re: Bug#1061644: octave-dev: The package should include an ld.so.conf
fragment pointing to the shared libraries
Control: tags -1 - patch + moreinfo
* Antony Donovan <[email protected]> [2024-01-27 15:52]:
> Package: octave-dev
> Version: 7.3.0-2
> Severity: normal
> Tags: patch
>
> Dear Maintainer,
>
> I installed octave-dev and after building a standalone executable with
> mkoctfile it failed to run.
>
> I realized that what was needed was an ld.so.conf fragment containing
> the directory where the shared libraries were located.
>
> I created that fragment, with the contents
> /usr/lib/x86_64-linux-gnu/octave/7.3.0, named it octave-dev.conf,
> put that file in /etc/ld.so.conf.d, and ran ldconfig.
>
> This fixed the issue of running the standalone octave executable.
Thank you for your bug report.
Could you please provide us with a complete example that reproduces
the bug?
Best,
Rafael Laboissière
#include <iostream>
#include <octave/oct.h>
#include <octave/octave.h>
#include <octave/parse.h>
#include <octave/interpreter.h>
#include <octave/builtin-defun-decls.h>
int
main (void)
{
// Create interpreter.
octave::interpreter interpreter;
try {
interpreter.initialize_load_path(true);
interpreter.initialize();
if (!interpreter.initialized()) {
std::cerr << "Octave interpreter initialization failed!"
<< std::endl;
return 2;
}
int status = interpreter.execute ();
if (status != 0) {
std::cerr << "creating embedded Octave interpreter failed!"
<< std::endl;
return status;
}
std::cout << "Available Octave Graphics Toolkits:" << std::endl;
octave_value_list ovl = octave::Favailable_graphics_toolkits(interpreter);
charMatrix tks = ovl(0).char_matrix_value();
octave_idx_type len = tks.rows();
for (octave_idx_type i = 0; i < len; i++) {
std::cout << tks.row_as_string(i) << std::endl;
}
} catch (const octave::exit_exception& ex) {
std::cerr << "Octave interpreter exited with status = "
<< ex.exit_status () << std::endl;
} catch (const octave::execution_exception& ex) {
std::cerr << "error encountered in Octave evaluator!" <<
ex.message() << std::endl;
}
return 0;
}