Compiling perl XS module on Mac OSX

Ryan Gerry <[email protected]>
Newsgroups gmane.comp.web.html-tidy.devel
Message-ID <[email protected]>
Charles Reitzel's Perl XS module 
(http://users.rcn.com/creitzel/tidy.html#tidyperl) compiles nicely on 
Windows and Linux.  It would be great it it would also compile on Mac OS 
X (I am using 10.3).

I have the latest versions of libtidy and Charles Reitzel's XS Perl 
module.  libtidy compiled well and is working fine using Andy Lester's 
RANDLIB instructions.  Here is what I have done and my results.

On my system the path's are as follows.
1) perl Makefile.PL.unix TIDYINCPATH=/usr/local/include/tidy 
TIDYLIBPATH=/usr/local/lib

2) I edit the Makefile and change this line:
CC = cc
to
CC = g++

I have added -lstdc++ to the end of the LDDLFLAGS as suggested here 
(http://sourceforge.net/mailarchive/message.php?msg_id=5607682), but it 
does not seem to make a difference.

3) I run make which finishes but gives me these warnings:

cp Tidy.pm blib/lib/HTML/Tidy.pm
g++ -c  -I/usr/local/include/tidy -g -pipe -pipe -fno-common 
-DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include 
-Os   -DVERSION=\"0.1\" -DXS_VERSION=\"0.1\" 
"-I/System/Library/Perl/5.8.1/darwin-thread-multi-2level/CORE" 
tidyperl.cpp
In file included from tidyperl.cpp:552:
tidyx.h: In constructor `Tidy::Source::Source()':
tidyx.h:83: warning: invalid conversion from `int (*)(unsigned int)' to 
`int
    (*)(long unsigned int)'
tidyx.h:84: warning: invalid conversion from `void (*)(unsigned int, 
unsigned
    char)' to `void (*)(long unsigned int, unsigned char)'
tidyx.h:85: warning: invalid conversion from `Bool (*)(unsigned int)' to 
`Bool
    (*)(long unsigned int)'
tidyx.h: In constructor `Tidy::Sink::Sink()':
tidyx.h:123: warning: invalid conversion from `void (*)(unsigned int, 
unsigned
    char)' to `void (*)(long unsigned int, unsigned char)'
tidyx.h: In member function `void Tidy::Buffer::Attach(void*, unsigned 
int)':
tidyx.h:165: warning: invalid conversion from `void*' to `byte*'
Running Mkbootstrap for HTML::Tidy ()
chmod 644 Tidy.bs
rm -f blib/arch/auto/HTML/Tidy/Tidy.bundle
LD_RUN_PATH="" MACOSX_DEPLOYMENT_TARGET=10.3 cc  -bundle -undefined 
dynamic_lookup -L/usr/local/lib -lstdc++ tidyperl.o  -o 
blib/arch/auto/HTML/Tidy/Tidy.bundle /usr/local/lib/libtidy.a 
-L/usr/local/lib -ltidy
chmod 755 blib/arch/auto/HTML/Tidy/Tidy.bundle
cp Tidy.bs blib/arch/auto/HTML/Tidy/Tidy.bs
chmod 644 blib/arch/auto/HTML/Tidy/Tidy.bs

4) I run make test which fails with these results:

PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" 
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/basic....dyld: /usr/bin/perl Undefined symbols:
/Users/ryan/build/tidyperl/blib/arch/auto/HTML/Tidy/Tidy.bundle 
undefined reference to __ZTVN10__cxxabiv117__class_type_infoE expected 
to be defined in a dynamic image
/Users/ryan/build/tidyperl/blib/arch/auto/HTML/Tidy/Tidy.bundle 
undefined reference to __ZTVN10__cxxabiv120__si_class_type_infoE 
expected to be defined in a dynamic image
/Users/ryan/build/tidyperl/blib/arch/auto/HTML/Tidy/Tidy.bundle 
undefined reference to __ZTVN10__cxxabiv121__vmi_class_type_infoE 
expected to be defined in a dynamic image
/Users/ryan/build/tidyperl/blib/arch/auto/HTML/Tidy/Tidy.bundle 
undefined reference to __ZdlPv expected to be defined in a dynamic image
/Users/ryan/build/tidyperl/blib/arch/auto/HTML/Tidy/Tidy.bundle 
undefined reference to __Znwm expected to be defined in a dynamic image
/Users/ryan/build/tidyperl/blib/arch/auto/HTML/Tidy/Tidy.bundle 
undefined reference to ___cxa_pure_virtual expected to be defined in a 
dynamic image
/Users/ryan/build/tidyperl/a dynamic image
t/basic....dubious

[ dump.t and opt.t fail with the same messages ]

5) When I have run make install and then tried something like this:
$ perl -MHTML::Tidy
I get the same errors as the test.


Final Info:
Perl Version: 5.8.1
GCC Version: 3.3 20030304
I also have trouble with libtool when compiling older version of libtidy.

Any assistance would be much apprecited!



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.