diff mbox series

[bug#65357] gnu: scilab: Fix compilation error.

Message ID ZN-3HT15NUDqFw-O@jurong
State New
Headers show
Series [bug#65357] gnu: scilab: Fix compilation error. | expand

Commit Message

Andreas Enge Aug. 18, 2023, 6:23 p.m. UTC
Am Thu, Aug 17, 2023 at 08:42:12PM +0200 schrieb Andreas Enge:
> the fix looks right to me. But our scilab version is 8 years old, while there
> are newer versions around. Would it make sense to rather update the package
> to a newer version? (I had a look at 5.2.2, 6.0.0 and 6.1.1, but all of them
> would still require your suggested fix.)

I have pushed the fix and updated scilab to 5.2.2.

I have also tried 6.1.1, and attached is how far I got.
The lines for including strings.h instead of string.h are a failed attempt
to have strcasecmp defined; with and without it the error message is
In file included from ../../modules/ast/includes/types/arrayof.hxx:33,
                 from ../../modules/ast/includes/types/double.hxx:28,
                 from ../../modules/ast/includes/symbol/variables.hxx:24,
                 from ../../modules/ast/includes/symbol/context.hxx:25,
                 from ../../modules/ast/includes/ast/runvisitor.hxx:19,
                 from ../../modules/ast/includes/ast/execvisitor.hxx:19,
                 from src/cpp/funcmanager.cpp:31:
src/cpp/funcmanager.cpp: In member function ‘bool FuncManager::AppendModules()’:
../../modules/string/includes/os_string.h:107:25: error: ‘strcasecmp’ was not declared in this scope; did you mean ‘wcscasecmp’?
  107 | #define stricmp         strcasecmp
      |                         ^~~~~~~~~~
src/cpp/funcmanager.cpp:134:9: note: in expansion of macro ‘stricmp’
  134 |     if (stricmp("utf-8", encoding) == 0)
      |         ^~~~~~~

The file looks unchanged in the latest git commit of scilab, and I have not
seen a corresponding patch in the Debian package, so I have given up.

Andreas

Comments

Andreas Enge Aug. 30, 2023, 9:47 a.m. UTC | #1
Hello,

Am Fri, Aug 18, 2023 at 08:23:25PM +0200 schrieb Andreas Enge:
> ../../modules/string/includes/os_string.h:107:25: error: ‘strcasecmp’ was not declared in this scope; did you mean ‘wcscasecmp’?
>   107 | #define stricmp         strcasecmp
>       |                         ^~~~~~~~~~
> src/cpp/funcmanager.cpp:134:9: note: in expansion of macro ‘stricmp’
>   134 |     if (stricmp("utf-8", encoding) == 0)
>       |         ^~~~~~~
> The file looks unchanged in the latest git commit of scilab, and I have not
> seen a corresponding patch in the Debian package, so I have given up.

"man strcasecmp" has this to say:
NOTES
       The  strcasecmp()  and  strncasecmp() functions first appeared in 4.4BSD, where they were declared in
       <string.h>.  Thus, for reasons of historical compatibility, the glibc <string.h> header file also de‐
       clares  these  functions, if the _DEFAULT_SOURCE (or, in glibc 2.19 and earlier, _BSD_SOURCE) feature
       test macro is defined.

So it might be enough to just add "#define _DEFAULT_SOURCE" somewhere.

Andreas
Andreas Enge Aug. 31, 2023, 12:17 p.m. UTC | #2
Am Wed, Aug 30, 2023 at 11:47:34AM +0200 schrieb Andreas Enge:
> So it might be enough to just add "#define _DEFAULT_SOURCE" somewhere.

This was not the problem.

As the topic of this issue is solved and none of us is going to continue
the investigations for updating scilab, I am closing the issue.

Andreas
diff mbox series

Patch

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 1666d6e420..837d055c8e 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -8457,7 +8457,7 @@  (define-public optizelle
 (define-public scilab
   (package
     (name "scilab")
-    (version "5.5.2")
+    (version "6.1.1")
     (source
      (origin
        (method url-fetch)
@@ -8465,9 +8465,9 @@  (define-public scilab
         (string-append "https://www.scilab.org/download/"
                        version "/scilab-" version "-src.tar.gz"))
        (sha256
-        (base32 "0phg9pn24yw98hbh475ik84dnikf1225b2knh7qbhdbdx6fm2d57"))))
+        (base32 "01s28d162znwl7na0qlclzmfg6h7kwgmly1hr5vc51fkidilf4z5"))))
     (build-system gnu-build-system)
-    (native-inputs (list pkg-config gfortran))
+    (native-inputs (list pkg-config gfortran eigen))
     (inputs (list libxml2
                   `(,pcre "bin")
                   `(,pcre "out")
@@ -8495,7 +8495,9 @@  (define-public scilab
            "--without-javasci"
            "--disable-build-help"
            "--with-external-scirenderer"
-           ;; Tcl and Tk library locations.
+           ;; Disable the Scicos modelica compiler, which requires ocamlc.
+           "--without-modelica"
+           ;; Header and library locations.
            (string-append "--with-tcl-include="
                           (string-drop-right
                            (search-input-file %build-inputs "include/tcl.h")
@@ -8512,6 +8514,10 @@  (define-public scilab
                           (string-drop-right
                            (search-input-directory %build-inputs "lib/tk8.6")
                            (string-length "/tk8.6")))
+           (string-append "--with-eigen-include="
+                          (string-drop-right
+                           (search-input-file %build-inputs "include/eigen3/Eigen/Sparse")
+                           (string-length "/Eigen/Sparse")))
            ;; There are some 2018-fortran errors that are ignored
            ;; with this fortran compiler flag.
            "FFLAGS=-fallow-argument-mismatch")
@@ -8538,6 +8544,9 @@  (define-public scilab
                   (("(H5Rdereference\\(_iDatasetId, H5R_OBJECT, )&(.*)\\);$"
                     all common ref)
                    (string-append common ref)))
+                (substitute* "modules/string/includes/os_string.h"
+                  (("#include <string.h>")
+                   "#include <strings.h>"))
                 ;; fix multiple definitions
                 (substitute* "modules/tclsci/src/c/TCL_Command.h"
                   (("^__thread")
@@ -8562,4 +8571,4 @@  (define-public scilab
 statistical analysis, image enhancement, fluid dynamics simulations, numerical
 optimization, and modeling, simulation of explicit and implicit dynamical
 systems and symbolic manipulations.")
-    (license license:cecill)))                    ;CeCILL v2.1
+    (license license:gpl2+)))