bugGNU Octave - Bugs: bug #61393, [octave forge] (sparsersb) Crash...

 
 

bug #61393: [octave forge] (sparsersb) Crash while "pkg test sparsersb"

Submitter:  Markus M├╝tzel <mmuetzel>
Submitted:  Wed 27 Oct 2021 08:45:08 AM UTC
 
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  In Progress Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * other Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

( Jump to the original submission )

Fri 21 Oct 2022 05:21:54 PM UTC, comment #39: 

Seems to me your workarounds are fine: the core library does not use all that == it's for the test programs.
Considering that Octave is only using the C/C++ interface of librsb, you can even rebuild librsb turning Fortran off by passing FC=' ' and dropping -lgfortran .

dezperado <dezperado>
Fri 21 Oct 2022 04:44:46 PM UTC, comment #38: 

That was a good hint. It looks like libtool didn't want to build a shared library:

/bin/bash ./libtool  --tag=CC   --mode=link x86_64-w64-mingw32-gcc  -g -O2 -D__USE_MINGW_ANSI_STDIO=1 -std=c99 -no-undefined -version-info 0:0:0 -L/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib -o librsb.la -rpath /home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib rsb.lo librsb_nounroll.la librsb_base.la librsb_spblas.la /home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/librsbpp.la -lstdc++ -lm -lz -fopenmp -L/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib -L/home/osboxes/mxe-octave-stable/usr/lib/gcc/x86_64-w64-mingw32/11.2.0 -L/home/osboxes/mxe-octave-stable/usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib -L/home/osboxes/mxe-octave-stable/usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib -lgfortran -lmingw32 -lmoldname -lmingwex -lmsvcrt -lkernel32 -lquadmath -lm -lkernel32 -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lkernel32

*** Warning: This system cannot link to static lib archive /home/osboxes/mxe-octave-stable/usr/lib/gcc/x86_64-w64-mingw32/11.2.0/libstdc++fs.la.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have.

*** Warning: linker path does not have real file for library -lmingw32.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libmingw32 and none of the candidates passed a file format test
*** using a file magic. Last file checked: /home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib/libmingw32.a

*** Warning: linker path does not have real file for library -lmoldname.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libmoldname and none of the candidates passed a file format test
*** using a file magic. Last file checked: /home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib/libmoldname.a

*** Warning: linker path does not have real file for library -lmingwex.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libmingwex and none of the candidates passed a file format test
*** using a file magic. Last file checked: /home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib/libmingwex.a
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.

*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.
libtool: link: (cd .libs/librsb.lax/librsb_nounroll.a && x86_64-w64-mingw32-ar x "/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/./.libs/librsb_nounroll.a")
libtool: link: (cd .libs/librsb.lax/librsb_base.a && x86_64-w64-mingw32-ar x "/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/./.libs/librsb_base.a")
libtool: link: (cd .libs/librsb.lax/librsb_spblas.a && x86_64-w64-mingw32-ar x "/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/./.libs/librsb_spblas.a")
libtool: link: (cd .libs/librsb.lax/librsbpp.a && x86_64-w64-mingw32-ar x "/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/.libs/librsbpp.a")
libtool: link: x86_64-w64-mingw32-ar cru .libs/librsb.a .libs/rsb.o  .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_bench.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_krnl.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_krnl_bcoo_spmv_u.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_krnl_bcss.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_krnl_bcss_l.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_krnl_bcss_misc_u.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_krnl_bcss_spmv_u.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_krnl_bcss_spsv_u.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_krnl_bcss_u.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_krnl_lb.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_krnl_vb.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_merge.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_mergesort.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_ompio.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_permute.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_prec.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_spgemm_csr.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_spmv.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_spsum_misc.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_strmif.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_stropts.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_unroll.o .libs/librsb.lax/librsb_nounroll.a/librsb_nounroll_la-rsb_util.o  .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_asm.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_bio.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_blas_stuff.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_clone.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_coo.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_coo2rec.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_coo_check.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_coo_symm.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_cpmv.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_csr.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_csr2coo.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_do.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_dump.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_eps.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_err.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_fpb.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_garbage.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_gen.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_get.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_idx.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_init.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_internals.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_is.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_limiter.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_lock.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_mbw.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_mio.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_mmio.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_msort_up.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_op.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_partition.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_perf.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_rec.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_rec2coo.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_rec2csr.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_render.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_rsb.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_set.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_spgemm.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_spsum.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_spsv.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_src.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_srt.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_srtp.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_swt.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_sys.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_test_accuracy.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_tune.o .libs/librsb.lax/librsb_base.a/librsb_base_la-rsb_user.o  .libs/librsb.lax/librsb_spblas.a/rsb_libspblas.o .libs/librsb.lax/librsb_spblas.a/rsb_libspblas_handle.o  .libs/librsb.lax/librsbpp.a/rsbpp_coo.o .libs/librsb.lax/librsbpp.a/rsbpp_csr.o
libtool: link: x86_64-w64-mingw32-ranlib .libs/librsb.a
libtool: link: rm -fr .libs/librsb.lax
libtool: link: ( cd ".libs" && rm -f "librsb.la" && ln -s "../librsb.la" "librsb.la" )

The first library it complains about is "libstdc++fs". It looks like its implementation in GCC is incomplete (especially for Windows), and there is no shared library for it. [1]
I worked around that by adding `ac_cv_lib_stdcppfs_main=no ac_cv_header_filesystem=no` to the configure flags.

The other libraries seem to come from the `AC_FC_LIBRARY_LDFLAGS` macro. By the looks of it, its output is completely broken (at least for Windows). I worked around that by setting `FCLIBS="-lgfortran"` for the configure script.

With those changes to the configure command, a shared library `librsb-0.dll` is built.

With that in place, the sparsersb package builds without any issues.

I guess that means that your pre-released version builds successfully for Windows (when working around some platform specific quirks). ­čĹŹ

Please, let us know when you are ready to release it, and we'll update to that version in MXE Octave.

[1]: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dynamic_or_shared.html

Markus M├╝tzel <mmuetzel>
Project Member
Wed 19 Oct 2022 04:57:09 PM UTC, comment #37: 

Good news :-)
The librsb-config script is a substitution of librsb-config.in, and apart from -lrsb, no library is hardcoded in the sources

The sparsersb configure scripts can invoke (using your librsb-config):

$ ./librsb-config --static --libs --extra_libs
/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib/librsb.a -lm -lz -fopenmp -fopenmp -lstdc++

or

$ ./librsb-config --L_opts --libs
-L/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib -lrsb

With so many combination of options, it's difficult to get all right :-)

Can you please try passing --with-static-librsb to sparsersb's configure and see if the fuller version of librsb-config's output is evident?

dezperado <dezperado>
Wed 19 Oct 2022 04:34:40 PM UTC, comment #36: 

The maximum attachment size is pretty small on Savannah. And IIRC, the error message if it is exceeded is not very helpful (if there even is any error message).

Thanks for providing a tarball with updated files.
I compiled the clean tarball (without any additional patches) in MXE Octave. And it successfully finished building! Including librsbpp! ­čÄë

However, when trying to rebuild the sparsersb package with the updated package, it failed again with the errors about undefined references to zlib symbols. (Identical to comment #9.)

I'm attaching the generated `librsb-config` script in case that helps.

Independent from the missing `-lz` when building the sparsersb package: It looks like that script contains hardcoded paths from the build system. That might lead to issues when it is installed on the host system where the paths will likely differ.

(file #53883)

Markus M├╝tzel <mmuetzel>
Project Member
Tue 18 Oct 2022 05:04:08 PM UTC, comment #35: 

I've posted the (temporary) tarball on
 https://sourceforge.net/projects/librsb/files/tmp/librsb-1.3.0.1-pre.tar.bz2/download

md5sum: 077deb0df44de550efb2a32ba1a5a01d
3591413 bytes.

dezperado <dezperado>
Tue 18 Oct 2022 04:54:46 PM UTC, comment #34: 

Trying with librsb-1.3.0.1.tar.bz2 now.

dezperado <dezperado>
Tue 18 Oct 2022 04:50:53 PM UTC, comment #33: 

Last try..

dezperado <dezperado>
Tue 18 Oct 2022 04:48:45 PM UTC, comment #32: 

Umpf. Again.

dezperado <dezperado>
Tue 18 Oct 2022 04:46:33 PM UTC, comment #31: 

Last post had not attached the librsb-1.3.0.1.tar.gz file but only librsb-1.3.0.1.tar.gz.asc (its signature). Retrying now.

dezperado <dezperado>
Tue 18 Oct 2022 04:44:24 PM UTC, comment #30: 

I attach the latest librsb version tarball (pre-release).

Would be great to know whether this solves necessity of any patch on your side (I did a few more Makefile.am changes in the meanwhile).

(file #53875)

dezperado <dezperado>
Tue 18 Oct 2022 11:10:01 AM UTC, comment #29: 

I think to have solved the `rsbpp` build problem.
librsbpp/Makefile.am was not honouring $(EXEEXT)"

-all: rsbpp rsbtt rsbct
+all: rsbpp$(EXEEXT) rsbtt$(EXEEXT) rsbct$(EXEEXT)

and you can use the attached librsbpp/Makefile.am which must work -- can you please check it out?

WRT the include issue: your custom ./configure..CPPFLAGS=.. breaks librsb-own -I. in librsbpp/.
It's a bug on librsbpp side -- I must check this a bit -- for now #include ".." shall do the trick here.

(file #53874)

dezperado <dezperado>
Tue 18 Oct 2022 09:50:01 AM UTC, comment #28: 

IIUC, it is a combined "compile and link" command. The source in the command is `rsbtt.cpp`.
Projects that use libtool often use separate commands for compiling and for linking (with an intermediate object file). I'm not sure if it would help doing that here, too.

I'm also attaching a .zip file with the generated Makefiles.

(file #53873)

Markus M├╝tzel <mmuetzel>
Project Member
Tue 18 Oct 2022 09:18:34 AM UTC, comment #27: 

Added the "%!test" line -- indeed, thx.
Rafael https://savannah.nongnu.org/users/rlaboiss maintains librsb on Debian https://salsa.debian.org/science-team/librsb  -- but that is a copy from the tarballs.
If I get to share librsb's repo I let you know.

I don't use Windows so I can only help indirectly with librsb there. Getting  librsb/Makefile and librsb/librsbpp/Makefile can be useful to me here.

The two lines on
https://savannah.gnu.org/bugs/index.php?61393#comment23
seem link lines to me (-o rsbtt).

On another line, `rsbtt` is a test program and thus inessential.
Another workaround can be configuring top level librsb with --disable-programs and see if we get the librsbpp/librsbpp.la component properly there.

dezperado <dezperado>
Tue 18 Oct 2022 06:45:35 AM UTC, comment #26: 

Do you have librsb under source control with a publicly accessible repository? Or are there only tarballs for released versions?

Markus M├╝tzel <mmuetzel>
Project Member
Tue 18 Oct 2022 06:35:46 AM UTC, comment #25: 

There might be a missing `%!test` tag in the sparsersb package:

diff -r 6bd51588ac2b src/sparsersb.cc
--- a/src/sparsersb.cc        Mon Oct 17 18:47:05 2022 +0200
+++ b/src/sparsersb.cc        Tue Oct 18 08:34:40 2022 +0200
@@ -3516,6 +3516,7 @@
 %%!  wvt=0;
 %%!  end_try_catch;
 %%!  assert(wvt==-1);
+%!test
 %! [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb(sparsersb_temporary_matrix_file, "Z");
 %! assert(NROWS==2);
 %! assert(NCOLS==2);

Markus M├╝tzel <mmuetzel>
Project Member
Tue 18 Oct 2022 06:26:43 AM UTC, comment #24: 

Come to think of it: Projects that are using libtool often separate the compile from the link step. Maybe that command wasn't intended to link at all? Could it be that a `-c` flag is missing in that step for some reason?

Markus M├╝tzel <mmuetzel>
Project Member
Mon 17 Oct 2022 07:39:38 PM UTC, comment #23: 

The compiler line on your listing
 https://savannah.gnu.org/bugs/index.php?61393#comment6
was missing -I. (include local directory) for some reason -- so this patch is a workaround.

WRT your latest output  -- the link line on
 https://savannah.gnu.org/bugs/index.php?61393#comment22
also here 

x86_64-w64-mingw32-g++ -g -O2 -DRSBPP_HAS_RSB_H=1 -I/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/include -I/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1 -DRSBPP_HAS_RSB_H=1 -L/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib  rsbtt.cpp   -o rsbtt

is not linking to any library.

I would have expected something like:

libtool: link: g++ -fopenmp -O0 -ggdb -pipe -std=c++17 -I/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/ -DRSBPP_HAS_RSB_H=1 -o .libs/rsbtt rsbtt.o  ./.libs/librsbpp.so -lpthread -lstdc++fs -fopenmp

(notice ./.libs/librsbpp.so -lpthread -lstdc++fs ..)

dezperado <dezperado>
Mon 17 Oct 2022 05:49:29 PM UTC, comment #22: 

Re comment #19:
I used the following patch:

--- librsb-1.3.0.1/librsbpp/rsbpp.hpp.orig        2022-02-02 11:18:43.000000000 +0100
+++ librsb-1.3.0.1/librsbpp/rsbpp.hpp        2022-10-17 17:56:36.102106130 +0200
@@ -334,7 +334,7 @@
 template <class T1, class T2>
 bool operator!= (const CooAllocator<T1>&, const CooAllocator<T2>&) throw() { return false; }
 #endif
-#include <librsbpp.h>
+#include "librsbpp.h"

 #ifndef RSBPP_WANT_MINIMAL_LIBRSBPP
 #define RSBPP_WANT_MINIMAL_LIBRSBPP 0

With it, the preprocessor is no longer complaining about that file.
But for the next file, the linker fails:

x86_64-w64-mingw32-g++ -g -O2 -DRSBPP_HAS_RSB_H=1 -I/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/include -I/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1 -DRSBPP_HAS_RSB_H=1 -L/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib  rsbtt.cpp   -o rsbtt
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o: in function `test_Csr_SpMV_Unsymmetric_Transposed()':
/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:828: undefined reference to `rsb__pp_csr_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:421: undefined reference to `rsb__pp_coo_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:365: undefined reference to `rsb__pp_csr_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:163: undefined reference to `rsb__pp_csr_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:277: undefined reference to `rsb__pp_csr_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:247: undefined reference to `rsb__pp_csr_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:137: undefined reference to `rsb__pp_coo_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:393: undefined reference to `rsb__pp_coo_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:337: undefined reference to `rsb__pp_coo_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:217: undefined reference to `rsb__pp_coo_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:189: undefined reference to `rsb__pp_coo_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:101: more undefined references to `rsb__pp_coo_spmv' follow
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:760: undefined reference to `rsb__pp_coo_spmm'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o: in function `test_Coo_SpMM_Unsymmetric':
/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:771: undefined reference to `rsb__pp_coo_spmm'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:802: undefined reference to `rsb__pp_coo_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:515: undefined reference to `rsb__pp_coo_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:564: undefined reference to `rsb__pp_coo_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:305: undefined reference to `rsb__pp_coo_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o: in function `test_Coo_SpMV_Symmetric_At':
/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:311: undefined reference to `rsb__pp_coo_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:450: more undefined references to `rsb__pp_coo_spmv' follow
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:613: undefined reference to `rsb__pp_csr_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:645: undefined reference to `rsb__pp_csr_spmm'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:725: undefined reference to `rsb__pp_csr_spmm'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:484: undefined reference to `rsb__pp_csr_spmv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccA4TFrW.o: in function `test_Csr_SpMV_Symmetric_At_Short':
/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/librsbpp/rsbtt.cpp:490: undefined reference to `rsb__pp_csr_spmv'
collect2: error: ld returned 1 exit status
gmake[4]: *** [<builtin>: rsbtt] Error 1

For Windows, symbols must be resolved on link time. IIUC, that is different on Linux where symbol resolution can occur when a program loads. Maybe it's related to that difference between the platforms?

Markus M├╝tzel <mmuetzel>
Project Member
Mon 17 Oct 2022 04:49:15 PM UTC, comment #21: 

Super -- applied!

http://hg.code.sf.net/p/octave/sparsersb/rev/6bd51588ac2b

Thanks!
p.s. till the day we realize all those failing unlink() start complaining.

dezperado <dezperado>
Mon 17 Oct 2022 03:48:02 PM UTC, comment #20: 

wrt http://hg.code.sf.net/p/octave/sparsersb/rev/a488e13d19f7

If the tests that unlink those temporary files happen to fail, the files would remain in the temporary directory. That might not be a big deal. But you could also use the following pattern to remove those files when the tests are done (untested!):

diff -r 1d90e1beaf00 src/sparsersb.cc
--- a/src/sparsersb.cc        Mon Oct 17 17:02:09 2022 +0200
+++ b/src/sparsersb.cc        Mon Oct 17 17:46:49 2022 +0200
@@ -3494,12 +3494,15 @@
 %!test
 %! s=sparsersb([11,0;21,22]);
 %! assert(sparsersb(s,"RSB_MIF_TOTAL_SIZE__TO__SIZE_T") == sparsersb(s,"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"))
+
+%!share sparsersb_temporary_matrix_file tmf_unlink
+%! sparsersb_temporary_matrix_file = fullfile(tempdir(),"sparsersb_temporary_matrix_file.mtx");
+%! tmf_unlink = onCleanup(@() unlink(sparsersb_temporary_matrix_file));
+
 %!test
 %! s=sparsersb([1]);
-%! sparsersb_temporary_matrix_file = fullfile(tempdir(),"sparsersb_temporary_matrix_file.mtx");
 %! sparsersb(sparsersb([11,0;21,22]),"save",sparsersb_temporary_matrix_file)
 %!test
-%! sparsersb_temporary_matrix_file = fullfile(tempdir(),"sparsersb_temporary_matrix_file.mtx");
 %! [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb(sparsersb_temporary_matrix_file     );
 %! assert(NROWS==2)
 %! assert(NCOLS==2)
@@ -3509,12 +3512,11 @@
 %%! test # case for RSBOI_WANT_MTX_LOAD=0
 %%!  try
 %%!  wvt=-1;
-%%!  sparsersb_temporary_matrix_file = fullfile(tempdir(),"sparsersb_temporary_matrix_file.mtx");
 %%!  [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb(sparsersb_temporary_matrix_file, "Z");
 %%!  wvt=0;
 %%!  end_try_catch;
 %%!  assert(wvt==-1);
-%! sparsersb_temporary_matrix_file = fullfile(tempdir(),"sparsersb_temporary_matrix_file.mtx");
+%!test
 %! [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb(sparsersb_temporary_matrix_file, "Z");
 %! assert(NROWS==2);
 %! assert(NCOLS==2);
@@ -3522,7 +3524,6 @@
 %! assert(FIELD=="complex");
 %! assert(SYMMETRY=='U');
 %!test
-%! sparsersb_temporary_matrix_file = fullfile(tempdir(),"sparsersb_temporary_matrix_file.mtx");;
 %! [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb(sparsersb_temporary_matrix_file, "Z");
 %! assert(NROWS==2);
 %! assert(NCOLS==2);
@@ -3530,38 +3531,35 @@
 %! assert(FIELD=="complex");
 %! assert(SYMMETRY=='U');
 %!test
-%! sparsersb_temporary_matrix_file = fullfile(tempdir(),"sparsersb_temporary_matrix_file.mtx");
 %! [S, NROWS, NCOLS, NNZ, REPINFO, FIELD] = sparsersb(sparsersb_temporary_matrix_file, "D");
 %! assert(NROWS==2);
 %! assert(NCOLS==2);
 %! assert(NNZ==3);
 %! assert(FIELD=="real");
 %!test
-%! sparsersb_temporary_matrix_file = fullfile(tempdir(),"sparsersb_temporary_matrix_file.mtx");
 %! [S, NROWS, NCOLS, NNZ, REPINFO] = sparsersb(sparsersb_temporary_matrix_file, "D");
 %! assert(NROWS==2);
 %! assert(NCOLS==2);
 %! assert(NNZ==3);
 %!test
-%! sparsersb_temporary_matrix_file = fullfile(tempdir(),"sparsersb_temporary_matrix_file.mtx");
 %! [S, NROWS, NCOLS] = sparsersb(sparsersb_temporary_matrix_file, "D");
 %! assert(NROWS==2);
 %! assert(NCOLS==2);
 %!test
-%! sparsersb_temporary_matrix_file = fullfile(tempdir(),"sparsersb_temporary_matrix_file.mtx");
 %! [S, NROWS] = sparsersb(sparsersb_temporary_matrix_file, "D");
 %! assert(NROWS==2);
-%! unlink(sparsersb_temporary_matrix_file);
+
+%!share sparsersb_temporary_render_file trf_unlink
+%! sparsersb_temporary_render_file = fullfile(tempdir(),"sparsersb_temporary_render.eps");
+%! trf_unlink = onCleanup(@() unlink(sparsersb_temporary_render_file));
+
 %!test
 %! rrm=sparsersb(sprand(1000,1000,0.001));
-%! sparsersb_temporary_render_file = fullfile(tempdir(),"sparsersb_temporary_render.eps");
 %! sparsersb(rrm,"render", sparsersb_temporary_render_file, 1024); # will use defaults for rWidth
 %!test
 %! rrm=sparsersb(sprand(1000,1000,0.001));
-%! sparsersb_temporary_render_file = fullfile(tempdir(),"sparsersb_temporary_render.eps");
 %! sparsersb(rrm,"render", sparsersb_temporary_render_file, 1024, 1024);
 %! # sparsersb(rrm,"renderb", sparsersb_temporary_render_file); sparsersb(rrm,"renders", sparsersb_temporary_render_file); # FIXME
-%! unlink(sparsersb_temporary_render_file);
 %!test
 %! a=sparsersb(sprand(100,100,0.4));
 %! sparsersb(a,"autotune");

Markus M├╝tzel <mmuetzel>
Project Member
Mon 17 Oct 2022 03:36:43 PM UTC, comment #19: 

WRT the error compiling rsbpp.cpp on 
https://savannah.gnu.org/bugs/index.php?61393#comment6

what if you replace

#include <librsbpp.h>

with

#include "librsbpp.h"

in the two files where it occurs (rsbgt.cpp and rsbpp.hpp) ?

dezperado <dezperado>
Mon 17 Oct 2022 03:17:33 PM UTC, comment #18: 

WRT the missing `gzopen gzclose gzgets` at link time as from your                                                            
 https://savannah.gnu.org/bugs/index.php?61393#comment9 comment.
In principle -lz shall be detected by the configure and if not present, not used
in the configure-time generated librsb-config.
Otherwise `librsb-config   --libs --extra_libs` is meant to spit out -lz if necessary.
I hope that works, so you may spare from hardcoding it in
 https://hg.octave.org/mxe-octave/rev/86edd6018826  (referring to `libs="-lrsb -lz"`).

dezperado <dezperado>
Mon 17 Oct 2022 03:16:57 PM UTC, comment #17: 

WRT setenv & putenv.
In librsb: since librsb-1.3.0.2, if setenv() is absent, putenv shall do the job;
without it, librsb shall build and work, too.

A note on the putenv example https://hg.octave.org/mxe-octave/rev/86edd6018826
linked from https://savannah.gnu.org/bugs/index.php?61393#comment8 : at least on my Linux'
`man putenv`, it says the strings one passes will be used also after the call.
So using a local temporary (buf) like in that snip is not good; instead
using `setenv(strdup(..))` would introduce a small innocent leak which is fine in this context
at least until librsb-1.3.0.2 (which is almost ready).
Alternatively, your purposes of MXE-Octave for librsb-1.3.0.1 (current) and earlier, is perfectly
fine to `#define setenv(X) 0` -- setenv is not used in the library: just from some arcane
tests. So in short, maybe don't do anything more than you did on this :-)                                                    

dezperado <dezperado>
Mon 17 Oct 2022 03:14:34 PM UTC, comment #16: 

WRT https://savannah.gnu.org/bugs/index.php?61393#comment11 and similar:                                                     
I ensured  tempdir()  usage for where it was missing
   http://hg.code.sf.net/p/octave/sparsersb/rev/3ad94dd7b914
   (plus another missed line as you just noted)
and added code for removing those temporary files
   http://hg.code.sf.net/p/octave/sparsersb/rev/a488e13d19f7

dezperado <dezperado>
Mon 17 Oct 2022 02:48:38 PM UTC, comment #15: 

In the following test, you'll probably need to use the file in the temporary directory:

diff -r a488e13d19f7 src/sparsersb.cc
--- a/src/sparsersb.cc        Mon Oct 17 16:36:35 2022 +0200
+++ b/src/sparsersb.cc        Mon Oct 17 16:47:17 2022 +0200
@@ -3555,7 +3555,7 @@
 %!test
 %! rrm=sparsersb(sprand(1000,1000,0.001));
 %! sparsersb_temporary_render_file = fullfile(tempdir(),"sparsersb_temporary_render.eps");
-%! sparsersb(rrm,"render", "sparsersb_temporary_render.eps", 1024); # will use defaults for rWidth
+%! sparsersb(rrm,"render", sparsersb_temporary_render_file, 1024); # will use defaults for rWidth
 %!test
 %! rrm=sparsersb(sprand(1000,1000,0.001));
 %! sparsersb_temporary_render_file = fullfile(tempdir(),"sparsersb_temporary_render.eps");

Markus M├╝tzel <mmuetzel>
Project Member
Mon 17 Oct 2022 02:27:00 PM UTC, comment #14: 

I removed `--without-librsbpp` from the configure flags and started rebuilding librsb 1.3.0.1 with MXE Octave again (which fails with the error from comment #6).

Please, find a .zip file with the config.log and config.h files from librsb and librsbpp resulting from that attempt.

(file #53868)

Markus M├╝tzel <mmuetzel>
Project Member
Sun 16 Oct 2022 09:09:45 AM UTC, comment #13: 

Thanks for looking into this.

It'll probably take a day or two before I'll be able to provide the config.log files.

We use MXE Octave to cross-compile on Linux for Windows (MinGW). I haven't tried to build librsb or sparsersb on Windows (yet).

Markus M├╝tzel <mmuetzel>
Project Member
Sun 16 Oct 2022 09:00:14 AM UTC, comment #12: 

Thanks. I can't work on this now -- I hope late this evening.
For sparsersb, I'll add the extra statement and two "render" statements you spotted.
For librsb, I can try adding a configure check and favour "putenv".

Can you provide me the config.log file so that I can check what is set and what not after a 'configure' on Windows?

Getting rid of --without-librsbpp is also necessary, or the improvements of librsb-1.3 are not being used.
Having librsbpp's subdirectory config.log can be also of help here to spot how it happened that it some inclusion path is missing and breaking (as you pointed out on https://savannah.gnu.org/bugs/index.php?61393#comment6).

dezperado <dezperado>
Sat 15 Oct 2022 01:29:00 PM UTC, comment #11: 

The patch didn't apply cleanly on the tarball. And you might have missed replacing the literal file name with the new variable in the last of the affected tests. So, I changed that part to:

 %!test
-%! [S, NROWS] = sparsersb("sparsersb_temporary_matrix_file.mtx", "D");
+%! sparsersb_temporary_matrix_file = fullfile(tempdir(),"sparsersb_temporary_matrix_file.mtx");
+%! [S, NROWS] = sparsersb(sparsersb_temporary_matrix_file, "D");
 %! assert(NROWS==2);

With that in place, `pkg test sparsersb` only fails the following two tests when installed in a read-only location:

>>>>> processing C:\Program Files\GNU Octave\Octave-7.2.1\mingw64\lib\octave\packages\sparsersb-1.0.9\x86_64-w64-mingw32-api-v57\sparsersb.cc-tst
***** test
 rrm=sparsersb(sprand(1000,1000,0.001));
 sparsersb(rrm,"render", "sparsersb_temporary_render.eps" ,1024); # will use defaults for rWidth
!!!!! test failed
librsb error: The user supplied corrupt or inconsistent data as argument.
***** test
 rrm=sparsersb(sprand(1000,1000,0.001));
 sparsersb(rrm,"render", "sparsersb_temporary_render.eps" ,1024,1024);
 # sparsersb(rrm,"renderb", "sparsersb_temporary_renderb.eps"); sparsersb(rrm,"renders", "sparsersb_temporary_renders.eps"); # FIXME
!!!!! test failed
librsb error: The user supplied corrupt or inconsistent data as argument.

It looks like these tests also involve temporary files. Maybe, those should also move to the TEMP directory?

That's still an improvement from the 9 tests failing before. So, I pushed that patch to MXE Octave here:
https://hg.octave.org/mxe-octave/rev/9b5b81c294f9

Markus M├╝tzel <mmuetzel>
Project Member
Sat 15 Oct 2022 12:50:37 PM UTC, comment #10: 

I installed a version of Octave for Windows that was build with those patches into a read-only location on Windows. (That is without your patch for the sparsersb package from comment #1.)

The tests are still failing. (No surprise.) But Octave is no longer crashing.

Even if those patches might not be final, it looks like they are good enough for the included BISTs. So, I pushed those changes to the release branch of MXE Octave here:
https://hg.octave.org/mxe-octave/rev/86edd6018826

I'll also try and cherry-pick your patch from comment #1 for the sparsersb package.

Markus M├╝tzel <mmuetzel>
Project Member
Sat 15 Oct 2022 12:22:23 PM UTC, comment #9: 

With the attached patch 'librsb-1-setenv.patch', the compilation of librsb finishes.
However, trying to compile the sparsersb package with that version of the library failed with:

x86_64-w64-mingw32-g++ -I/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/include/octave-7.2.1/octave/.. -I/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/include/octave-7.2.1/octave -I/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/include  -pthread -fopenmp -I/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/include/ -DHAVE_OCTAVE_VALUE_ISCOMPLEX -std=gnu++11 -g  -o sparsersb.oct  /tmp/oct-K5T4Gq.o   -shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc -L/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib -L/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib -lrsb -L/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib -L/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib -lrsb -L/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib/octave/7.2.1 -loctinterp -loctave  -Wl,-rpath-link,"/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib" -L"/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib" -L"/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/qt5/lib" -Wl,--export-all-symbols
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib/librsb.a(librsb_base_la-rsb_mio.o): in function `rsb__util_mm_info_matrix_f':
/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/rsb_mio.c:136: undefined reference to `gzopen'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/rsb_mio.c:153: undefined reference to `gzclose'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/rsb_mio.c:247: undefined reference to `gzclose'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/rsb_mio.c:165: undefined reference to `gzclose'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/rsb_mio.c:165: undefined reference to `gzclose'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib/librsb.a(librsb_base_la-rsb_mio.o): in function `rsb__fscanf':
/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/rsb_mio.c:293: undefined reference to `gzgets'

And more similar errors.

With the additional patch 'librsb-2-config.patch', it is now continuing to compile.

I only skimmed through those files. So, I'm not completely sure if those fixes are correct. And I haven't tested yet if the results actually work.

I'll write again once compilation has finished, and I could run some tests.

(file #53857, file #53858)

Markus M├╝tzel <mmuetzel>
Project Member
Fri 14 Oct 2022 06:50:57 PM UTC, comment #8: 

That made it go a bit further:

libtool: link: x86_64-w64-mingw32-gcc -g -O2 -D__USE_MINGW_ANSI_STDIO=1 -std=c99 -o .libs/rsbench.exe rsbench-rsbench.o rsbench-rsb_test_matops.o rsbench-rsb_mkl.o rsbench-rsb_genmm.o rsbench-rsb_mmls.o rsbench-rsb_pr.o rsbench-rsb_pcnt.o rsbench-rsb_failure_tests.o rsbench-rsb_libspblas_tests.o -fopenmp  -L/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib ./.libs/librsb.a -L/home/osboxes/mxe-octave-stable/usr/lib/gcc/x86_64-w64-mingw32/11.2.0 -L/home/osboxes/mxe-octave-stable/usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib -L/home/osboxes/mxe-octave-stable/usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib -L/home/osboxes/mxe-octave-stable/usr/mingw/lib -lz /home/osboxes/mxe-octave-stable/usr/lib/gcc/x86_64-w64-mingw32/11.2.0/libgfortran.dll.a -lmingw32 -lmoldname -lmingwex -lmsvcrt /home/osboxes/mxe-octave-stable/usr/lib/gcc/x86_64-w64-mingw32/11.2.0/libquadmath.dll.a -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -fopenmp -L/home/osboxes/mxe-octave-stable/usr/lib/gcc/x86_64-w64-mingw32/11.2.0
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: rsbench-rsbench.o: in function `rsb__setenv':
/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/rsbench.c:482: undefined reference to `setenv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: rsbench-rsb_test_matops.o: in function `rsb__main_block_partitioned_spmv_sxsa':
/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/rsb_test_matops.c:1986: undefined reference to `setenv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/rsb_test_matops.c:1989: undefined reference to `setenv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/rsb_test_matops.c:1992: undefined reference to `setenv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: /home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/rsb_test_matops.c:2000: undefined reference to `setenv'
/home/osboxes/mxe-octave-stable/usr/bin/x86_64-w64-mingw32-ld: rsbench-rsb_test_matops.o:/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1/rsb_test_matops.c:6543: more undefined references to `setenv' follow
collect2: error: ld returned 1 exit status
gmake[4]: *** [Makefile:1297: rsbench.exe] Error 1

IIUC, `setenv` is a POSIX function that isn't available on Windows. But there are implementations, e.g., in gnulib if you'd like to use those.
Afaict, `putenv` is available on POSIX and Windows platforms as another possible replacement:
https://pubs.opengroup.org/onlinepubs/009696899/functions/putenv.html
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-wputenv?view=msvc-170

(You don't need the leading underscore for MinGW.)

Markus M├╝tzel <mmuetzel>
Project Member
Fri 14 Oct 2022 06:11:37 PM UTC, comment #7: 

For the purposes of this testing, you can do --without-librsbpp and it should not incur in the error for the time being.

dezperado <dezperado>
Fri 14 Oct 2022 04:54:58 PM UTC, comment #6: 

I tried to build librsb 1.3.0.1 in MXE Octave. But it fails with the following:

x86_64-w64-mingw32-g++ -g -O2 -DRSBPP_HAS_RSB_H=1 -I/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/include -I/home/osboxes/mxe-octave-stable/tmp-librsb/librsb-1.3.0.1 -DRSBPP_HAS_RSB_H=1 -L/home/osboxes/mxe-octave-stable/usr/x86_64-w64-mingw32/lib  rsbpp.cpp   -o rsbpp
In file included from rsbpp.cpp:28:
rsbpp.hpp:337:10: fatal error: librsbpp.h: No such file or directory
  337 | #include <librsbpp.h>
      |          ^~~~~~~~~~~~
compilation terminated.

A missing -I flag maybe? Or should that be `#include <librsbpp/librsbpp.h>`?

Markus M├╝tzel <mmuetzel>
Project Member
Thu 13 Oct 2022 10:27:37 AM UTC, comment #5: 

Sure.
With librsb-1.3.0.1, sparsersb.cc invokes error() if opening a file writing descriptor fails.
Together with the error being emitted, the string
 "error: librsb error: The user supplied corrupt or inconsistent data as argument."
should appear.

Please let me know.

dezperado <dezperado>
Thu 13 Oct 2022 09:39:35 AM UTC, comment #4: 

Afaict, Octave 7.2.0 for Windows bundles librsb 1.2.0.11.

Maybe, it's time for an update in MXE Octave. I'll try if I can do that over the weekend. ­čÖé

Markus M├╝tzel <mmuetzel>
Project Member
Thu 13 Oct 2022 09:24:51 AM UTC, comment #3: 

Since librsb-1.3.0.1 (latest) there is a check if opening a write-only file descriptor succeeded.

Which version are you using?

dezperado <dezperado>
Thu 13 Oct 2022 08:28:46 AM UTC, comment #2: 

I attached gdb to Octave 7.2.0 on Windows and ran the command `pkg test sparsersb`.
The top of the backtrace from the resulting segmentation fault:

Thread 25 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 7968.0x271c]
0x00007ffdff4b1d1d in ntdll!RtlEnterCriticalSection () from C:\WINDOWS\SYSTEM32\ntdll.dll
(gdb) bt
#0  0x00007ffdff4b1d1d in ntdll!RtlEnterCriticalSection () from C:\WINDOWS\SYSTEM32\ntdll.dll
#1  0x00000000453bc907 in sparsersb!rsb.util_is_valid_coo_struct ()
   from C:\Program Files\GNU Octave\Octave-7.2.0\mingw64\lib\octave\packages\sparsersb-1.0.9\x86_64-w64-mingw32-api-v57\sparsersb.oct
#2  0x00000000453a87ed in sparsersb!rsb__do_get_pixmap_RGB_from_matrix ()
   from C:\Program Files\GNU Octave\Octave-7.2.0\mingw64\lib\octave\packages\sparsersb-1.0.9\x86_64-w64-mingw32-api-v57\sparsersb.oct
#3  0x00000000453a8e72 in sparsersb!rsb__do_get_pixmap_RGB_from_matrix ()
   from C:\Program Files\GNU Octave\Octave-7.2.0\mingw64\lib\octave\packages\sparsersb-1.0.9\x86_64-w64-mingw32-api-v57\sparsersb.oct
#4  0x00000000453aac8c in sparsersb!rsb.do_mtx_render ()
   from C:\Program Files\GNU Octave\Octave-7.2.0\mingw64\lib\octave\packages\sparsersb-1.0.9\x86_64-w64-mingw32-api-v57\sparsersb.oct
#5  0x00000000450277bc in sparsersb!_Z10FsparsersbRK17octave_value_listi ()
   from C:\Program Files\GNU Octave\Octave-7.2.0\mingw64\lib\octave\packages\sparsersb-1.0.9\x86_64-w64-mingw32-api-v57\sparsersb.oct
#6  0x00000000660d3614 in liboctinterp-10!_ZN14octave_builtin7executeERN6octave14tree_evaluatorEiRK17octave_value_list ()
   from C:\PROGRA~1\GNUOCT~1\OCTAVE~3.0\mingw64\bin\liboctinterp-10.dll

Does that give a clue where you could add a check that could avoid the segmentation fault?

Markus M├╝tzel <mmuetzel>
Project Member
Wed 12 Oct 2022 06:38:55 PM UTC, comment #1: 

Hi Markus.
Thanks for telling of the problem and providing the fix!
I've implemented it -- pls see http://hg.code.sf.net/p/octave/sparsersb//rev/676a7eac6e69

What's your suggestion for a gracious handling of when a non-existing file is being provided for opening?

dezperado <dezperado>
Wed 27 Oct 2021 08:45:08 AM UTC, original submission:  

With the release candidate of Octave (version 6.3.90), running `pkg test sparsersb` crashes Octave if the sparsersb package was installed to a read-only directory.

The content that is written to `fntests.log` up to the crash:

>>>>> processing C:\Program Files\GNU Octave\Octave-6.3.90\mingw64\lib\octave\packages\sparsersb-1.0.9\x86_64-w64-mingw32-api-v56\sparsersb.cc-tst
***** test
 s=sparsersb([1]);
 sparsersb(sparsersb([11,0;21,22]),"save","sparsersb_temporary_matrix_file.mtx")
!!!!! test failed
librsb error: An unspecified error occurred.
***** test
 [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb("sparsersb_temporary_matrix_file.mtx"     );
 assert(NROWS==2)
 assert(NCOLS==2)
 assert(NNZ==3)
 assert(FIELD=="real");
 assert(SYMMETRY=='U');
!!!!! test failed
element number 1 undefined in return list
***** test
 [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb("sparsersb_temporary_matrix_file.mtx", "Z");
 assert(NROWS==2);
 assert(NCOLS==2);
 assert(NNZ==3);
 assert(FIELD=="complex");
 assert(SYMMETRY=='U');
!!!!! test failed
element number 1 undefined in return list
***** test
 [S, NROWS, NCOLS, NNZ, REPINFO, FIELD] = sparsersb("sparsersb_temporary_matrix_file.mtx", "D");
 assert(NROWS==2);
 assert(NCOLS==2);
 assert(NNZ==3);
 assert(FIELD=="real");
!!!!! test failed
element number 1 undefined in return list
***** test
 [S, NROWS, NCOLS, NNZ, REPINFO] = sparsersb("sparsersb_temporary_matrix_file.mtx", "D");
 assert(NROWS==2);
 assert(NCOLS==2);
 assert(NNZ==3);
!!!!! test failed
element number 1 undefined in return list
***** test
 [S, NROWS, NCOLS] = sparsersb("sparsersb_temporary_matrix_file.mtx", "D");
 assert(NROWS==2);
 assert(NCOLS==2);
!!!!! test failed
element number 1 undefined in return list
***** test
 [S, NROWS] = sparsersb("sparsersb_temporary_matrix_file.mtx", "D");
 assert(NROWS==2);
!!!!! test failed
element number 1 undefined in return list

The current directory during the tests is the path where the tests are installed. That is a read-only directory by default for the bundled version (global package) of sparsersb on Windows.
The original error seems to be that the file "sparsersb_temporary_matrix_file.mtx" cannot be created in the read-only directory.

A possible fix for that issue might be to create the file in the TEMP directory. The command that writes the file could be changed to e.g.:

sparsersb(sparsersb([11,0;21,22]),"save",fullfile(tempdir(),"sparsersb_temporary_matrix_file.mtx"))

The tests that access that file would need to be adapted accordingly.

Additionally, `sparsersb` probably shouldn't cause a crash if the file it tries to open doesn't exist.

I set the OS to "MS Windows" because that is where I noticed the error. But something similar would probably also occur on other platforms.

Markus M├╝tzel <mmuetzel>
Project Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #53883:  librsb-config added by mmuetzel (4KiB - application/octet-stream)
file #53874:  Makefile.am added by dezperado (4KiB - application/octet-stream)
file #53873:  librsb-1.3.0.1-Makefiles.zip added by mmuetzel (39KiB - application/x-zip-compressed)
file #53868:  librsb-1.3.0.1.zip added by mmuetzel (41KiB - application/x-zip-compressed)
file #53857:  librsb-1-setenv.patch added by mmuetzel (1KiB - text/plain)
file #53858:  librsb-2-config.patch added by mmuetzel (477B - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dezperado (Posted a comment)
  • -email is unavailable- added by mmuetzel (Submitted the item)
  • -email is unavailable- added by mmuetzel
  •  

    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 project members can vote.

     

     

     

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-10-19 mmuetzel Attached File- Added librsb-config, #53883
    2022-10-18 dezperado Attached File- Added librsb-1.3.0.1.tar.gz.asc, #53875
    2022-10-18 dezperado Attached File- Added Makefile.am, #53874
    2022-10-18 mmuetzel Attached File- Added librsb-1.3.0.1-Makefiles.zip, #53873
    2022-10-17 mmuetzel Attached File- Added librsb-1.3.0.1.zip, #53868
    2022-10-15 mmuetzel Attached File- Added librsb-1-setenv.patch, #53857
        Attached File- Added librsb-2-config.patch, #53858
    2022-10-14 mmuetzel StatusNone In Progress
    2021-10-27 mmuetzel Carbon-Copy- Added dezperado

    Back to the top


    Powered by Savane 3.9