Rob,

Installing real gcc (not clang) on macOS is fraught with compatibility issues, so I installed a fresh Ubuntu 22.0.4 in VirtualBox. Fetched gcc (11.3.0) with apt and attempted to build Tk with cpanm into perl 5.34.0. This required libx11-dev which built without errors. However, alas, building Tk with sudo failed with the following linker errors in root's build log, to wit:

ar rcs libpng.a png.o pngerror.o pngget.o pngmem.o pngpread.o pngread. +o pngrio.o pngrtran.o pngrutil.o pngset.o pngtrans.o pngwio.o pngwrit +e.o pngwtran.o pngwutil.o : libpng.a make[2]: Leaving directory '/root/.cpanm/work/1688142289.10679/Tk-804. +036/PNG/libpng' make[2]: Entering directory '/root/.cpanm/work/1688142289.10679/Tk-804 +.036/PNG/libpng' x86_64-linux-gnu-gcc -fPIC -c -Wall -O2 -I../zlib pngtest.c x86_64-linux-gnu-gcc -s -L../zlib -o pngtest pngtest.o libpng.a -lz -l +m /usr/bin/ld: libpng.a(pngread.o): in function `png_read_row': pngread.c:(.text+0x10fd): undefined reference to `png_combine_row' /usr/bin/ld: pngread.c:(.text+0x1121): undefined reference to `png_com +bine_row' /usr/bin/ld: pngread.c:(.text+0x11d6): undefined reference to `png_com +bine_row' /usr/bin/ld: pngread.c:(.text+0x11f0): undefined reference to `png_com +bine_row' /usr/bin/ld: pngread.c:(.text+0x122a): undefined reference to `png_rea +d_filter_row' /usr/bin/ld: pngread.c:(.text+0x1292): undefined reference to `png_do_ +read_interlace' /usr/bin/ld: pngread.c:(.text+0x12e0): undefined reference to `png_com +bine_row' /usr/bin/ld: pngread.c:(.text+0x1337): undefined reference to `png_com +bine_row' /usr/bin/ld: pngread.c:(.text+0x136a): undefined reference to `png_com +bine_row' /usr/bin/ld: pngread.c:(.text+0x13a0): undefined reference to `png_com +bine_row' /usr/bin/ld: pngread.c:(.text+0x13de): undefined reference to `png_com +bine_row' /usr/bin/ld: libpng.a(pngread.o):pngread.c:(.text+0x1416): more undefi +ned references to `png_combine_row' follow /usr/bin/ld: libpng.a(png.o): in function `png_init_mmx_flags': png.c:(.text+0xb33): undefined reference to `png_mmx_support' collect2: error: ld returned 1 exit status make[2]: *** [Makefile:58: pngtest] Error 1 make[2]: Leaving directory '/root/.cpanm/work/1688142289.10679/Tk-804. +036/PNG/libpng' make[1]: *** [Makefile:519: subdirs] Error 2 make[1]: Leaving directory '/root/.cpanm/work/1688142289.10679/Tk-804. +036/PNG' make: *** [Makefile:769: subdirs] Error 2 -> FAIL Installing Tk failed.

I can't build Tk with either clang 9.2 or 10.1 on High Sierra, but I was hoping to do Tk dev on Ubuntu, but that too seems now to be closed off. Since Python (3.11.4) works perfectly with tkinter on my existing mac, that seems the best option. I know those two versions of clang are problematic, especially with macro expansion. I went round and round with the PDL pumpking re segmentation fault building pdlcore.c in 2.083. The C standard talks about macro length limitations, but fails to specify a value, leaving it up to compiler builder discretion (your mileage will vary). I stepped through pdlcore.c with #if 0...#endif until I found the macro,

#define PDL_KLUDGE_COPY_X(X, datatype_out, ctype_out, ppsym_out, ...) +\

that was causing the fault. I shortened two variables, cursor to c and target to t in a loop and like magic, pdlcore.c compiled. I reported this to the developers but the answer (totally bogus) was to strip out all comments and white space to shorten that macro. I argued till I was blue in the face that the C preprocessor does that, but the pumpking went ahead and released PDL 2.084 with pdlcore.c stripped of white space. As expected, its pdlcore.c segmentation faulted with both of my clangs just as the previous version had. I copied all the C headers and both versions of pdlcore.c to a private directory and preprocessed them with gcc -E, and both were identical. I reported this too to the PDL developers list but as yet have heard zero response, which means PDL is compromised in my version of macOS. Sure, my kludge fix within a kludge works for now, but if I ever try to upgrade PDL I will face the same issue. The good news, and it is very good news mixed with some bad is that PDL 2.084 builds without errors in Ubuntu. The bad is, of course, Tk builds on neither. So, I have PDL on Ubuntu, Tk nowhere, but Python with tkinter everywhere. Needless to say, I want to get on with my work rather than spend so much of my time on Perl admin.


In reply to Re^2: Tk-804.036 build failure by perlboy_emeritus
in thread Tk-804.036 build failure by perlboy_emeritus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.