ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Perl lib bug on snow leopard
Posted by Julien on Sep-01-2010 16:42
I'm trying to use ChartDirector/Perl on MacOS X Snow Leopard but it bugs like this

$ /opt/local/share/examples/perlchartdir/binaryseries.pl
Can't load '/opt/local/lib/perl5/vendor_perl/5.8.9/perlchartdir58i64.dylib' for module perlchartdir58i64: dlopen(/opt/local/lib/perl5/vendor_perl/5.8.9/perlchartdir58i64.dylib, 1): no suitable image found.  Did find:
/opt/local/lib/perl5/vendor_perl/5.8.9/perlchartdir58i64.dylib: no matching architecture in universal wrapper at /opt/local/lib/perl5/5.8.9/darwin-2level/DynaLoader.pm line 230.
at /opt/local/lib/perl5/vendor_perl/5.8.9/perlchartdir.pm line 9
...propagated at /opt/local/lib/perl5/vendor_perl/5.8.9/perlchartdir.pm line 20.
Compilation failed in require at /opt/local/share/examples/perlchartdir/binaryseries.pl line 3.
BEGIN failed--compilation aborted at /opt/local/share/examples/perlchartdir/binaryseries.pl line 3.

similar to
http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&thread=1251843372

I'm using latest release 5.0.2 in macports

$ perl -V
Summary of my perl5 (revision 5 version 8 subversion 9) configuration:
  Platform:
    osname=darwin, osvers=10.4.0, archname=darwin-2level
    uname='darwin nadesico.local 10.4.0 darwin kernel version 10.4.0: fri apr 23 18:28:53 pdt 2010; root:xnu-1504.7.4~1release_i386 i386 '
    config_args='-des -D prefix=/opt/local -D scriptdir=/opt/local/bin -D cppflags=-I/opt/local/include -D ccflags=-O2 -arch x86_64 -arch i386 -D ldflags=-L/opt/local/lib -arch x86_64 -arch i386 -D vendorprefix=/opt/local -D man1ext=1pm -D man3ext=3pm -D cc=/usr/bin/gcc-4.2 -D ld=/usr/bin/gcc-4.2 -D man1dir=/opt/local/share/man/man1p -D man3dir=/opt/local/share/man/man3p -D siteman1dir=/opt/local/share/man/man1 -D siteman3dir=/opt/local/share/man/man3 -D vendorman1dir=/opt/local/share/man/man1 -D vendorman3dir=/opt/local/share/man/man3 -D inc_version_list=5.8.8 5.8.8/darwin-2level -U i_bind -U i_gdbm -U i_db'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=define uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='/usr/bin/gcc-4.2', ccflags ='-O2 -arch x86_64 -arch i386 -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include -I/opt/local/include',
    optimize='-O3',
    cppflags='-I/opt/local/include -no-cpp-precomp -O2 -arch x86_64 -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='4.2.1 (Apple Inc. build 5664)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 /usr/bin/gcc-4.2', ldflags ='-L/opt/local/lib -arch x86_64 -arch i386 -L/usr/local/lib'
    libpth=/usr/local/lib /opt/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-L/opt/local/lib -arch x86_64 -arch i386 -bundle -undefined dynamic_lookup -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT
                        USE_FAST_STDIO USE_LARGE_FILES USE_PERLIO
  Built under darwin
  Compiled at Aug 27 2010 13:48:39
@INC:
    /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level
    /opt/local/lib/perl5/site_perl/5.8.9
    /opt/local/lib/perl5/site_perl
    /opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level
    /opt/local/lib/perl5/vendor_perl/5.8.9
    /opt/local/lib/perl5/vendor_perl
    /opt/local/lib/perl5/5.8.9/darwin-2level
    /opt/local/lib/perl5/5.8.9

  Re: Perl lib bug on snow leopard
Posted by Peter Kwan on Sep-02-2010 01:14
Hi Julien,

There are hundreds of ways to configure/compile Perl, and the Perls compiled are all incompatible. The issue is even more pronouced in Mac OS X due to universal binary.

On Mac OS X, currently we only support the Perls that comes with Mac OS X, or any binary compatible Perls. As far as I know, Apple only distribute 64-bit Perl for Perl 5.10, so currently ChartDirector only supports 64-bit Perl for Perl 5.10. For Perl 5.8, there is only 32-bit support.

For your case, the Perl 5.8 seems to be 64-bit single threaded with no multiplicity support. Is this perl from Apple, or is this compiled yourself?

(My impression is that the Perl 5.8 from Apple is 32-bit multi-threaded with multiplicity support. The Perl 5.10 from Apple is 32/64-bit multi-threaded with multiplicity support. Changing the 32-bit/64-bit mode, multi-threaded mode, multiplicity support, as well as several other configuration options, will create Perls that are binary incompatible with each others.)

Regards
Peter Kwan

  Re: Perl lib bug on snow leopard
Posted by Julien on Sep-02-2010 15:30
Thanks for the feedback Peter.

I'm using perl from macports (www.macports.org). If possible, I would invite you to support it as it is used by a lot of people, most notably dev/admin and other "power users" :-)

I test with perl from Apple and it works ok.

I will ask on macports to see if default perl config could add multiplicity and threads as default (but what are the configure parameter) to try to have better compatibility but not sure if it will help.

  Re: Perl lib bug on snow leopard
Posted by Peter Kwan on Sep-02-2010 23:06
Hi Julien,

As according to the "perl -V" provided in your previous message, the Perl you are using is Perl 5.8.9, configured using the following flags:


-des -D prefix=/opt/local -D scriptdir=/opt/local/bin -D cppflags=-I/opt/local/include -D ccflags=-O2 -arch x86_64 -arch i386 -D ldflags=-L/opt/local/lib -arch x86_64 -arch i386 -D vendorprefix=/opt/local -D man1ext=1pm -D man3ext=3pm -D cc=/usr/bin/gcc-4.2 -D ld=/usr/bin/gcc-4.2 -D man1dir=/opt/local/share/man/man1p -D man3dir=/opt/local/share/man/man3p -D siteman1dir=/opt/local/share/man/man1 -D siteman3dir=/opt/local/share/man/man3 -D vendorman1dir=/opt/local/share/man/man1 -D vendorman3dir=/opt/local/share/man/man3 -D inc_version_list=5.8.8 5.8.8/darwin-2level -U i_bind -U i_gdbm -U i_db


After studying the flags in detail, I speculate that you may be able to run ChartDirector with that Perl using:

arch -i386 perl simplebar.pl

or

arch -i386 /usr/bin/perl simplebar.pl

(Note: change the /usr/bin/perl path above to the real path that the Perl is located)

Alternatively, you can "thin" your Perl using lipo to keep the i386 architecture. After that, it should be able to run ChartDirector directly with using "arch".


I also speculate that should your Perl is 5.10.x, it will be compatible with ChartDirector and can run ChartDirector directly. So I hope this problem will resolve when macports upgrade is Perl to 5.10.x. (FYI, the Apple official perl is Snow Leopard is 5.10.x.)


In any case, I think it is a good idea that the Perl be configured in such a way that is compatible with the official perl from Apple. In this way, the macport Perl can run any Perl extension compiled for Mac OS X.

For Apple, for Perl 5.8.x, the key options that are enabled are multi-threading, multiplicity, and i386/ppc. For Perl 5.10 (which is the Perl in Snow Leopard), the key options are multi-threading, multiplicity, and i386/x86_64/ppc/ppc7400.

As the macport Perl is current of 5.8.x, to maintain binary compatibility with the Perl from Apple, you may try to:

(a) Remove the "-arch x86_64"

(b) Add "-Duseithreads"


Hope this can help.

Regards
Peter Kwan