in reply to cpanm Tk build errors

configure: error: installation or configuration problem: C compiler cannot create executables.

The test compiles a hello-world-style program and tries to run it. If that fails, you get this error message. One reason is compiling for a different platform or set of libraries. That's a typical problem when cross-compiling. Another problems I can imagine is a filesystem mounted with the noexec option.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: cpanm Tk build errors
by thimes (Acolyte) on Jun 14, 2024 at 06:03 UTC
    I've built hello_world.c and ran it with no issues. Also, Removed Perl Downloaded latest version of Xcode v16 Beta Used Perlbrew to reinstall Perl perlbrew install perl-5.38.2 perlbrew switch perl-5.38.2 All installed and tested Ok. Tried installing Tk again. FAIL cpanm Tk Same errors. Grrrr.

      Try cpanm --look Tk . This will take you to the Tk build dir. If you are versed with autotools edit ./configure to find the position where it fails. It should be creating a C test program to compile and saving it to a tmp dir. And also there should be the compilation command line (which is also printed on the console). Halt it there and add lines to tell you where that test C program is AND what is the path of cc with which cc.

      Also run ./configure with explicitly specifying the fullpath to the compiler: ./confgure CC=/x/y/z/cc (or something like this)

      The possible reasons for the errors you get are: 1) test C program includes files which are not found, 2) the compiler executable is not what you think it is (note that it does not use the fullpath to the compiler), 3) compiler flags are wrong (note that you may already have ENV vars in your shell which specify CFLAGS, LDFLAGS, CC etc. 4) the compilation fails at the linking stage because LIBRARIES are not found or wrong ones are used. This is/was controlled with LD_LIBRARY_PATH and apple-specific DYLD_LIBRARY_PATH. Do you have those set in your ENV? Their use is frowned upon but sometimes is the last resort.

      Far fetched but: check what user the compilation is run under (whoami) and whether it has in its path the specific compiler and uses that compiler with no extra CFLAGS, library paths etc. from login settings e.g. in bashrc