Opened 2 years ago
Last modified 18 months ago
#69792 new defect
geany @2.0 Fails to Build on Lion - error: conflicting types for 'scandir'
| Reported by: | RobK88 | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | 2.9.3 |
| Keywords: | lion, snowleopard, leopard | Cc: | RobK88, mascguy (Christopher Nielsen) |
| Port: | geany |
Description (last modified by RobK88)
I am unable to Build geany @2.0 on Lion - Error: conflicting types for 'scandir'
I tried to build it using clang-15 and clamg-11 but no luck. The builds still fail.
main/portable-scandir.c:136:1: error: conflicting types for 'scandir'
scandir(const char *directory_name,
^
/usr/include/dirent.h:128:5: note: previous declaration is here
int scandir(const char *, struct dirent ***,
^
main/portable-scandir.c:238:49: error: incompatible function pointer types passing 'int (*)(const struct dirent *)' to parameter of type 'int (*)(struct dirent *)' [-Wincompatible-function-pointer-types]
return scandir (directory_name, array_pointer, select_function, compare_function);
^~~~~~~~~~~~~~~
/usr/include/dirent.h:129:11: note: passing argument to parameter here
int (*)(struct dirent *), int (*)(const void *, const void *)) __DARWIN_INODE64(scandir);
^
main/portable-scandir.c:238:66: error: incompatible function pointer types passing 'int (*)(const struct dirent **, const struct dirent **)' to parameter of type 'int (*)(const void *, const void *)' [-Wincompatible-function-pointer-types]
return scandir (directory_name, array_pointer, select_function, compare_function);
^~~~~~~~~~~~~~~~
/usr/include/dirent.h:129:37: note: passing argument to parameter here
int (*)(struct dirent *), int (*)(const void *, const void *)) __DARWIN_INODE64(scandir);
^
3 errors generated.
make[2]: *** [main/portable-scandir.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
1 warning generated.
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
make: 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'
Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_geany/geany/work/geany-2.0" && /usr/bin/make -j4 -w all
Exit code: 2
Error: Failed to build geany: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_geany/geany/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Attachments (1)
Change History (13)
Changed 2 years ago by RobK88
comment:1 Changed 2 years ago by RobK88
| Description: | modified (diff) |
|---|
comment:2 Changed 2 years ago by RobK88
| Summary: | gaeny @2.0 Fails too Build on Lion - error: conflicting types for 'scandir' → geany @2.0 Fails too Build on Lion - error: conflicting types for 'scandir' |
|---|
comment:3 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)
| Summary: | geany @2.0 Fails too Build on Lion - error: conflicting types for 'scandir' → geany @2.0 Fails to Build on Lion - error: conflicting types for 'scandir' |
|---|
Yes, the prototype of scandir did change at some point. I guess since we have a successful build of this port on the buildbot on 10.8 but not on 10.7 it changed in 10.8.
man scandir on 10.7 says:
int
scandir(const char *dirname, struct dirent ***namelist, int (*select)(struct dirent *), int (*compar)(const void *, const void *));
man scandir on 10.8 says:
int
scandir(const char *dirname, struct dirent ***namelist, int (*select)(const struct dirent *),
int (*compar)(const struct dirent **, const struct dirent **));
You can file a bug report with the developers of geany asking them to support the old version of scandir. If they won't, then this port requires 10.8 or later.
comment:4 Changed 2 years ago by kencu (Ken)
or something like these patches we have used before:
and there are a number of other examples in the ports tree
comment:5 Changed 2 years ago by kencu (Ken)
I have wondered if this might be something legacysupport could fix as well...
comment:6 Changed 2 years ago by RobK88
Thanks Ken for the feedback. I will take a closer look and see if we can patch the code.
Please note that two of the errors disappear if one uses clang-15 or earlier to build geany.
See #69791
As a result only the scandir error remains.
Here is the output when building geany on Lion using clang-15:
bash-3.2$ sudo port clean geany
Password:
---> Cleaning geany
bash-3.2$
bash-3.2$
bash-3.2$ sudo port -v upgrade geany configure.compiler=macports-clang-15
---> Computing dependencies for geany.
---> Fetching archive for geany
etc
etc
main/portable-scandir.c:136:1: error: conflicting types for 'scandir'
scandir(const char *directory_name,
^
/usr/include/dirent.h:128:5: note: previous declaration is here
int scandir(const char *, struct dirent ***,
^
main/portable-scandir.c:238:49: warning: incompatible function pointer types passing 'int (*)(const struct dirent *)' to parameter of type 'int (*)(struct dirent *)' [-Wincompatible-function-pointer-types]
return scandir (directory_name, array_pointer, select_function, compare_function);
^~~~~~~~~~~~~~~
/usr/include/dirent.h:129:11: note: passing argument to parameter here
int (*)(struct dirent *), int (*)(const void *, const void *)) __DARWIN_INODE64(scandir);
^
main/portable-scandir.c:238:66: warning: incompatible function pointer types passing 'int (*)(const struct dirent **, const struct dirent **)' to parameter of type 'int (*)(const void *, const void *)' [-Wincompatible-function-pointer-types]
return scandir (directory_name, array_pointer, select_function, compare_function);
^~~~~~~~~~~~~~~~
/usr/include/dirent.h:129:37: note: passing argument to parameter here
int (*)(struct dirent *), int (*)(const void *, const void *)) __DARWIN_INODE64(scandir);
^
2 warnings and 1 error generated.
make[2]: *** [main/portable-scandir.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
1 warning generated.
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
make: 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'
Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_geany/geany/work/geany-2.0" && /usr/bin/make -j4 -w all
Exit code: 2
Error: Failed to build geany: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_geany/geany/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
comment:7 Changed 2 years ago by RobK88
| Cc: | RobK88 added |
|---|
comment:8 Changed 2 years ago by kencu (Ken)
llvm made incompatible-function-pointer-types an error rather than a warning as of clang-16:
https://github.com/llvm/llvm-project/commit/af01f717c48f0fd2481600ed6c00441763365b62
comment:9 Changed 21 months ago by mascguy (Christopher Nielsen)
| Cc: | mascguy added |
|---|
comment:11 Changed 18 months ago by kencu (Ken)
I fixed this by adding this to the Portfile:
# work around a bug in portable-scandir.c configure.cppflags-append -DHAVE_SCANDIR=1
If you read the file that generates the error, and examine the configure script, you might see how that could work.
I have not tested it extensively, but it seems to work well enough with a few minutes use. Feel free to try that, and if it works on Lion as well, you can consider a PR if you like.
comment:12 Changed 18 months ago by kencu (Ken)
| Keywords: | snowleopard leopard added |
|---|

main.log