Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when building on Fedora 40 #395

Closed
wuqso opened this issue Apr 15, 2024 · 8 comments · Fixed by #396
Closed

Errors when building on Fedora 40 #395

wuqso opened this issue Apr 15, 2024 · 8 comments · Fixed by #396

Comments

@wuqso
Copy link

wuqso commented Apr 15, 2024

There seems to be an error when building from the source of V2.18 with
"$ make 2>&1 | tee build.log".
The error is

zfiobf.c:770:17: error: passing argument 1 of ‘zopnnd_’ from incompatible pointer type [-Wincompatible-pointer-types]
  770 |         ZOPNND (osfn, &acmode, &fd);
      |                 ^~~~
      |                 |
      |                 char *
In file included from /.../.../iraf-main/unix/hlib/libc/iraf.h:79,
                 from osproto.h:13,
                 from zfiobf.c:24:
/.../.../iraf-main/unix/hlib/libc/iraf_kproto.h:59:21: note: expected ‘PKCHAR *’ {aka ‘short int *’} but argument is of type ‘char *’
   59 | int ZOPNND (PKCHAR *pk_osfn, XINT *mode, XINT *chan);
      |             ~~~~~~~~^~~~~~~
make[2]: *** [<builtin>: zfiobf.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.

What's the problem? I'm using Fedora 40.

@olebole
Copy link
Member

olebole commented Apr 15, 2024

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.

@wuqso
Copy link
Author

wuqso commented Apr 15, 2024

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 *)?

@olebole
Copy link
Member

olebole commented Apr 15, 2024

Yes; replace the const int* with PKGCHAR *. This is already done in th #396.

@olebole olebole changed the title Error when building Errors when building on Fedora 40 Apr 15, 2024
@wuqso
Copy link
Author

wuqso commented Apr 19, 2024

There are still some similar problems in the following building. After I corrected one, a new one showed up.

@olebole
Copy link
Member

olebole commented Apr 19, 2024

Could you post them here? Or (if it is simpler for you) create a pull request with all the proposed fixes?

@wuqso
Copy link
Author

wuqso commented Apr 19, 2024

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

@olebole
Copy link
Member

olebole commented Apr 19, 2024

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).

@olebole
Copy link
Member

olebole commented Apr 21, 2024

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants