in reply to Tk on Arch on Essentially Garbage Equipment

If it's any consolation, I get the same errors on a system with Linux kernel 6.14 and (i think) Xlib version 1.8. Can you not try to upgrade your system? Usually that is not space consuming. But it will fail if your hardware is no longer supported.

Another reason for failure is if your gcc compiler (sometimes aliased as cc in linux) is v14 or newer which it treats some warnings as errors and breaks everything in older systems (see https://stackoverflow.com/questions/79917415/gcc15-treats-warnings-as-errors-by-default). Needless to say that anyone trying to keep alive older computer systems will be in a lot of trouble if they allow gcc to be upgraded. Consider locking its version in your package manager. That is another way the "West" has found to shoot itself on the foot, additionally to a long strand of other equally idiotic moves we are witnessing lately.Shooting our feet is now the norm./rant

Now, if you feel adventurous, you can try the following hacks but be careful because a couple of them may break your tk scripts. Some of the failures are because of the gcc's idiotic breaking decision I mentioned above, but others are unexplained to me, like why USE_PREGCOMP_31027 is not defined although there is in the configuration. In any event, with these I managed to compile, run all the tests and install the beast to an older linux I keep.

  1. cpanm --look Tk
  2. perl Makefile.PL
  3. make all (it should fail as per your post)
  4. edit ./pTk/Xlib.t and remove 3 lines starting from line 333 incl. (the first line should be a #if... and the last an #endif... Said function is deprecated in Xlib so I don't know why Tk has not marked it so.
  5. edit ./pTk/tkCanvText.c and in line 1253 substitute size_t with int
  6. edit ./pTk/tkEvent.c and in line 1155 add int fallbackCurrent; to make it look like this TkDisplay *dispPtr;int fallbackCurrent;
  7. edit ./pTk/tkImage.c in line 1085 append int imgWidth; int imgHeight; after the existing int height;
  8. edit ./Event/Event.xs and comment out lines 1535 and 1540 (prepend with //) *This may have some side effects in warnings *
  9. edit ./objGlue.c line 630 replace *lengthPtr with *((STRLEN *)lengthPtr) (candidate for crashes if you get any).
  10. edit ./tkGlue.c comment out lines 5552 and 5560 (prepend with //)
  11. edit ./tkGlue.c and insert at the very top of the file this #define USE_PREGCOMP_31027 1
  12. make all
  13. make test
  14. make install

bw, bliako

Replies are listed 'Best First'.
Re^2: Tk on Arch on Essentially Garbage Equipment
by Tux (Canon) on May 13, 2026 at 10:18 UTC
    If this is for an old compiler, prepending // might/is likely to fail. In that case use /* ... */

    Enjoy, Have FUN! H.Merijn
Re^2: Tk on Arch on Essentially Garbage Equipment DUMP GCC, USE CLANG INSTEAD
by bliako (Abbot) on May 13, 2026 at 22:55 UTC

    FWIW, I have just compiled Tk with the clang compiler.

    Fair enough, Tk seems a bit "sick" and it needs some "fixing". However, clang's warnings about mismatched pointer types or whether size_t does not fit in int are not fatal, as is the case with the newer gcc.

    You still need to apply some of the hacks in my above reply: #4, #6, #7 and #11. The first one is oversight by the authors (including a function which is now deprecated). The next two: it is best to declare the type of the function parameters explicitly rather than having the compiler using default integer. The last one is a mystery to me, I guess it is easily fixable by a Tk configuration setting, it has nothing to do with the compiler.

    You also need to modify Makefile.PL to replace the one occurence of gcc with clang

    TLDR: it is not that your hardware is old, I guess Tk will fail to install in any Linux with gcc compiler with version 14 or newer. Even with clang it will fail. I am curious to know if gcc's analness hit other Perl packages.

    bw, bliako