Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Compile perl with custom compiler path, perlbrew solution preferred

by bliako (Abbot)
on Jun 13, 2024 at 15:05 UTC ( [id://11159958]=perlquestion: print w/replies, xml ) Need Help??

bliako has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monkees!

I need to compile perl from source with custom compiler living in /usr/local/gcc82 (with subdirs bin, include, lib etc.). The reason is that I am embedding CUDA code (which is C) via Inline::C which needs this specific compiler. And XS code must be compiled with same compiler as its perl. (Indeed I get segmentation fault when doing otherwise). So I need perl compiled with this specific compiler and I am doing this on Linux.

I prefer to let perlbrew do the compilation and installation. Is there a simple way to do it? Alternatively, I need to do it manually.

Replies are listed 'Best First'.
Re: Compile perl with custom compiler path, perlbrew solution preferred
by Fletch (Bishop) on Jun 13, 2024 at 20:12 UTC

    When doing this from vanilla source via hand you'd just pass -Dcc=/usr/local/gcc82/bin/gcc yadda yadda yadda. It looks like (cribbing from this SO answer) there's an PERLBREW_CONFIGURE_FLAGS environment variable you could add those settings to when you run perlbrew and that might do it.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      thank you. It worked as expected. It was prompting me to answer many questions and did not use the sane defaults as usual, I guess the presence of the FLAGS triggers this behaviour. I had to add -d to the FLAGS. And because another such perl existed, I also had to give it a different name:

      PERLBREW_CONFIGURE_FLAGS='-d -Dcc=/usr/local/gcc82/bin/gcc' perlbrew i +nstall 5.38.2 --as 5.38.2.gcc82

      And I can confirm that any C code embedded via Inline::C is compiled with the expected compiler.

Re: Compile perl with custom compiler path, perlbrew solution preferred
by cavac (Parson) on Jun 18, 2024 at 13:38 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11159958]
Approved by johngg
Front-paged by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-07-17 11:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    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.