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

Fails to build with gcc14 #14

Open
jthvai opened this issue Dec 4, 2024 · 9 comments
Open

Fails to build with gcc14 #14

jthvai opened this issue Dec 4, 2024 · 9 comments

Comments

@jthvai
Copy link

jthvai commented Dec 4, 2024

When running make:

cc -c  -I. -I/usr/lib/perl5/5.40/vendor_perl/Tk -I/usr/lib/perl5/5.40/vendor_perl/Tk/pTk -I/usr/lib/perl5/5.40/vendor_perl/Tk/X11 -I/usr/X11R6/include -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/include/db5.3 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -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=/build/perl/src=/usr/src/debug/perl -flto=auto   -DVERSION=\"3.306\" -DXS_VERSION=\"804.036\" -fPIC "-I/usr/lib/perl5/5.40/core_perl/CORE"  -DPTK -DATC -DGL -DSHAPE PostScript.c
PostScript.c: In function ‘ZnPostScriptCmd’:
PostScript.c:308:59: error: passing argument 5 of ‘TkdeclsVptr->V_Tk_ConfigureWidget’ from incompatible pointer type [-Wincompatible-pointer-types]
  308 |                               argc-2, (CONST char **) argv+2,
      |                                       ~~~~~~~~~~~~~~~~~~~~^~
      |                                                           |
      |                                                           const char **
PostScript.c:308:59: note: expected ‘Tcl_Obj * const*’ but argument is of type ‘const char **’
make: *** [Makefile:433: PostScript.o] Error 1

See also: the AUR comment


$ cc --version
cc (GCC) 14.2.1 20240910

$ perl --version
This is perl 5, version 40, subversion 0 (v5.40.0) built for x86_64-linux-thread-multi
@stefanhaerter
Copy link

Same problem here - unsurprisingly with the same setup regarding cc and perl versions.

@asb-capfan
Copy link
Owner

Currently I do not have a Linux box. Need to set one up first. Do you maybe have a docker container I could use to reproduce?

@stefanhaerter
Copy link

Sadly, no - but if this would be an option, I could take on the task of creating such a container. I haven't done this yet and would consider it a good opportunity to expanding my docker knowledge.

@asb-capfan
Copy link
Owner

I would very much appreciate this, thank you!

@stefanhaerter
Copy link

When trying to build a dockerfile, the build of perk-tk-zinc does not fail - I haven't yet managed to figure out why. As I am running Arch, I attempted to replicate the situation on my machine in the dockerfile. I used the Arch latest image, which has, as it states in the package list (https://hub.docker.com/layers/library/archlinux/latest/images/sha256-c6adc95d0eabb024edace76211d96a1c43846e475eee5ce7bbf71a444d332bf9) also gcc version 14.2.1.

So... I'm on it, but also a bit baffled now.

@jthvai
Copy link
Author

jthvai commented Dec 22, 2024

Here is a dockerfile in which the build fails as expected:

FROM --platform=linux/amd64 docker.io/library/archlinux:base-devel-20241215.0.289170

ARG TK_ZINC_VERSION=3.306

RUN pacman -Syu --noconfirm perl-tk glu
ADD https://cpan.metacpan.org/authors/id/A/AS/ASB/Tk-Zinc-$TK_ZINC_VERSION.tar.gz /root
RUN tar -C /root -xf /root/Tk-Zinc-$TK_ZINC_VERSION.tar.gz

WORKDIR /root/Tk-Zinc-$TK_ZINC_VERSION
RUN /usr/bin/perl Makefile.PL
RUN make
Build output
$ podman build . 

[...]

STEP 8/8: RUN make

[...]

cc -c  -I. -I/usr/lib/perl5/5.40/vendor_perl/Tk -I/usr/lib/perl5/5.40/vendor_perl/Tk/pTk -I/usr/lib/perl5/5.40/vendor_perl/Tk/X11 -I/usr/X11R6/include -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/include/db5.3 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -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=/build/perl/src=/usr/src/debug/perl -flto=auto   -DVERSION=\"3.306\" -DXS_VERSION=\"804.036\" -fPIC "-I/usr/lib/perl5/5.40/core_perl/CORE"  -DPTK -DATC -DSHAPE -DGL PostScript.c
PostScript.c: In function ‘ZnPostScriptCmd’:
PostScript.c:308:59: error: passing argument 5 of ‘TkdeclsVptr->V_Tk_ConfigureWidget’ from incompatible pointer type [-Wincompatible-pointer-types]
  308 |                               argc-2, (CONST char **) argv+2,
      |                                       ~~~~~~~~~~~~~~~~~~~~^~
      |                                                           |
      |                                                           const char **
PostScript.c:308:59: note: expected ‘Tcl_Obj * const*’ but argument is of type ‘const char **’
make: *** [Makefile:433: PostScript.o] Error 1
Error: building at STEP "RUN make": while running runtime: exit status 2

@asb-capfan
Copy link
Owner

Thank you. I tried to tackle this one, but it is too dificult for me, unfortunately.
In Postscript.c, I changed:

result = Tk_ConfigureWidget(wi->interp, wi->win, config_specs,
                              argc-2, (CONST char **) argv+2,
                              (char *) &ps_info,
                              TK_CONFIG_ARGV_ONLY|TK_CONFIG_OBJS);

Into:

result = Tk_ConfigureWidget(wi->interp, wi->win, config_specs,
                        argc-2, argv+2,  // Pass Tcl_Obj array directly
                        (char *) &ps_info,
                        TK_CONFIG_ARGV_ONLY|TK_CONFIG_OBJS);

But then there is more errors in tkZinc.c where I do not know how to resolve them:

#0 4.287 tkZinc.c: In function ‘InitZinc’:
#0 4.288 tkZinc.c:9002:59: error: passing argument 3 of ‘gluTessCallback’ from incompatible pointer type [-Wincompatible-pointer-types]
#0 4.288  9002 |   gluTessCallback(ZnTesselator.tess, GLU_TESS_BEGIN_DATA, ZnTessBegin);
#0 4.288       |                                                           ^~~~~~~~~~~
#0 4.288       |                                                           |
#0 4.288       |                                                           void (*)(GLenum,  void *) {aka void (*)(unsigned int,  void *)}
#0 4.288 In file included from tkZinc.h:27,
#0 4.288                  from tkZinc.c:38:
#0 4.288 /usr/include/GL/glu.h:336:87: note: expected ‘_GLUfuncptr’ {aka ‘void (*)(void)’} but argument is of type ‘void (*)(GLenum,  void *)’ {aka ‘void (*)(unsigned int,  void *)’}
#0 4.288   336 | GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
#0 4.288       |                                                                           ~~~~~~~~~~~~^~~~~~~~~~~~
#0 4.290 tkZinc.c:9003:60: error: passing argument 3 of ‘gluTessCallback’ from incompatible pointer type [-Wincompatible-pointer-types]
#0 4.290  9003 |   gluTessCallback(ZnTesselator.tess, GLU_TESS_VERTEX_DATA, ZnTessVertex);
#0 4.290       |                                                            ^~~~~~~~~~~~
#0 4.290       |                                                            |
#0 4.290       |                                                            void (*)(void *, void *)
#0 4.290 /usr/include/GL/glu.h:336:87: note: expected ‘_GLUfuncptr’ {aka ‘void (*)(void)’} but argument is of type ‘void (*)(void *, void *)’
#0 4.290   336 | GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
#0 4.290       |                                                                           ~~~~~~~~~~~~^~~~~~~~~~~~
#0 4.291 tkZinc.c:9004:57: error: passing argument 3 of ‘gluTessCallback’ from incompatible pointer type [-Wincompatible-pointer-types]
#0 4.291  9004 |   gluTessCallback(ZnTesselator.tess, GLU_TESS_END_DATA, ZnTessEnd);
#0 4.291       |                                                         ^~~~~~~~~
#0 4.291       |                                                         |
#0 4.291       |                                                         void (*)(void *)
#0 4.291 /usr/include/GL/glu.h:336:87: note: expected ‘_GLUfuncptr’ {aka ‘void (*)(void)’} but argument is of type ‘void (*)(void *)’
#0 4.291   336 | GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
#0 4.291       |                                                                           ~~~~~~~~~~~~^~~~~~~~~~~~
#0 4.292 tkZinc.c:9005:61: error: passing argument 3 of ‘gluTessCallback’ from incompatible pointer type [-Wincompatible-pointer-types]
#0 4.292  9005 |   gluTessCallback(ZnTesselator.tess, GLU_TESS_COMBINE_DATA, ZnTessCombine);
#0 4.292       |                                                             ^~~~~~~~~~~~~
#0 4.292       |                                                             |
#0 4.292       |                                                             void (*)(GLdouble *, void **, GLfloat *, void **, void *) {aka void (*)(double *, void **, float *, void **, void *)}
#0 4.292 /usr/include/GL/glu.h:336:87: note: expected ‘_GLUfuncptr’ {aka ‘void (*)(void)’} but argument is of type ‘void (*)(GLdouble *, void **, GLfloat *, void **, void *)’ {aka ‘void (*)(double *, void **, float *, void **, void *)’}
#0 4.292   336 | GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
#0 4.292       |                                                                           ~~~~~~~~~~~~^~~~~~~~~~~~
#0 4.294 tkZinc.c:9006:59: error: passing argument 3 of ‘gluTessCallback’ from incompatible pointer type [-Wincompatible-pointer-types]
#0 4.294  9006 |   gluTessCallback(ZnTesselator.tess, GLU_TESS_ERROR_DATA, ZnTessError);
#0 4.294       |                                                           ^~~~~~~~~~~
#0 4.294       |                                                           |
#0 4.294       |                                                           void (*)(GLenum * (*)(), void *) {aka void (*)(unsigned int * (*)(), void *)}
#0 4.294 /usr/include/GL/glu.h:336:87: note: expected ‘_GLUfuncptr’ {aka ‘void (*)(void)’} but argument is of type ‘void (*)(GLenum * (*)(), void *)’ {aka ‘void (*)(unsigned int * (*)(), void *)’}
#0 4.294   336 | GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
#0 4.294       |                                                                           ~~~~~~~~~~~~^~~~~~~~~~~~
#0 4.314 make: *** [Makefile:433: tkZinc.o] Error 1

PRs welcome :-s

@stefanhaerter
Copy link

Unfortunately, I myself happen to be not familiar with C :/

I will try to have a look anyways as soon as I have the time.

@stefanhaerter
Copy link

stefanhaerter commented Jan 3, 2025

I did some research while attempting to fix the issue, and came across this comment: grpc/grpc#35148 (comment)

I wanted to give it a try at leas, and therefor I called:

./configure --enable-gl --enable-symbolds CFLAGS="-Wno-error=incompatible-pointer-types"
make

And it seemed to suceed, at least the demo was working:

wish8.6 demos/zinc-widget

However, fixing this properly is sadly far beyond my capabilities.

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

No branches or pull requests

3 participants