I've gotten my xs to compile with g++. But when I test I get something bad.
Here's my Makefile.PL:
use ExtUtils::MakeMaker;
$PLATFORM = `uname`;
$CC = 'g++';
WriteMakefile(
'NAME' => 'Laff'
,'PREFIX' => './'
,'PREREQ_PM' => {}
,'VERSION_FROM' => 'Laff.pm'
,ABSTRACT => 'perl extention of C++ Laff routines written by Billy Patton'
,'LIBS' => [ '-L/data/cdmg/dev/cdmg_toolbox/Laff/'.${PLATFORM}.' -lcdmg_laff'
, '-L/data/cdmg/dev/cdmg_toolbox/libcdmg/'.${PLATFORM}.' -lcdmg'
, '-L/data/cdmg/dev/cdmg_toolbox/pcre-5.0/'.${PLATFORM}.' -lpcre'
, ' -lm '
]
,'OPTIMIZE' => '-g3 -O2'
,'DISTNAME' => 'LaffPerl'
,'INSTALLDIRS' => 'perl'
,'INC' => "-I/data/cdmg/dev/cdmg_toolbox/Laff -I/data/cdmg/dev/cdmg_toolbox/libcdmg -I/data/cdmg/dev/cdmg_toolbox/pcre-5.0"
,'XSOPT' => '-C++'
,'CC' => ${CC}
,'LD' => ${CC}
,'TYPEMAPS' => ['typemap' ]
);
Here's my compilation :
[EMAIL PROTECTED] LaffPerl]$ make
g++ -c -I/data/cdmg/dev/cdmg_toolbox/Laff -I/data/cdmg/dev/cdmg_toolbox/libcdmg -I/data/cdmg/dev/cdmg_toolbox/pcre-5.0 -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -g3 -O2 -DVERSION=\"2.00\" -DXS_VERSION=\"2.00\" -fpic "-I/apps/perl/5.8.0/lib/5.8.0/i686-linux-thread-multi/CORE" Laff.c
Running Mkbootstrap for Laff ()
chmod 644 Laff.bs
rm -f blib/arch/auto/Laff/Laff.so
LD_RUN_PATH="/data/cdmg/dev/cdmg_toolbox/Laff/Linux:/data/cdmg/dev/cdmg_toolbox/libcdmg/Linux:/data/cdmg/dev/cdmg_toolbox/pcre-5.0/Linux:/usr/lib" g++ -shared -L/usr/lib -L/lib Laff.o -o blib/arch/auto/Laff/Laff.so -L/data/cdmg/dev/cdmg_toolbox/Laff/Linux -lcdmg_laff -L/data/cdmg/dev/cdmg_toolbox/libcdmg/Linux -lcdmg -L/data/cdmg/dev/cdmg_toolbox/pcre-5.0/Linux -lpcre -lm
chmod 755 blib/arch/auto/Laff/Laff.so
cp Laff.bs blib/arch/auto/Laff/Laff.bs
chmod 644 blib/arch/auto/Laff/Laff.bs
Manifying blib/man3/Laff.3
Here's the test.
[EMAIL PROTECTED] LaffPerl]$ make test
PERL_DL_NONLAZY=1 /apps/perl/5.8.0/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/CaseSensitive...............Can't load '/data/cdmg/dev/cdmg_toolbox/Laff/LaffPerl/blib/arch/auto/Laff/Laff.so' for module Laff: /data/cdmg/dev/cdmg_toolbox/Laff/LaffPerl/blib/arch/auto/Laff/Laff.so: undefined symbol: _ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_ at /apps/perl/5.8.0/lib/5.8.0/i686-linux-thread-multi/DynaLoader.pm line 229.
at t/CaseSensitive.t line 7
Compilation failed in require at t/CaseSensitive.t line 7.
BEGIN failed--compilation aborted at t/CaseSensitive.t line 7.
t/CaseSensitive...............dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 1-2
Failed 2/2 tests, 0.00% okay
Is it not picking uo the libstdc++ ?
I thought using g++ for the LD would pick up all c++ libs.
THe tree_insert_and_rebalance is probably from <map> used in a HashTable.h
Included from Ui.h
I previously had a hash table written in c but did not want to change that many calls to use a map directly so I created the HashTable wrapper for the map stl.
THere is no HashTable.cxx just a headder.
Here's the top of my xs: #ifdef __cplusplus extern "C" { #endif #include <stdio.h> #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #ifdef __cplusplus } #endif
#include "Ui.h" #include "ExCommand.h" #include "my_string.h" #include "Laff.h" #include "xyArray.h" using namespace std;
typedef node_t * Laff__Node; typedef cell_t * Laff__Cell; typedef laff_db * Laff;
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/ Texas Instruments ASIC Circuit Design Methodology Group
Dallas, Texas, 214-480-4455, [EMAIL PROTECTED]