3

How do I get Perl MakeMaker to change the default value for CFLAGS that it inserts into Makefiles? Based on this post, I tried this:

export CFLAGS=...

then inside cpan, I confirmed it with

! print $ENV{CFLAGS}

but it still uses whatever CFLAGS Perl was built with.

I looked in lib/perl/.../Config.pm as suggested by this post but CFLAGS doesn't appear to be set there.

I have a related question that got answered: How to tell CPAN about path to make and cc

I made a little headway in CPAN/Config.pm

'makepl_arg' => q[ CCFLAGS="-D_REENTRANT -O2 -m32  -I/opt/csw/bdb48/include -I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -m32 -DVERSION=\"1.616\" -DXS_VERSION=\"1.616\" -fPIC -I/opt/csw/lib/perl/5.10.1/CORE"],

but this only appends the value to whatever was already in CFLAGS, which gcc doesn't understand (like "-x03" and "-KPIC").

Community
  • 1
  • 1
Lawrence I. Siden
  • 9,191
  • 10
  • 43
  • 56
  • I made a little more headway this morning. The file I was looking for is actually .../lib/perl/Config_heavy.pm But updating Perl will overwrite this file so I'll have to post it back to my distro, opencsw.org with a request for them to integrate the correct settings. I'm also trying to use cpanplus to see if that will overwrite the CFLAGS instead of just appending to them, but I'm still waiting for it to rebuild the module tree since I've never used it before. – Lawrence I. Siden Jan 06 '12 at 08:27

1 Answers1

0

I have successfully modified /opt/csw/lib/perl/5.10.1/Config_heavy.pl so that MakeMaker can generate Makefiles that will work on a solaris system under OpenCSW.

Others who are having similar problems may download it here: https://gist.github.com/1569718

I have also posted this back to maintainers at opencsw.org so that they will hopefully update the OpenCSW release of Perl. I noted in my post that the right way to do this is to rebuild Perl entirely with tools belonging to the OpenCSW distro, because I believe that this file gets generated automatically by other scripts when any given Perl distro is built (although I haven't verified how it actually gets built). This patched file is merely an expedient so that I could get my work done, which is under a deadline.

I would have greatly preferred to accomplish my goal by modifying settings in CPAN/Config.pm. This worked for setting the correct paths to gcc and gmake, but not for changing the command-line flags to gcc, because CPAN would append these flags to the previously set argument string. gcc would quit after encountering those flags, some of which were incompatible (e.g. "-xO3" and "-KPIC").

For the record, CSWperl 5.10.1,REV=2011.01.15 is the current release of Perl from CSW that I have installed from OpenCSW.

Hope this may help someone else.

Lawrence I. Siden
  • 9,191
  • 10
  • 43
  • 56
  • Please not that the file in gist referenced above was mis-named with a .pm expension. It should have be named .pl. Perl will not look for a file named Config_heavy.pm – Lawrence I. Siden Nov 21 '12 at 19:30