in reply to Re^3: cpanm Tk build errors
in thread cpanm Tk build errors

Hi Again

I attempted to load the 14.3.1 macOS toolkit onto my machine but I got an error messsage indicating my machine was too new :( . So..., I cannot downgrade.

Another option would be to update the compiler options to add "-std=c89"; this should resolve the issue. However, it is not clear to me how to do that. The environment variable CFLAGS mechanism does not seem to be supported on macOS. And the install seems to be one big operation (i.e. download, unzip, check this and that, compile the works, etc.) Any thoughts on how to do that?

Thanks in advance for any help,
Hugh

Replies are listed 'Best First'.
Re^5: cpanm Tk build errors
by syphilis (Archbishop) on Aug 28, 2024 at 05:26 UTC
    Another option would be to update the compiler options to add "-std=c89"

    That's pretty easy to try out if you think it might help.
    The following is a simple technique that I've used many times on Windows ... and I think it would be just as affective on other systems (but I haven't tested that).
    In one of your @INC directories, just create a .pm file named (say) AltConfig.pm, which contains (eg):
    package AltConfig; use warnings; use Config; my $ccflags = $Config{ccflags}; $ccflags .= ' -std=c89'; my $obj = tied %Config; $obj->{ccflags} = $ccflags; 1;
    Then set the PERL5OPT environment variable to contain -MAltConfig
    That will probably mean that you have to create that environment variable - but I don't rule out the possibility that PER5OPT already exists (in which case you simply add -MAltConfig to it.)
    For as long as that environment variable contains that spec, the AltConfig module will be loaded whenever Perl is invoked, and $Config{ccflags} will have the "std=c89" flag appended to it.
    You can easily verify this by running perl -V:ccflags

    Inside AltConfig.pm you can alter ccflags (or any other %Config key) to specify precisely whatever you want.
    Reverting to your original perl setup is then as simple as removing -MAltConfig from the PERL5OPT environment variable.

    I don't know if that will prove to be useful in fixing your issue ... but it's simple enough to try out, if you want.

    Cheers,
    Rob

      Rob,
      You are a scholar and a gentleman, worked like a charm!
      If I ever get to Australia, I will buy you a beer! :)
      Hugh