Compiling Perl modules on AIX using gcc instead of cc_r?

Discussion in 'Perl Misc' started by Chris, Jun 28, 2005.

  1. Chris

    Chris Guest

    Anyone know of a way to compile C in Perl modules that require C using
    gcc instead of cc_r under AIX (5.2)? I've installed gcc on our AIX
    box, but Config for Perl is still pointing to cc_r (eg. $Config{cc} =
    'cc_r'). Just changing the config option for the C compiler doesn't
    help since cc_r C flags are being passed to gcc instead of gcc flags.

    Wondering if anyone has worked through this before. I'm surprised to
    find nothing that matches this problem on Google. (Plenty of people
    trying to compile Perl itself using gcc, but not trying to compile C
    code for module support with the Perl installation on AIX that IBM
    created, obviously with cc_r...)

    Thanks!
    -ceo
     
    Chris, Jun 28, 2005
    #1
    1. Advertising

  2. Chris

    Sisyphus Guest

    "Chris" <> wrote in message
    news:...
    > Anyone know of a way to compile C in Perl modules that require C using
    > gcc instead of cc_r under AIX (5.2)? I've installed gcc on our AIX
    > box, but Config for Perl is still pointing to cc_r (eg. $Config{cc} =
    > 'cc_r'). Just changing the config option for the C compiler doesn't
    > help since cc_r C flags are being passed to gcc instead of gcc flags.


    Yes, you need to change them too and there are probably other things that
    need to be changed, too - eg ldflags, libpth, cpp, cpprun, cppstdin. There's
    a module on cpan called ExtUtils::FakeConfig that does the job (but probably
    only for Win32) - it enables use of MinGW (gcc) compiler with a perl built
    using Microsoft's Visual Studio compiler. In all, it rewrites about 30
    Config.pm values, though in your case I would expect (without really
    knowing) the number of required rewrites to be a little less.
    ExtUtils::FakeConfig creates a Config file called Confg_m.pm that contains
    the rewritten values. The original Config.pm remains untouched, and perl -V
    reports what it has always reported in the past. If you want to use the
    "rewritten" values, you run (eg):
    perl -MConfig_m Makefile.PL

    Perhaps it may be of use in "showing the way" to a solution for you.
    However, you'll need to know (or find out) what the appropriate values for
    gcc are. If you have access to a machine that has a gcc-built perl on it,
    then that could be very useful.

    >
    > Wondering if anyone has worked through this before. I'm surprised to
    > find nothing that matches this problem on Google. (Plenty of people
    > trying to compile Perl itself using gcc, but not trying to compile C
    > code for module support with the Perl installation on AIX that IBM
    > created, obviously with cc_r...)
    >


    You may well find it's simpler to build perl with gcc, rather than modify
    the Config values. That way you automatically get the correct Config values
    without even having to think about it.

    If you create a module to do the job, then you should consider putting it on
    cpan - perhaps ExtUtils::FakeConfig_AIX

    Cheers,
    Rob
     
    Sisyphus, Jun 29, 2005
    #2
    1. Advertising

  3. Chris

    Chris Guest

    Sisyphus wrote:
    > "Chris" <> wrote in message
    > news:...
    > > Anyone know of a way to compile C in Perl modules that require C using
    > > gcc instead of cc_r under AIX (5.2)? I've installed gcc on our AIX
    > > box, but Config for Perl is still pointing to cc_r (eg. $Config{cc} =
    > > 'cc_r'). Just changing the config option for the C compiler doesn't
    > > help since cc_r C flags are being passed to gcc instead of gcc flags.

    >
    > Yes, you need to change them too and there are probably other things that
    > need to be changed, too - eg ldflags, libpth, cpp, cpprun, cppstdin.


    Errr... One option that I considered and played with but got tedious
    real fast. Everyone wants the easy way, but sometimes, it ain't there.
    I was hoping though.

    > There's
    > a module on cpan called ExtUtils::FakeConfig that does the job (but probably
    > only for Win32) - it enables use of MinGW (gcc) compiler with a perl built
    > using Microsoft's Visual Studio compiler. In all, it rewrites about 30
    > Config.pm values, though in your case I would expect (without really
    > knowing) the number of required rewrites to be a little less.
    > ExtUtils::FakeConfig creates a Config file called Confg_m.pm that contains
    > the rewritten values. The original Config.pm remains untouched, and perl -V
    > reports what it has always reported in the past. If you want to use the
    > "rewritten" values, you run (eg):
    > perl -MConfig_m Makefile.PL


    This could be helpful in performing the net effect of the above.

    > Perhaps it may be of use in "showing the way" to a solution for you.
    > However, you'll need to know (or find out) what the appropriate values for
    > gcc are. If you have access to a machine that has a gcc-built perl on it,
    > then that could be very useful.


    Well, yeah, I was hoping for something along those lines. If it was
    quick. Like "Yeah, set CCFLAGS to ____ and CCLDFLAGS to _____ and
    LDFLAGS to _____ and you should be set."

    > >
    > > Wondering if anyone has worked through this before. I'm surprised to
    > > find nothing that matches this problem on Google. (Plenty of people
    > > trying to compile Perl itself using gcc, but not trying to compile C
    > > code for module support with the Perl installation on AIX that IBM
    > > created, obviously with cc_r...)
    > >

    >
    > You may well find it's simpler to build perl with gcc, rather than modify
    > the Config values. That way you automatically get the correct Config values
    > without even having to think about it.


    Another thing I worked on as well under the same premise as you
    present. Building under AIX using gcc isn't quite so straightforward
    however as articles I *did* find explained as well as from experience
    this afternoon. cc_r -q qualifiers still were being passed to gcc as
    well as other library type settings not being found. It's not simple,
    but I had this same notion.

    > If you create a module to do the job, then you should consider putting it on
    > cpan - perhaps ExtUtils::FakeConfig_AIX


    Will do. Thanks for confirming my worst fears on this effort...! :-(
    :)

    -ceo
     
    Chris, Jun 29, 2005
    #3
  4. Chris

    Sisyphus Guest

    "Chris" <> wrote in message
    news:...

    >
    > Will do. Thanks for confirming my worst fears on this effort...! :-(
    > :)
    >


    It could get worse - I neglected to mention the possibility that your
    existing libperl58.a (or whatever it happens to be) might be incompatible
    with gcc, in which case you're also confronted with the prospect of creating
    a new (compatible) libperl58.a. ExtUtils::FakeConfig performs such a feat on
    Win32. It creates a suitable import lib in the CORE folder from the
    exisiting perl58.dll (shared lib).

    Cheers,
    Rob
     
    Sisyphus, Jun 29, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. marko sarunac
    Replies:
    0
    Views:
    591
    marko sarunac
    Nov 17, 2003
  2. ClownPleco

    putenv for AIX and ifdef for AIX

    ClownPleco, Aug 22, 2007, in forum: C Programming
    Replies:
    5
    Views:
    1,169
    Thomas Dickey
    Aug 24, 2007
  3. Replies:
    5
    Views:
    214
    Philippe Lucas
    Jul 8, 2005
  4. Victor Reyes
    Replies:
    3
    Views:
    148
    Gerardo Santana Gómez Garrido
    May 3, 2008
  5. Replies:
    0
    Views:
    116
Loading...

Share This Page