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

Contents of config.log

Here is the config.log file from the above issue:

hughdagg@Hughs-iMac guiguts % cat /Users/hughdagg/.cpanm/work/17246004 +27.93037/Tk-804.036/JPEG/jpeg/./config.log This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. configure:538: checking for gcc configure:615: checking whether the C compiler (cc -fno-common -DPERL_ +DARWIN -mmacosx-version-min=14.2 -DNO_POSIX_2008_LOCALE -fno-strict-a +liasing -pipe -fstack-protector-strong -fno-common -DPERL_DARWIN -m +macosx-version-min=14.2 -DNO_POSIX_2008_LOCALE -fno-strict-aliasing - +pipe -fstack-protector-strong -mmacosx-version-min=14.2 -fstack-prot +ector-strong) works configure:629: cc -o conftest -fno-common -DPERL_DARWIN -mmacosx-versi +on-min=14.2 -DNO_POSIX_2008_LOCALE -fno-strict-aliasing -pipe -fstack +-protector-strong -fno-common -DPERL_DARWIN -mmacosx-version-min=1 +4.2 -DNO_POSIX_2008_LOCALE -fno-strict-aliasing -pipe -fstack-protect +or-strong -mmacosx-version-min=14.2 -fstack-protector-strong conftes +t.c 1>&5 configure:626:1: error: type specifier missing, defaults to 'int'; ISO + C99 and later do not support implicit int [-Wimplicit-int] main(){return(0);} ^ int 1 error generated. configure: failed program was: #line 625 "configure" #include "confdefs.h" main(){return(0);} hughdagg@Hughs-iMac guiguts %

Thanks for any help in advance, Hugh :)

Replies are listed 'Best First'.
Re^3: cpanm Tk build errors
by seawolf (Novice) on Aug 25, 2024 at 23:15 UTC

    Background

    So I did a little more digging and think the issue revolves around the fact that Clang version 15 and 16 come with new warnings;
    for more information see https://www.redhat.com/en/blog/new-warnings-and-errors-clang-16. In particular error "ISO C99 and later do not support implicit int -Wimplicit-int"

    Question

    Is there any way to pass CFLAGS into the "perl install_cpan_modules.pl"?

    Current Directory

    hughdagg@Hughs-iMac jpeg % pwd /Users/hughdagg/.cpanm/work/1724625386.12184/Tk-804.036/JPEG/jpeg

    Run Default Configure

    hughdagg@Hughs-iMac jpeg % ./configure checking for gcc... gcc checking whether the C compiler (gcc ) works... no configure: error: installation or configuration problem: C compiler ca +nnot create executables.

    Log File

    hughdagg@Hughs-iMac jpeg % cat config.log This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. configure:538: checking for gcc configure:615: checking whether the C compiler (gcc ) works configure:629: gcc -o conftest conftest.c 1>&5 configure:626:1: error: type specifier missing, defaults to 'int'; ISO + C99 and later do not support implicit int [-Wimplicit-int] main(){return(0);} ^ int 1 error generated. configure: failed program was: #line 625 "configure" #include "confdefs.h" main(){return(0);}

    Run Configure with c89 standard

    hughdagg@Hughs-iMac jpeg % ./configure "CFLAGS=-std=c89" checking for gcc... gcc checking whether the C compiler (gcc -std=c89 ) works... yes checking whether the C compiler (gcc -std=c89 ) is a cross-compiler... + no checking whether we are using GNU C... yes checking how to run the C preprocessor... gcc -E checking for function prototypes... yes checking for stddef.h... yes checking for stdlib.h... yes checking for string.h... yes checking for size_t... yes checking for type unsigned char... yes checking for type unsigned short... yes checking for type void... yes checking for working const... yes checking for inline... __inline__ checking for broken incomplete types... ok checking for short external names... ok checking to see if char is signed... yes checking to see if right shift is signed... yes checking to see if fopen accepts b spec... no checking for a BSD compatible install... /usr/bin/install -c checking for ranlib... ranlib checking libjpeg version number... 62 creating ./config.status creating Makefile creating jconfig.h jconfig.h is unchanged hughdagg@Hughs-iMac jpeg %

    Log File

    There are issues but the compiler flags turn them into warnings

    hughdagg@Hughs-iMac jpeg % cat config.log This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. configure:538: checking for gcc configure:615: checking whether the C compiler (gcc -std=c89 ) works configure:629: gcc -o conftest -std=c89 conftest.c 1>&5 configure:649: checking whether the C compiler (gcc -std=c89 ) is a cr +oss-compiler configure:654: checking whether we are using GNU C configure:663: gcc -E conftest.c configure:681: checking how to run the C preprocessor configure:702: gcc -E conftest.c >/dev/null 2>conftest.out configure:742: checking for function prototypes configure:765: gcc -c -std=c89 conftest.c 1>&5 configure:792: checking for stddef.h configure:802: gcc -E conftest.c >/dev/null 2>conftest.out configure:828: checking for stdlib.h configure:838: gcc -E conftest.c >/dev/null 2>conftest.out configure:864: checking for string.h configure:874: gcc -E conftest.c >/dev/null 2>conftest.out configure:900: checking for size_t configure:923: gcc -c -std=c89 conftest.c 1>&5 configure:994: checking for type unsigned char configure:1003: gcc -c -std=c89 conftest.c 1>&5 configure:1018: checking for type unsigned short configure:1027: gcc -c -std=c89 conftest.c 1>&5 configure:1042: checking for type void configure:1072: gcc -c -std=c89 conftest.c 1>&5 configure:1088: checking for working const configure:1142: gcc -c -std=c89 conftest.c 1>&5 configure:1163: checking for inline configure:1174: gcc -c -std=c89 conftest.c 1>&5 configure:1224: checking for broken incomplete types configure:1233: gcc -c -std=c89 conftest.c 1>&5 configure:1248: checking for short external names configure:1260: gcc -o conftest -std=c89 conftest.c 1>&5 configure:1275: checking to see if char is signed configure:1306: gcc -o conftest -std=c89 conftest.c 1>&5 configure:1295:5: error: implicitly declaring library function 'printf +' with type 'int (const char *, ...)' [-Werror,-Wimplicit-function-de +claration] printf("Hmm, it seems 'char' is not eight bits wide on your machin +e.\n"); ^ configure:1295:5: note: include the header <stdio.h> or explicitly pro +vide a declaration for 'printf' configure:1302:3: error: implicitly declaring library function 'exit' +with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit- +function-declaration] exit(is_char_signed((int) signed_char_check)); ^ configure:1302:3: note: include the header <stdlib.h> or explicitly pr +ovide a declaration for 'exit' 2 errors generated. configure: failed program was: #line 1282 "configure" #include "confdefs.h" #ifdef HAVE_PROTOTYPES int is_char_signed (int arg) #else int is_char_signed (arg) int arg; #endif { if (arg == 189) { /* expected result for unsigned char */ return 0; /* type char is unsigned */ } else if (arg != -67) { /* expected result for signed char */ printf("Hmm, it seems 'char' is not eight bits wide on your machin +e.\n"); printf("I fear the JPEG software will not work at all.\n\n"); } return 1; /* assume char is signed otherwise */ } char signed_char_check = (char) (-67); main() { exit(is_char_signed((int) signed_char_check)); } configure:1323: checking to see if right shift is signed configure:1358: gcc -o conftest -std=c89 conftest.c 1>&5 configure:1349:3: error: implicitly declaring library function 'printf +' with type 'int (const char *, ...)' [-Werror,-Wimplicit-function-de +claration] printf("Right shift isn't acting as I expect it to.\n"); ^ configure:1349:3: note: include the header <stdio.h> or explicitly pro +vide a declaration for 'printf' configure:1345:16: warning: shifting a negative signed value is undefi +ned [-Wshift-negative-value] res |= (~0L) << (32-4); ~~~~~ ^ configure:1354:3: error: implicitly declaring library function 'exit' +with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit- +function-declaration] exit(is_shifting_signed(-0x7F7E80B1L)); ^ configure:1354:3: note: include the header <stdlib.h> or explicitly pr +ovide a declaration for 'exit' 1 warning and 2 errors generated. configure: failed program was: #line 1328 "configure" #include "confdefs.h" #ifdef HAVE_PROTOTYPES int is_shifting_signed (long arg) #else int is_shifting_signed (arg) long arg; #endif /* See whether right-shift on a long is signed or not. */ { long res = arg >> 4; if (res == -0x7F7E80CL) { /* expected result for signed shift */ return 1; /* right shift is signed */ } /* see if unsigned-shift hack will fix it. */ /* we can't just test exact value since it depends on width of long. +.. */ res |= (~0L) << (32-4); if (res == -0x7F7E80CL) { /* expected result now? */ return 0; /* right shift is unsigned */ } printf("Right shift isn't acting as I expect it to.\n"); printf("I fear the JPEG software will not work at all.\n\n"); return 0; /* try it with unsigned anyway */ } main() { exit(is_shifting_signed(-0x7F7E80B1L)); } configure:1375: checking to see if fopen accepts b spec configure:1390: gcc -o conftest -std=c89 conftest.c 1>&5 configure:1385:5: error: implicitly declaring library function 'exit' +with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit- +function-declaration] exit(0); ^ configure:1385:5: note: include the header <stdlib.h> or explicitly pr +ovide a declaration for 'exit' 1 error generated. configure: failed program was: #line 1380 "configure" #include "confdefs.h" #include <stdio.h> main() { if (fopen("conftestdata", "wb") != NULL) exit(0); exit(1); } configure:1436: checking for a BSD compatible install configure:1488: checking for ranlib configure:1650: checking libjpeg version number hughdagg@Hughs-iMac jpeg %

      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

        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