I compiled Perl 5.10.1 under OS X 10.5. It was compiled as a 32-bit program. I have since upgraded to OS X 10.6. My version of Perl 5.10.1 continues to work fine, but I just tried to compile JSON::XS and got errors like the following:

Since this is most likely the culprit, I want to try compiling the module as 32-bit. I assume there is some environment variable (like CCFLAGS) I can set to force it to compile as a 32-bit library instead of a 64-bit library.

The alternative seems to be to recompile Perl and all of my modules (something I am not sure I want to do).

I think the problem is that you are compiling it with a different compiler than the one you used to compile Perl with.
–
user181548Nov 4 '09 at 15:19

Hmm, an upgraded version of GCC could be the problem, but the fact that it is producing a 64-bit version of the library is definitely a problem (32-bit programs can't load 64-bit libraries).
–
Chas. OwensNov 4 '09 at 16:10

2 Answers
2

If your Perl is installed in /usr/perl/v5.10.1, then try looking in the file /usr/perl/v5.10.1/lib/5.10.1/darwin-2level/Config.pm. There should be an entry for 'cc' in it; carefully (take a backup copy first) modify that from 'cc' to 'cc -m32'. Try rebuilding JSON::XS. What this does is change Perl's view of its configuration, and the 'cc -m32' enforces a 32-bit build.