Looks like portable scandir is not very portable after all:
``` depbase=`echo main/portable-scandir.lo | sed 's|[^/]*$|.deps/&|;s|.lo$||'`;\ /bin/sh ../libtool --silent --tag=CC --mode=compile /opt/local/bin/gcc-mp-14 -DHAVE_CONFIG_H -I. -I.. -I./main -I./parsers -I./dsl -DEXTERNAL_PARSER_LIST_FILE="../src/tagmanager/tm_parsers.h" -DG_LOG_DOMAIN="CTags" -I/opt/local/include -I/opt/local/include/gtk-3.0 -I/opt/local/include/at-spi2-atk/2.0 -I/opt/local/include/at-spi-2.0 -I/opt/local/include/dbus-1.0 -I/opt/local/lib/dbus-1.0/include -I/opt/local/include/gtk-3.0 -I/opt/local/include/gio-unix-2.0 -I/opt/local/include/cairo -I/opt/local/include/pango-1.0 -I/opt/local/include/harfbuzz -I/opt/local/include/pango-1.0 -I/opt/local/include/fribidi -I/opt/local/include/harfbuzz -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include/libpng16 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32 -DGDK_DISABLE_DEPRECATION_WARNINGS -fvisibility=hidden -DGEANY_EXPORT_SYMBOL="__attribute__((visibility("default")))" -DGEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL -pipe -Os -arch ppc -MT main/portable-scandir.lo -MD -MP -MF $depbase.Tpo -c -o main/portable-scandir.lo main/portable-scandir.c &&\ mv -f $depbase.Tpo $depbase.Plo main/portable-scandir.c:136:1: error: conflicting types for 'scandir'; have 'int(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **))' 136 | scandir(const char *directory_name, | ^~~~~~~ In file included from main/portable-dirent_p.h:5, from main/routines_p.h:17, from main/portable-scandir.c:112: /usr/include/dirent.h:128:5: note: previous declaration of 'scandir' with type 'int(const char *, struct dirent ***, int (*)(struct dirent *), int (*)(const void *, const void *))' 128 | int scandir(const char *, struct dirent ***, | ^~~~~~~ make[2]: *** [main/portable-scandir.lo] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_geany/geany/work/geany-2.0/ctags' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_geany/geany/work/geany-2.0' make: *** [all] Error 2 ```
Is this a Mac build? Mac build is in https://github.com/geany/geany-osx.
@elextr Yes, it is on macOS, but the issue is unrelated to bundling, which that repo declares to be for.
Yes, but the build where the selection of which function definition for [scandir](https://github.com/geany/geany/blob/eb5c3fb35110c21d7e28a88c24a8606013b24d3d...) depends on the OS where the build is happening. Since the build works in Linux and (presumably) builds on Mac it might help you find why the build has the wrong selection.
@elextr The build fails because the source is messed up. What it should be doing is conditionally define the breaking macro here: https://github.com/geany/geany/blob/eb5c3fb35110c21d7e28a88c24a8606013b24d3d... Then make this coherent with the above: https://github.com/geany/geany/blob/eb5c3fb35110c21d7e28a88c24a8606013b24d3d... Assuming `USE_SCANDIR_COMPARE_STRUCT_DIRENT` is then not defined for macOS versions where the fallback is to be used, that leaves one error: `const struct dirent *` is incorrect for macOS < 10.9 (or close to that), since the OS header uses `struct dirent *`. This can be worked around via passing a flag to GCC to convert an error back to warning (pre-gcc14 behavior).
Looks like nobody tested what happens if `USE_SCANDIR_COMPARE_STRUCT_DIRENT` is not defined, because it is defined unconditionally.
Well, for the base Geany all the values of `HAVE_SCANDIR` and `HAVE_DIRENT_H` are part of the `ctag` software, I didn't examine if the Macos builds modified them outside ctag. The ctag code is not projected as part of Geany, it is imported from the separate project maintained by useful people of `u-ctags`.
Since the ctags code seems to work in Linux it is probable that no changes are needed in this repository since Macos specifics are a separate [repository](https://github.com/geany/geany-osx) as I linked before. That is where needed build changes for Macos need to be.
If the changes need to be within ctags, then the Macos submitters need to preferably provide a change, or an issue, but in either case there should be no effect to the base Geany build.
@elextr Yes, of course any fixes for macOS should not affect any other platforms, but it is trivial to do that conditionally. But if this code is external to Geany, indeed it is better to fix it in its upstream.
@barracuda156 could you try to reproduce the build error by building u-ctags (https://github.com/universal-ctags/ctags)?
If it fails the same way, it'd be cool if you could report it there. If not, we could have a deeper look what's wrong on the Geany side.
@eht16 Ok, so `universal-ctags` port will build with the default compiler choice, because old Xcode gcc of 10.6 does not fail on incompatible pointer types, but just issues a warning (which it does in this case).
``` CC main/libctags_a-portable-scandir.o main/portable-scandir.c: In function 'scanDirectory': main/portable-scandir.c:238:56: error: passing argument 3 of 'scandir' from incompatible pointer type [-Wincompatible-pointer-types] 238 | return scandir (directory_name, array_pointer, select_function, compare_function); | ^~~~~~~~~~~~~~~ | | | int (*)(const struct dirent *) In file included from /opt/local/include/LegacySupport/dirent.h:27, from main/portable-dirent_p.h:5, from main/routines_p.h:17, from main/portable-scandir.c:112: /usr/include/dirent.h:129:5: note: expected 'int (*)(struct dirent *)' but argument is of type 'int (*)(const struct dirent *)' 129 | int (*)(struct dirent *), int (*)(const void *, const void *)) __DARWIN_INODE64(scandir); | ^~~~~~~~~~~~~~~~~~~~~~~~ main/portable-scandir.c:238:73: error: passing argument 4 of 'scandir' from incompatible pointer type [-Wincompatible-pointer-types] 238 | return scandir (directory_name, array_pointer, select_function, compare_function); | ^~~~~~~~~~~~~~~~ | | | int (*)(const struct dirent **, const struct dirent **) /usr/include/dirent.h:129:31: note: expected 'int (*)(const void *, const void *)' but argument is of type 'int (*)(const struct dirent **, const struct dirent **)' 129 | int (*)(struct dirent *), int (*)(const void *, const void *)) __DARWIN_INODE64(scandir); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: *** [main/libctags_a-portable-scandir.o] Error 1 make[2]: *** Waiting for unfinished jobs.... ```
The same goes for old Xcode clang, so you can see a warning but no error in the buildbot log: https://build.macports.org/builders/ports-10.7_x86_64-builder/builds/212887/...
It fails to build with gcc14, which does not accept incompatible pointer types.
@barracuda156 From your profile I noticed you are probably trying to get Geany compiled on an old PowerPC-based Mac. Note, however, that Geany's Scintilla requires a C++17 compiler so I'm not sure if you will be able to compile it with the old toolchain.
[@barracuda156](https://github.com/barracuda156) From your profile I noticed you are probably trying to get Geany compiled on an old PowerPC-based Mac. Note, however, that Geany's Scintilla requires a C++17 compiler so I'm not sure if you will be able to compile it with the old toolchain.
I am not trying to, I have compiled it same day when opened the ticket. There is no issues with C++17 (and later standards), since the latest gcc supports Darwin ppc.
I am not trying to, I have compiled it same day when opened the ticket. There is no issues with C++17 (and later standards), since the latest gcc supports Darwin ppc.
Cool.
github-comments@lists.geany.org