2006-09-05 Perl Installation

Argh. I’m too stupid. I have Mac OS 10.4 on my desktop, and a working Perl installation mess on my Laptop. The mess is that there’s the Perl Apple shipped, and there’s the DarwinPorts Perl in _opt_local.

DarwinPorts

Anyway, I install all my modules using CPAN, and it works for me. So I’m trying to `cpan XML::Parser` but that requires the expat library. which OSX is lacking. So I use `port install expat` and now I have a `libexpat.a` in `/opt/local/lib`. You know where this is going, right?

So the OSX gcc still doesn’t know about expat:

gcc -lexpat
/usr/bin/ld: can't locate file for: -lexpat
collect2: ld returned 1 exit status

I should use -L to add the directory to the search path. But do I do that so that the CPAN shell will pick it up? It must be some kind of environment variable, and I cannot figure it out.

It’s not a real problem. I can develop on my laptop. But I’d love to *understand*!! Grrr. This most boring of all problems is wasting hours of my time.

The strange thing is that on my laptop, this problem is not solved either. `gcc -lexpat` reports the same error. And yet I can “use XML::Parse" in my Perl programs. My guess is that I have a total parallel installation of Perl: `which perl` → `/opt/local/bin/perl`. And somehow that Perl knows about the right directories.

We hatesss it, my preciousss!!

​#Software ​#Perl

Comments

(Please contact me if you want to remove your comment.)

Maybe try to add that directory somewhere around `ld.so.conf` or `ld.so.conf.d` and run ldconf as root after that. Helps on Linux.

– RadomirDopieralski 2006-09-05 23:32 UTC

RadomirDopieralski

---

Good idea. This being OSX, however, I am out of luck. I can’t find it. Probably some XML file somewhere in `/System/Library/*/*.plist` or something like that.

– Alex Schroeder 2006-09-05 23:42 UTC

Alex Schroeder

---

Setting environment variables like LD_PATH and such helps too...

– RadomirDopieralski 2006-09-06 01:08 UTC

RadomirDopieralski

---

Years have passed, and suddenly I feel the urge to install XML::RSS on my Mac OS 10.4 again – which requires XML::Parser – which still won’t compile. Searching my own blog, I find that I wasn’t able to solve the problem ages ago. Noooo!

– Alex Schroeder 2008-07-15 08:56 UTC

Alex Schroeder