Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: cpanm Tk build errors

by afoken (Chancellor)
on May 22, 2024 at 12:59 UTC ( [id://11159633]=note: print w/replies, xml ) Need Help??

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.


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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11159633]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-07-13 04:39 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.