Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: weird problem with macports perl on apple m1/m2 based system

by perltux (Monk)
on Jun 12, 2023 at 18:41 UTC ( [id://11152815] : note . print w/replies, xml ) Need Help??


in reply to Re^2: weird problem with macports perl on apple m1/m2 based system
in thread weird problem with macports perl on apple m1/m2 based system

I don't know about xquartz (as I said I don't own a Mac so I'm not familiar with what xquartz is), but you would have to install xorg from MacPorts like this:

sudo port install xorg
sudo port install p5-tk

that's taken from the macOS installation instructions for my application, these instructions were written for me by another macOS user (with an Intel Mac though).
http://obd-amigos.linuxtech.net/files/00-How_to_install_OBD_Amigos_on_macOS.html

Since these are MacPorts packages, isn't it quite easy to uninstall them cleanly again after the test, if you have no need for them?

Thanks for the one-liner test but unfortunately it's not as simple as that to trigger this issue, I also gave the user of my application a similar one-liner (but with eval) at first, without triggering the issue. I have a feeling that Tk is needed to trigger the issue.
  • Comment on Re^3: weird problem with macports perl on apple m1/m2 based system

Replies are listed 'Best First'.
Re^4: weird problem with macports perl on apple m1/m2 based system
by syphilis (Archbishop) on Jun 15, 2023 at 01:09 UTC
    I have a feeling that Tk is needed to trigger the issue.

    You're saying that you feel it's a bug in Tk.
    If it is a bug in Tk, then I would think it's a bug that's being exposed by some specific rarity in the users perl configuration or system.

    In any case, I think the first thing to obtain and peruse is the perl -V output from the user's m1/m2 system.

    Cheers,
    Rob
      "I think the first thing to obtain and peruse is the perl -V output from the user's m1/m2 system"

      here you go:

      Summary of my perl5 (revision 5 version 34 subversion 1) configuration +: Platform: osname=darwin osvers=22.3.0 archname=darwin-thread-multi-2level uname='darwin venturaa.local 22.3.0 darwin kernel version 22.3.0: +mon jan 30 20:39:35 pst 2023; root:xnu-8792.81.3~2release_arm64_t8103 + arm64 ' config_args='-des -Dprefix=/opt/local -Dscriptdir=/opt/local/bin - +Dvendorprefix=/opt/local -Dusemultiplicity=y -Dusethreads -Duseshrpli +b -Dcc=/usr/bin/cc -Dman1ext=1pm -Dman3ext=3pm -Dinstallstyle=lib/per +l5 -Dman1dir=/opt/local/share/man/man1p -Dman3dir=/opt/local/share/ma +n/man3p -Dsitebin=/opt/local/libexec/perl5.34/sitebin -Dsiteman1dir=/ +opt/local/share/perl5.34/siteman/man1 -Dsiteman3dir=/opt/local/share/ +perl5.34/siteman/man3 -Dvendorbin=/opt/local/libexec/perl5.34 -Dvendo +rman1dir=/opt/local/share/perl5.34/man/man1 -Dvendorman3dir=/opt/loca +l/share/perl5.34/man/man3 -Dpager=/usr/bin/less -sR -Dperlpath=/opt/l +ocal/bin/perl5.34 -Dstartperl=#!/opt/local/bin/perl5.34 -Acppflags=-I +/opt/local/include -Accflags=-pipe -Os -Alddlflags=-L/opt/local/li +b -Wl,-headerpad_max_install_names -Aldflags=-L/opt/local/lib -Wl,- +headerpad_max_install_names ' hint=recommended useposix=true d_sigaction=define useithreads=define usemultiplicity=define use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n default_inc_excludes_dot=define Compiler: cc='/usr/bin/cc' ccflags ='-fno-common -DPERL_DARWIN -pipe -Os -fno-strict-alias +ing -fstack-protector-strong -I/opt/local/include -DPERL_USE_SAFE_PUT +ENV' optimize='-O3' cppflags='-I/opt/local/include -fno-common -DPERL_DARWIN -pipe - +Os -fno-strict-aliasing -fstack-protector-strong -I/opt/local/inclu +de' ccversion='' gccversion='Apple LLVM 14.0.0 (clang-1400.0.29.202)' gccosandvers='' intsize=4 longsize=8 ptrsize=8 doublesize=8 byteorder=12345678 doublekind=3 d_longlong=define longlongsize=8 d_longdbl=define longdblsize=8 longdblkind=0 ivtype='long' ivsize=8 nvtype='double' nvsize=8 Off_t='off_t' lseeksize=8 alignbytes=8 prototype=define Linker and Libraries: ld='/usr/bin/cc' ldflags =' -L/opt/local/lib -Wl,-headerpad_max_install_names -f +stack-protector-strong' libpth=/opt/local/lib /Library/Developer/CommandLineTools/usr/lib/ +clang/14.0.0/lib /Library/Developer/CommandLineTools/SDKs/MacOSX13.1. +sdk/usr/lib /Library/Developer/CommandLineTools/usr/lib /usr/lib libs=-lgdbm perllibs= libc= so=dylib useshrplib=true libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs dlext=bundle d_dlsymun=undef ccdlflags=' ' cccdlflags=' ' lddlflags=' -bundle -undefined dynamic_lookup -L/opt/local/lib -W +l,-headerpad_max_install_names -fstack-protector-strong' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP PERL_OP_PARENT PERL_PRESERVE_IVUV PERL_USE_SAFE_PUTENV USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API USE_THREAD_SAFE_LOCALE Built under darwin Compiled at Feb 24 2023 04:18:24 @INC: /opt/local/lib/perl5/site_perl/5.34/darwin-thread-multi-2level /opt/local/lib/perl5/site_perl/5.34 /opt/local/lib/perl5/vendor_perl/5.34/darwin-thread-multi-2level /opt/local/lib/perl5/vendor_perl/5.34 /opt/local/lib/perl5/5.34/darwin-thread-multi-2level /opt/local/lib/perl5/5.34

      I'm not really sure what to look for in this output, I see USE_LOCALE_NUMERIC among the active compile time options but that's also the case with the Perl on my Linux PC so that by itself should not be the cause of the issue.
        I'm not really sure what to look for in this output...

        I think the main thing is that we can now see that we're not dealing with an old perl, that PERL5OPT (and/or other perl-specific environment variables) have not been set, and that everything looks sane.
        The main thing is that you look for a "standout" difference between that output and the output that you get.
        If there's nothing to be seen there, as is apparently the case, then at least we know to look elsewhere.

        AFAICS, the issue should be reproducible on the problem machine by running this script:
        use warnings; #use Tk; print "result:\n"; $_A = '16.25'; # string, not number $_V = '12.99'; # string, not number $formula = 'sprintf("%.0f", ($_V * $_A))'; $_W = eval($formula); print "$_V\n"; print "$_A\n"; print "$_W\n";
        If that doesn't reproduce the problem, then I would begin reinstating bits of the original script to it (starting by commenting in the "use Tk;" line) until you hit the point where the problem does kick in.

        It's an interesting one ... even if that simplified test script successfully demonstrates the bug, then there's still the question of "why and how ??".
        But let's not get too far ahead of ourselves ;-)

        UPDATE: If the script I provided did not tickle the bug, then how about this one that fully reinstates the Tk stuff:
        use warnings; use Tk; my $mw=MainWindow->new(); $mw->Button(-text=>" Test ", -command=>sub{test()}, -font=>'Helvet +ica 18 bold', -pady=>20)->pack(); MainLoop; sub test { print "result:\n"; $_A = '16.25'; # string, not number $_V = '12.99'; # string, not number $formula = 'sprintf("%.0f", ($_V * $_A))'; $_W = eval($formula); print "$_V\n"; print "$_A\n"; print "$_W\n"; }

        Cheers,
        Rob
      I will see if I can get that output but I haven't gotten any reply in almost a week to my last message to the macOS M1 the user of my application so I don't know if and when I will get it.
        I will see if I can get that output but I haven't gotten any reply in almost a week to my last message ...

        Yes, please do follow up here with any additional info that becomes available.
        I find it interesting to understand how such weird behaviour, as you've described, becomes possible.
        So far, I can't think of anything other than "use integer" or maybe some locale issue (both of which have already been mentioned).
        But who knows what else there might be lurking about ;-)

        Cheers,
        Rob
Re^4: weird problem with macports perl on apple m1/m2 based system
by trwww (Priest) on Jun 14, 2023 at 20:35 UTC
    Hi, I did do `sudo port install xorg` but got the same display error as earlier running your Tk program and didn't proceed installing additional dependencies, apologies.
      Did the display error appear even after a reboot? Maybe a reboot is needed to get it running.
      Sorry I don't know macOS therefore I can't really tell why the xorg server doesn't work on your Mac, thanks anyway for trying.