Closed wuqso closed 7 months ago
That should be a warning, not an error; please check the compiler flags you are using - maybe Fedora adds a flag that turns this warning into an error. You could also add (PKCHAR *)
before the osfn
argument:
--- a/unix/os/zfiobf.c
+++ b/unix/os/zfiobf.c
@@ -767,7 +767,7 @@ vm_connect (void)
"vmclient (%s): open server connection `%s' -> ",
vm_client, osfn);
- ZOPNND (osfn, &acmode, &fd);
+ ZOPNND ((PKCHAR *)osfn, &acmode, &fd);
if (fd == XERR) {
if (vm_debug)
fprintf (stderr, "failed\n");
The problem is that in IRAF the pointer conversion is taken rather sloppy in many places.
I added (PKCHAR *) before the osfn argument and re-did the building. The new error is
zfioks.c: In function ‘ks_sysname’:
zfioks.c:1623:17: error: passing argument 1 of ‘zgtenv_’ from incompatible pointer type [-Wincompatible-pointer-types]
1623 | ZGTENV ((const int*)"iraf", irafdir, &x_maxch, &x_nchars);
| ^~~~~~~~~~~~~~~~~~
| |
| const int *
In file included from /home/jhwu/Downloads/iraf-main/unix/hlib/libc/iraf.h:79,
from osproto.h:13,
from zfioks.c:33:
/.../.../iraf-main/unix/hlib/libc/iraf_kproto.h:133:21: note: expected ‘PKCHAR *’ {aka ‘short int *’} but argument is of type ‘const int *’
133 | int ZGTENV (PKCHAR *envvar, PKCHAR *outstr, XINT *maxch, XINT *status);
| ~~~~~~~~^~~~~~
make[2]: *** [<builtin>: zfioks.o] Error 1
make[2]: Leaving directory '/.../.../iraf-main/unix/os'
make[1]: *** [Makefile:26: install] Error 2
make[1]: Leaving directory '/.../.../iraf-main/unix'
make: *** [Makefile:66: novos] Error 2
Shall I add a new (PKCHAR *)?
Yes; replace the const int*
with PKGCHAR *
. This is already done in th #396.
There are still some similar problems in the following building. After I corrected one, a new one showed up.
Could you post them here? Or (if it is simpler for you) create a pull request with all the proposed fixes?
y.tab.c: In function ‘yygrowstack’:
y.tab.c:1788:34: error: passing argument 1 of ‘u_realloc’ from incompatible pointer type [-Wincompatible-pointer-types]
1788 | i = (int) (data->s_mark - data->s_base);
| ~~~~^~~~~~~~
| |
| YYINT * {aka int *}
In file included from /.../.../iraf-main/unix/hlib/libc/iraf.h:24,
from grammar.y:9:
/.../.../iraf-main/unix/hlib/libc/iraf_libc.h:134:32: note: expected ‘char *’ but argument is of type ‘YYINT *’ {aka ‘int *’}
134 | extern char *realloc (char *buf, unsigned newsize);
| ~~~~~~^~~
y.tab.c:1795:36: error: passing argument 1 of ‘u_realloc’ from incompatible pointer type [-Wincompatible-pointer-types]
1795 |
| ^
| |
| YYSTYPE * {aka int *}
/.../.../iraf-main/unix/hlib/libc/iraf_libc.h:134:32: note: expected ‘char *’ but argument is of type ‘YYSTYPE *’ {aka ‘int *’}
134 | extern char *realloc (char *buf, unsigned newsize);
| ~~~~~~^~~
pkg/cl/mkpkg:178: error: Command '/.../.../iraf-main/unix/bin.linux64/xc.e -c -w -qx ytab.c' returned error
mkpkg[2]: Leaving directory `/.../.../iraf-main/pkg/cl/'
make: *** [Makefile:78: core] Error 1
That was fixed immediately after the release of 2.18, in #391. You could either use a git checkout to build or download tarball from the development branch (https://github.com/olebole/iraf/archive/refs/heads/fix_zopnnd_call.tar.gz) which already includes this. Or you could manually apply at least the patch https://github.com/iraf-community/iraf/commit/6faf887c8.patch (but better all of #391).
I now downloaded and tested building with Fedora 40 beta, and it worked with the current https://github.com/olebole/iraf/archive/refs/heads/fix_zopnnd_call.tar.gz. I had to add another pointer cast there.
You may test it yourself; I'd be glad to hear success or failure. Otherwise, I would merge #396 (which will close this issue) in twoi days or so,
There seems to be an error when building from the source of V2.18 with "$ make 2>&1 | tee build.log". The error is
What's the problem? I'm using Fedora 40.