gjtorikian / mathematical

Convert mathematical equations to SVGs, PNGs, or MathML. A general wrapper to Lasem and mtex2MML.
https://gjtorikian.github.io/mathematical/
MIT License
166 stars 31 forks source link

Compilation fails for Ruby-3.3.0 on Fedora 39 #132

Closed wmat closed 6 months ago

wmat commented 6 months ago

Tried a fresh install on Fedora 39 with the latest Ruby and got:

checking for mtex2MML.h in /home/wmat/.rvm/gems/ruby-3.3.0/gems/mathematical-1.6.18/ext/mathematical/mtex2MML/src... yes creating Makefile

current directory: /home/wmat/.rvm/gems/ruby-3.3.0/gems/mathematical-1.6.18/ext/mathematical make DESTDIR\= sitearchdir\=./.gem.20240205-92018-wteo7p sitelibdir\=./.gem.20240205-92018-wteo7p clean

current directory: /home/wmat/.rvm/gems/ruby-3.3.0/gems/mathematical-1.6.18/ext/mathematical make DESTDIR\= sitearchdir\=./.gem.20240205-92018-wteo7p sitelibdir\=./.gem.20240205-92018-wteo7p compiling cairo_callbacks.c cairo_callbacks.c: In function ‘cairoSvgSurfaceCallback’: cairo_callbacks.c:10:39: warning: pointer targets in passing argument 2 of ‘rb_str_cat’ differ in signedness [-Wpointer-sign] 10 rb_str_cat(rb_iv_get(self, "@svg"), data, length); ^~~~
const unsigned char *
In file included from /home/wmat/.rvm/rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/intern.h:56, from /home/wmat/.rvm/rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/ruby.h:194, from /home/wmat/.rvm/rubies/ruby-3.3.0/include/ruby-3.3.0/ruby.h:38, from ./cairo_callbacks.h:4, from cairo_callbacks.c:1: /home/wmat/.rvm/rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/internal/intern/string.h:843:41: note: expected ‘const char ’ but argument is of type ‘const unsigned char ’ 843 VALUE rb_str_cat(VALUE dst, const char *src, long srclen); ~~^ cairo_callbacks.c: In function ‘cairoPngSurfaceCallback’: cairo_callbacks.c:22:39: warning: pointer targets in passing argument 2 of ‘rb_str_cat’ differ in signedness [-Wpointer-sign] 22 rb_str_cat(rb_iv_get(self, "@png"), data, length); ^~~~
const unsigned char *
/home/wmat/.rvm/rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/internal/intern/string.h:843:41: note: expected ‘const char ’ but argument is of type ‘const unsigned char ’ 843 VALUE rb_str_cat(VALUE dst, const char *src, long srclen); ~~^ At top level: cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics compiling lasem_overrides.c lasem_overrides.c: In function ‘lsm_itex_to_mathml’: lasem_overrides.c:20:54: warning: control reaches end of non-void function [-Wreturn-type] 20 lsm_itex_to_mathml (const char *itex, gssize size) { } ^ At top level: cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics compiling mathematical.c In file included from ./mathematical.h:15, from mathematical.c:23: /usr/include/glib-2.0/glib/gi18n.h:28: warning: "_" redefined 28 #define _(String) gettext (String)
In file included from /home/wmat/.rvm/rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/defines.h:77, from /home/wmat/.rvm/rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/ruby.h:25, from /home/wmat/.rvm/rubies/ruby-3.3.0/include/ruby-3.3.0/ruby.h:38, from ./mathematical.h:4: /home/wmat/.rvm/rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/backward/2/stdarg.h:33: note: this is the location of the previous definition 33 # define _(args) args
mathematical.c: In function ‘print_and_raise’: mathematical.c:73:3: warning: function ‘print_and_raise’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format] 73 vfprintf(stderr, format, args); ^~~~ mathematical.c: In function ‘process’: mathematical.c:138:77: warning: passing argument 2 of ‘cairo_svg_surface_create_for_stream’ makes pointer from integer without a cast [-Wint-conversion] 138 surface = cairo_svg_surface_create_for_stream (cairoSvgSurfaceCallback, self, width_pt, height_pt); ^~~~
VALUE {aka long unsigned int}
In file included from ./mathematical.h:18: /usr/include/cairo/cairo-svg.h:102:57: note: expected ‘void *’ but argument is of type ‘VALUE’ {aka ‘long unsigned int’} 102 void *closure, ~~~~~^~~~~ mathematical.c:149:91: warning: passing argument 3 of ‘cairo_surface_write_to_png_stream’ makes pointer from integer without a cast [-Wint-conversion] 149 cairo_surface_write_to_png_stream (cairo_get_target (cairo), cairoPngSurfaceCallback, self); ^~~~
VALUE {aka long unsigned int}
In file included from /home/wmat/.rvm/gems/ruby-3.3.0/gems/mathematical-1.6.18/ext/mathematical/lasem/src/lsmcairo.h:28, from /home/wmat/.rvm/gems/ruby-3.3.0/gems/mathematical-1.6.18/ext/mathematical/lasem/src/lsm.h:29, from ./mathematical.h:11: /usr/include/cairo/cairo.h:2606:58: note: expected ‘void *’ but argument is of type ‘VALUE’ {aka ‘long unsigned int’} 2606 void *closure); ~~~~^~~~~ mathematical.c: In function ‘MATHEMATICAL_process’: mathematical.c:234:40: warning: passing argument 2 of ‘rb_rescue’ makes integer from pointer without a cast [-Wint-conversion] 234 output = rb_rescue(process_helper, args, process_rescue, rb_Input); ^~~~
VALUE {aka long unsigned int }
In file included from /home/wmat/.rvm/rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/ruby.h:41: /home/wmat/.rvm/rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/internal/iterator.h:364:47: note: expected ‘VALUE’ {aka ‘long unsigned int’} but argument is of type ‘VALUE ’ {aka ‘long unsigned int ’} 364 VALUE rb_rescue(VALUE (b_proc)(VALUE), VALUE data1, VALUE (r_proc)(VALUE, VALUE), VALUE data2); ~~^~~~~ mathematical.c:258:40: warning: passing argument 2 of ‘rb_rescue’ makes integer from pointer without a cast [-Wint-conversion] 258 hash = rb_rescue(process_helper, args, process_rescue, math); ^~~~
VALUE {aka long unsigned int }

/home/wmat/.rvm/rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/internal/iterator.h:364:47: note: expected ‘VALUE’ {aka ‘long unsigned int’} but argument is of type ‘VALUE ’ {aka ‘long unsigned int ’} 364 | VALUE rb_rescue(VALUE (b_proc)(VALUE), VALUE data1, VALUE (r_proc)(VALUE, VALUE), VALUE data2); | ~~^~~~~ mathematical.c:267:12: warning: assignment to ‘VALUE’ {aka ‘long unsigned int’} from ‘void ’ makes integer from pointer without a cast [-Wint-conversion] 267 | output = NULL; | ^ mathematical.c: In function ‘Init_mathematical’: mathematical.c:275:6: warning: old-style function definition [-Wold-style-definition] 275 | void Init_mathematical() | ^~~~~ mathematical.c: In function ‘print_and_raise’: mathematical.c:68:6: warning: function might be candidate for attribute ‘noreturn’ [-Wsuggest-attribute=noreturn] 68 | void print_and_raise(VALUE error_type, const char format, ...) | ^~~~~~~ mathematical.c: In function ‘process’: mathematical.c:143:11: warning: ‘surface’ may be used uninitialized [-Wmaybe-uninitialized] 143 | cairo = cairo_create (surface); | ^~~~~~ mathematical.c:135:20: note: ‘surface’ was declared here 135 | cairo_surface_t *surface; | ^~~ At top level: cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics linking shared-object mathematical/mathematical.so /usr/bin/ld: cannot find -lwebp: No such file or directory /usr/bin/ld: cannot find -lzstd: No such file or directory /usr/bin/ld: cannot find -ljbig: No such file or directory collect2: error: ld returned 1 exit status make: *** [Makefile:265: mathematical.so] Error 1

make failed, exit code 2

Gem files will remain installed in /home/wmat/.rvm/gems/ruby-3.3.0/gems/mathematical-1.6.18 for inspection. Results logged to /home/wmat/.rvm/gems/ruby-3.3.0/extensions/x86_64-linux/3.3.0/mathematical-1.6.18/gem_make.out

wmat commented 6 months ago

After installing the missing libs, everything worked:

sudo dnf install libwebp libwebp-devel sudo dnf install zstd sudo dnf install jbig sudo dnf install libzstd-devel-1.5.5-4.fc39. libzstd- zstd*