vala-lang / vala-lint

Check code-style of Vala code files
GNU General Public License v2.0
94 stars 17 forks source link

build fails with musl libc: error: 'FNM_EXTMATCH' undeclared here #177

Open ncopa opened 9 months ago

ncopa commented 9 months ago

Build fails on alpine linux (edge):

...
[31/37] Compiling C object src/io.elementary.vala-lint.p/meson-generated_FileData.c.o
[32/37] Compiling C object src/io.elementary.vala-lint.p/meson-generated_Application.c.o
ninja: job failed: gcc -Isrc/io.elementary.vala-lint.p -Isrc -I../src -Ilib -I../lib -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/vala-0.56 -I/usr/include/json-glib-1.0 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -w '-DGETTEXT_PACKAGE="io.elementary.vala-lint"' -Os -fomit-frame-pointer -Os -fomit-frame-pointer -fPIE -pthread -MD -MQ src/io.elementary.vala-lint.p/meson-generated_Application.c.o -MF src/io.elementary.vala-lint.p/meson-generated_Application.c.o.d -o src/io.elementary.vala-lint.p/meson-generated_Application.c.o -c src/io.elementary.vala-lint.p/Application.c
src/io.elementary.vala-lint.p/Application.c:120:52: error: 'FNM_EXTMATCH' undeclared here (not in a function); did you mean 'FNM_NOMATCH'?
  120 | static gint vala_lint_application_fnmatch_flags = (FNM_EXTMATCH | FNM_PERIOD) | FNM_PATHNAME;
      |                                                    ^~~~~~~~~~~~
      |                                                    FNM_NOMATCH
ninja: subcommand failed

FNM_EXTMATCH seems to be a GNU extension.

Introduced in 923adb5d3983ed654566304284607e3367998e22

ncopa commented 4 months ago

Does vala-lint actually support anything other than GNU libc? Please let us know if not so we can delete the package from Alpine Linux.

mzpqnxow commented 4 months ago

FYI- there's a patch to add FNM_EXTMATCH to musl here though I can't (yet) comment on whether it resolves your issue (I'm actually applying it for the purpose of building libelf, not vala)

ncopa commented 1 month ago

Just defining FNM_EXTMATCH to 0 will make it compile but it will not make the extended pattern matches work.

The code does:

 ignore_pattern_list += ("|" + pattern);

As I read that, it means that they try to match files with extended fnmatch doing file1|file2|file3. That needs to be refactored if this is supposed to work on POSIX and not only GNU.

Alternatively clearly document that nothing but GNU is supported (so we can delete the package from alpine).