Fixing CPAN Perl Module Installation Issues on OpenSolaris

In OpenSolaris, if you're installing perl modules via CPAN, you might run into this error:

cc: unrecognized option `-KPIC'
cc: language ildoff not recognized
cc: ReadKey.c: linker input file unused because linking not done

In order to fix that, edit the file /usr/perl5/5.8.4/lib/i86pc-solaris-64int/Config.pm, and make the following changes to the existing lines for 'optimize' and 'cccldflags':
UPDATE! Thanks to reader Vesta for his tip. The original tip I posted will not fix all the issues, for example Apache2::Util won't install.

This problem occurs because the Sun developers build perl with the cc from SunStudio, but by default, the first 'cc' found in a user's path is a symlink to gcc. All you need to do is to install SunStudio, and prefer it's cc:

pfexec pkg install ss-dev

Now, edit ~/.profile, and prepend your path with SunStudio's bin directory, like so:

export PATH=/opt/SunStudioExpress/bin/:/usr/gnu/bin:/usr/bin:/usr/X11/bin:/usr/sbin:/sbin

You can log out, reboot, source the new .profile, or export a new PATH variable to make the new settings stick. Now you should be able to install most any Perl module!

Your rating: None Average: 5 (1 vote)

Comments

Another method

Hello,

thank you for these hint, we had the Problem in the same night...

I've posted in the opensolaris Forum and get these resolution:
delete these link:
/usr/gnu/bin/cc -> ../../sfw/bin/gcc
and set it to the sun Compiler:
pfexec ln -s /opt/SunStudioExpress/bin/cc /usr/gnu/bin/cc

And it works without changing the options.

Here my discussion:
http://www.opensolaris.org/jive/thread.jspa?threadID=106061

Thanks!

Thanks for the tip! Your method actually works a little better, but I've come up with a less intrusive way of using the SunStudio 'cc' - see the updated article.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <param> <strike> <caption>
  • Lines and paragraphs break automatically.

More information about formatting options