Compiling Perl modules on AIX using gcc instead of cc_r?

C

Chris

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
 
S

Sisyphus

Chris said:
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
 
C

Chris

Sisyphus said:
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."
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
 
S

Sisyphus

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top