I hope you're all ready for a long adventure through my frustration:
I'm using Perl 5.10, on Mac OSX : Snow Leopard, with XCode 3.2.6.
What I am trying to do is use the module JSON::XS in a program.
This is the first time that I've ever done something with Perl, so I look up some simple example programs and try them out, and they all work. Then I go to use JSON::XS. I get:
Can't locate JSON/XS.pm in @INC (@INC contains: /Library/Perl/Updates/5.10.0 /System/Library/Perl/5.10.0/darwin-thread-multi-2level /System/Library/Perl/5.10.0 /Library/Perl/5.10.0/darwin-thread-multi-2level /Library/Perl/5.10.0 /Network/Library/Perl/5.10.0/darwin-thread-multi-2level /Network/Library/Perl/5.10.0 /Network/Library/Perl /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level /System/Library/Perl/Extras/5.10.0 .) at part1.pl line 5.
BEGIN failed--compilation aborted at part1.pl line 5.
I do some Googling, and figure that it needs to be installed. Also in my Googling I find heavy recommendations to use cpanm. So I try installing cpanm first using cpan (which I already have).
I get a very long printout, that basically says NO, NOT OK, "chances to succeed are limited", and FAILED over and over and over again. It's too long to include in its entirety, but the bits I found interesting are:
Warning (usually harmless): 'YAML' not installed, will not store persistent state
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Could not read '/Users/danielgierl/.cpan/build/ExtUtils-ParseXS-3.15-VSmBrZ/META.yml'. Falling back to other methods to determine prerequisites
I look into installing YAMl, because sections of output like the above (which I got repeatedly) make me think that's the problem. Essentially it also failed, and among other reasons it gave me warnings like the above.
Another section of the output says:
make: *** No rule to make target `/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE/config.h', needed by `Makefile'. Stop.
I look this up online, and though I understand why it says what it does, I see no way that I could fix this, since these are Makefiles gotten from cpan or elsewhere.
Another section:
Running install for module 'version'
Running make for J/JP/JPEACOCK/version-0.9901.tar.gz
Has already been unwrapped into directory /Users/danielgierl/.cpan/build/version-0.9901-U8IMPt
Could not make: Unknown error
Warning (usually harmless): 'YAML' not installed, will not store persistent state
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
In general lots of unknown errors. I am also trouble by the section where it tells me:
Testing if you have a C compiler
ld: library not found for -lbundle1.o
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/1C/1CnzBuv+F5y+8M5YPm6I4k+++TI/-Tmp-//ccTWRqov.out (No such file or directory)
error building /var/folders/1C/1CnzBuv+F5y+8M5YPm6I4k+++TI/-Tmp-/compilet.bundle from /var/folders/1C/1CnzBuv+F5y+8M5YPm6I4k+++TI/-Tmp-/compilet.o at /System/Library/Perl/5.10.0/ExtUtils/CBuilder/Base.pm line 213.
I cannot determine if you have a C compiler
so I will install a perl-only implementation
You can force installation of the XS version with
perl Makefile.PL --xs
I know for a fact that I have a c compiler, since gcc -v tells me that it is version 4.2.1. On the plus side, it does tell me that my kit looks good (whatever that is). If I try running the command they recommend me, I get told that there is no such file or directory.
After some more Googling, I keep seeing XCode re-re-referenced for Mac users. I already had a version of XCode, but because it might have problems, I uninstall it, then get version 3.2.6 (my OS is too old for the newer versions). The install fails for unknown reasons, and it tells me to contact the software company. However, before it fails, it does install the UNIX tools, including gcc (which I later got the latest version for), so I don't think that's the problem.
All in all, this has consumed some 6 hours of my time today, and I'm stressed and physically ill (though I was this morning before starting this futile venture, but it's been exacerbated), and I have no idea where I am supposed to go next.
I'm hoping that it's all been some stupid error that'll be remedied in 10 seconds by an experienced user, but I fear the worst. In general I've done every bit of advice I've found, from running with --sudo to sacrificing a goat to the sun gods. I'd appreciate any help.
You are best off leaving the system's perl
alone. Instead, use perlbrew to install your own perl
s.
You can install cpanm without using cpan
using
curl -L http://cpanmin.us | perl - App::cpanminus
for your local perl
.
In addition, you might have to install the command line tools for XCode.
If you can't, you may want to look into installing build tools from MacPorts and putting those in your path ahead of the system paths, but after your local perl
because you don't necessarily want to mess with a perl
that MacPorts might install either.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With