title: Installing XML::Parser requires expat.h
body: <p>I'm working on a project that requires all third-party (read: CPAN) perl modules to be installed in a perforce repository, so that any code that depends on them can be successfully run without anyone else needing to manually install them.  I ran into an issue though when trying to install XML::Parser.  I use cpanminus to install my CPAN modules, so I ran <code>cpanm -L . XML::Parser</code> in the desired directory (this has worked before with other modules) and got the error:</p>
  
  <pre><code>Expat.xs:12:19: error: expat.h: No such file or directory
  </code></pre>
  
  <p>I'm used to using Ubuntu and apt-get, but at work I have to use RedHat and I'm not sure how to install expat to a local directory.  I ran <code>yum search expat</code> and got</p>
  
  <pre><code>expat.i386 : A library for parsing XML.
  expat.x86_64 : A library for parsing XML.
  </code></pre>
  
  <p>So I tried <code>yum install --installroot=. expat.i386</code> and got the following errors:</p>
  
  <pre><code>Loaded plugins: rhnplugin, security
  error: cannot open Packages index using db3 - No such file or directory (2)
  error: cannot open Packages database in ./var/lib/rpm
  Traceback (most recent call last):
    File "/usr/bin/yum", line 29, in ?
      yummain.user_main(sys.argv[1:], exit_code=True)
    File "/usr/share/yum-cli/yummain.py", line 309, in user_main
      errcode = main(args)
    File "/usr/share/yum-cli/yummain.py", line 157, in main
      base.getOptionsConfig(args)
    File "/usr/share/yum-cli/cli.py", line 187, in getOptionsConfig
      self.conf
    File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 665, in &lt;lambda&gt;
      conf = property(fget=lambda self: self._getConfig(),
    File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 240, in _getConfig
      self._conf = config.readMainConfig(startupconf)
    File "/usr/lib/python2.4/site-packages/yum/config.py", line 804, in readMainConfig
      yumvars['releasever'] = _getsysver(startupconf.installroot, startupconf.distroverpkg)
    File "/usr/lib/python2.4/site-packages/yum/config.py", line 877, in _getsysver
      idx = ts.dbMatch('provides', distroverpkg)
  TypeError: rpmdb open failed
  </code></pre>
  
  <p>What am I doing wrong?  Also, once I do get expat installed, I'm not sure how I would tell cpanm where to find it.</p>