iraf-community / x11iraf

X11/GUI utilities and applications for IRAF (xgterm, ximtool, xtapemon)
https://iraf-community.github.io/x11iraf
21 stars 8 forks source link

Error when compiling iraf on Arch linux #71

Open HkLuna opened 2 months ago

HkLuna commented 2 months ago

Hello, as the title says when i try to compile x11iraf on ARCH there is an error regarding incompatible pointers both when i downloaded directly from github repository and arch repository

The error from the github download x11iraf

make -C obm
make[1]: Entering directory '/home/vale/Downloads/x11iraf-2.1/obm'
cc -I/usr/include/tcl   -c -o client.o client.c
client.c: In function ‘ClientEvaluate’:
client.c:137:53: error: passing argument 4 of ‘Tcl_SplitList’ from incompatible pointer type [-Wincompatible-pointer-types]
  137 | literal:    if (Tcl_SplitList (tcl, command, &argc, &argvp) == TCL_OK) {
      |                                                     ^~~~~~
      |                                                     |
      |                                                     char ***
In file included from /usr/include/tcl.h:2421,
                 from ObmP.h:76,
                 from client.c:4:
/usr/include/tclDecls.h:722:49: note: expected ‘const char ***’ but argument is of type ‘char ***’
  722 |                                 CONST84 char ***argvPtr);
      |                                                 ^
client.c: In function ‘clientGcmd’:
client.c:173:49: error: passing argument 2 of ‘Tcl_Concat’ from incompatible pointer type [-Wincompatible-pointer-types]
  173 |             char *message = Tcl_Concat (argc-1, &argv[1]);
      |                                                 ^~~~~~~~
      |                                                 |
      |                                                 char **
/usr/include/tclDecls.h:274:67: note: expected ‘const char * const*’ but argument is of type ‘char **’
  274 | EXTERN char *           Tcl_Concat(int argc, CONST84 char *const *argv);
      |                                                                   ^
client.c: In function ‘clientLiteral’:
client.c:225:49: error: passing argument 2 of ‘Tcl_Concat’ from incompatible pointer type [-Wincompatible-pointer-types]
  225 |             char *message = Tcl_Concat (argc-1, &argv[1]);
      |                                                 ^~~~~~~~
      |                                                 |
      |                                                 char **
/usr/include/tclDecls.h:274:67: note: expected ‘const char * const*’ but argument is of type ‘char **’
  274 | EXTERN char *           Tcl_Concat(int argc, CONST84 char *const *argv);
      |                                                                   ^
make[1]: *** [<builtin>: client.o] Error 1
make[1]: Leaving directory '/home/vale/Downloads/x11iraf-2.1/obm'
make: *** [Makefile:11: obm/libobm.a] Error 2

And here is the error from the ARCH repository

==> Making package: x11iraf-git r160.92133fd-1 (Wed 11 Sep 2024 09:27:34 AM -03)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating x11iraf git repo...
==> Validating source files with md5sums...
    x11iraf ... Skipped
==> Extracting sources...
  -> Creating working copy of x11iraf git repo...
Reset branch 'makepkg'
==> Starting pkgver()...
==> Removing existing $pkgdir/ directory...
==> Starting build()...
make -C obm
make[1]: Entering directory '/home/vale/Downloads/x11iraf-git/src/x11iraf/obm'
cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/home/vale/Downloads/x11iraf-git/src=/usr/src/debug/x11iraf-git -flto=auto -I/usr/include/tcl   -c -o widget.o widget.c
widget.c: In function ‘widgetAddCallback’:
widget.c:860:71: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘ObmContext’ [-Wformat=]
  860 |                 sprintf (text_translations, "<Key>Return: do_text(0x%lx, %s) ",
      |                                                                     ~~^
      |                                                                       |
      |                                                                       long unsigned int
  861 |                     wp->obm, XtName(wp->w));
      |                     ~~~~~~~                                            
      |                       |
      |                       ObmContext
widget.c: In function ‘widgetSPCallback’:
widget.c:1282:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 1282 |             sprintf (message, "%d", (int)call_data);
      |                                     ^
widget.c: In function ‘do_userproc’:
widget.c:1572:36: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘Time’ {aka ‘long unsigned int’} [-Wformat=]
 1572 |                     sprintf (op, "%u ", time);
      |                                   ~^    ~~~~
      |                                    |    |
      |                                    |    Time {aka long unsigned int}
      |                                    unsigned int
      |                                   %lu
widget.c: In function ‘widgetGet’:
widget.c:2106:34: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘caddr_t’ {aka ‘char *’} [-Wformat=]
 2106 |             sprintf (result, "0x%x", value);
      |                                 ~^   ~~~~~
      |                                  |   |
      |                                  |   caddr_t {aka char *}
      |                                  unsigned int
      |                                 %s
widget.c:2120:34: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘caddr_t’ {aka ‘char *’} [-Wformat=]
 2120 |             sprintf (result, "0x%x", value);
      |                                 ~^   ~~~~~
      |                                  |   |
      |                                  |   caddr_t {aka char *}
      |                                  unsigned int
      |                                 %s
widget.c: In function ‘widgetSetList’:
widget.c:2222:33: error: passing argument 2 of ‘XawListChange’ from incompatible pointer type [-Wincompatible-pointer-types]
 2222 |           XawListChange (wp->w, items, nitems, 0, resize);
      |                                 ^~~~~
      |                                 |
      |                                 const char **
In file included from ObmP.h:30,
                 from widget.c:5:
/usr/include/X11/Xaw/List.h:170:26: note: expected ‘char **’ but argument is of type ‘const char **’
  170 |  String                 *list,
      |  ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
widget.c: In function ‘widgetAddEventHandler’:
widget.c:4391:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 4391 |         new_cb->client_data = (XtPointer) event_mask;
      |                               ^
widget.c: In function ‘widgetRemoveEventHandler’:
widget.c:4434:42: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 4434 |             XtRemoveEventHandler (wp->w, (int) cb->client_data, nonmaskable,
      |                                          ^
widget.c: In function ‘widgetEvent’:
widget.c:4502:32: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘Time’ {aka ‘long unsigned int’} [-Wformat=]
 4502 |                 sprintf (op, "%u %d %d %d %d ",
      |                               ~^
      |                                |
      |                                unsigned int
      |                               %lu
 4503 |                     ev->time, ev->x, ev->y, ev->x_root, ev->y_root);
      |                     ~~~~~~~~    
      |                       |
      |                       Time {aka long unsigned int}
widget.c:4533:32: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘Time’ {aka ‘long unsigned int’} [-Wformat=]
 4533 |                 sprintf (op, "%u %d %d %d %d ",
      |                               ~^
      |                                |
      |                                unsigned int
      |                               %lu
 4534 |                     ev->time, ev->x, ev->y, ev->x_root, ev->y_root);
      |                     ~~~~~~~~    
      |                       |
      |                       Time {aka long unsigned int}
widget.c:4557:29: warning: ‘XKeycodeToKeysym’ is deprecated [-Wdeprecated-declarations]
 4557 |                             keysym = XKeycodeToKeysym (obm->display,
      |                             ^~~~~~
In file included from /usr/include/X11/Intrinsic.h:53,
                 from ObmP.h:16:
/usr/include/X11/Xlib.h:1683:15: note: declared here
 1683 | extern KeySym XKeycodeToKeysym(
      |               ^~~~~~~~~~~~~~~~
widget.c:4575:32: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘Time’ {aka ‘long unsigned int’} [-Wformat=]
 4575 |                 sprintf (op, "%u %d %d %d %d ",
      |                               ~^
      |                                |
      |                                unsigned int
      |                               %lu
 4576 |                     ev->time, ev->x, ev->y, ev->x_root, ev->y_root);
      |                     ~~~~~~~~    
      |                       |
      |                       Time {aka long unsigned int}
widget.c: In function ‘widgetGetFontName’:
widget.c:4742:43: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
 4742 |                         sprintf(name, "%s%d", name, val);
      |                                          ~^         ~~~
      |                                           |         |
      |                                           int       long unsigned int
      |                                          %ld
make[1]: *** [<builtin>: widget.o] Error 1
make[1]: Leaving directory '/home/vale/Downloads/x11iraf-git/src/x11iraf/obm'
make: *** [Makefile:11: obm/libobm.a] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

I tried reinstalling all libraries and went one by one on the dependencies making sure that they are installed, specially TCL. Hopes this bug report helps making this tool fully available on ARCH

olebole commented 2 months ago

This is with version 2.1, right? Unfortunately, that version doesn't compile well with the latest compilers. Please try out version 2.2rc1 or the current "main" branch from Github (i.e. git clone git@github.com:iraf-community/x11iraf.git).

HkLuna commented 2 months ago

I tried 2.2rc1 2.1 and the beta 2.0, and as i described i already cloned from git and gave the same error, i as well tried this one https://aur.archlinux.org/x11iraf-git.git and it was the same error as all versions i tried

olebole commented 2 months ago

I am rather sure that this is from 2.1 and not the current Git repository state, because the first error message is

client.c: In function ‘ClientEvaluate’:
client.c:137:53: error: passing argument 4 of ‘Tcl_SplitList’ from incompatible pointer type [-Wincompatible-pointer-types]
  137 | literal:    if (Tcl_SplitList (tcl, command, &argc, &argvp) == TCL_OK) {
      |                                                     ^~~~~~
      |                                                     |
      |                                                     char ***
In file included from /usr/include/tcl.h:2421,
                 from ObmP.h:76,
                 from client.c:4:
/usr/include/tclDecls.h:722:49: note: expected ‘const char ***’ but argument is of type ‘char ***’
  722 |                                 CONST84 char ***argvPtr);
      |                                                 ^
client.c: In function ‘clientGcmd’:

but argvp is mentioned to be char *** but is declared as const char *** here: https://github.com/iraf-community/x11iraf/blob/92133fd1d555fcd019a89cbc4a72ce2da36011bf/obm/client.c#L126

As I said, this was already fixed after the release of x11iraf-2.1.

HkLuna commented 2 months ago

Hey, as i said in the previous comment, i did install all the versions from 2.0 to 2.2rc1 and yes one of the error messages i copied is from version 2.1, as you can clearly see in the error message that you copied on the end it says "make[1]: Leaving directory '/home/vale/Downloads/x11iraf-2.1/obm'" but the second error message i copied that i specified that has another type of error has the following

"widget.c: In function ‘widgetSetList’:
widget.c:2222:33: error: passing argument 2 of ‘XawListChange’ from incompatible pointer type [-Wincompatible-pointer-types]
 2222 |           XawListChange (wp->w, items, nitems, 0, resize);
      |                                 ^~~~~
      |                                 |
      |                                 const char **
In file included from ObmP.h:30,
                 from widget.c:5:
/usr/include/X11/Xaw/List.h:170:26: note: expected ‘char **’ but argument is of type ‘const char **’
  170 |  String                 *list,
      |  ~~~~~~~~~~~~~~~~~~~~~~~~^~~~"

Again as i already said before, i compiled all versions and all versions gave the error of incompatible pointers, 2.0 and 2.1 gave the error that you already said happens only on 2.1 and as i said previously i also tried both 2.2rc1 and the git clone one and both gave the error i copied and isolated on this comment so you can see that while its the same error, its a different part of the code.

olebole commented 2 months ago

It is useful to stick on the latest commit in the repository for bug hunting, as otherwise I would need to dig out what is actual and what is not. Also, please try to format the messages as code so that remain readable (I corrected this in your previous messages). I must say that my file /usr/include/X11/Xaw/List.h (package libxaw7-dev 1.0.14 on Debian) is slightly different; the declaration of the argument is there

void XawListChange
(
 Widget         w,
 _Xconst char       **list,
 int            nitems,
 int            longest,
#if NeedWidePrototypes
 int            resize
#else
 Boolean        resize
#endif
 );

with _Xconst being defined as const in /usr/include/X11/Xfuncproto.h. You probably use a newer Xaw libary which uses String here. You therefore could try to add -D_CONST_X_STRING to your CPPFLAGS which make strings constant.

wuqso commented 3 days ago

Here is the error when compiling it on Fedora 41

$ make
make -C obm
make[1]: Entering directory '/home/.../Downloads/x11iraf-main/obm'
cc -I/usr/include/tcl   -c -o Obm.o Obm.c
cc -I/usr/include/tcl   -c -o client.o client.c
cc -I/usr/include/tcl   -c -o param.o param.c
cc -I/usr/include/tcl   -c -o server.o server.c
server.c: In function ‘serverGetResources’:
server.c:983:34: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  983 |             r->resource_offset = (unsigned int) &(((Value *)NULL)[item].value);
      |                                  ^
cc -I/usr/include/tcl   -c -o widget.o widget.c
widget.c: In function ‘widgetSPCallback’:
widget.c:1282:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 1282 |             sprintf (message, "%d", (int)call_data);
      |                                     ^
widget.c: In function ‘widgetSetList’:
widget.c:2222:33: error: passing argument 2 of ‘XawListChange’ from incompatible pointer type [-Wincompatible-pointer-types]
 2222 |           XawListChange (wp->w, items, nitems, 0, resize);
      |                                 ^~~~~
      |                                 |
      |                                 const char **
In file included from ObmP.h:30,
                 from widget.c:5:
/usr/include/X11/Xaw/List.h:170:26: note: expected ‘char **’ but argument is of type ‘const char **’
  170 |  String                 *list,
      |  ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
widget.c: In function ‘widgetAddEventHandler’:
widget.c:4391:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 4391 |         new_cb->client_data = (XtPointer) event_mask;
      |                               ^
widget.c: In function ‘widgetRemoveEventHandler’:
widget.c:4434:42: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 4434 |             XtRemoveEventHandler (wp->w, (int) cb->client_data, nonmaskable,
      |                                          ^
widget.c: In function ‘widgetEvent’:
widget.c:4557:29: warning: ‘XKeycodeToKeysym’ is deprecated [-Wdeprecated-declarations]
 4557 |                             keysym = XKeycodeToKeysym (obm->display,
      |                             ^~~~~~
In file included from /usr/include/X11/Intrinsic.h:53,
                 from ObmP.h:16:
/usr/include/X11/Xlib.h:1683:15: note: declared here
 1683 | extern KeySym XKeycodeToKeysym(
      |               ^~~~~~~~~~~~~~~~
make[1]: *** [<builtin>: widget.o] Error 1
make[1]: Leaving directory '/home/jhwu/Downloads/x11iraf-main/obm'
make: *** [Makefile:11: obm/libobm.a] Error 2
olebole commented 1 day ago

Did you try my recommendation above?

You therefore could try to add -D_CONST_X_STRING to your CPPFLAGS which make strings constant.