I looked at the way I was building my application and I rearranged the
command-line so that order is exactly reverse to what it was before (I
wasn't sure if the libraries included 1st or last take the precedence).
Perl was also using its own "malloc". I re-built perl so that it now uses
system's malloc instead of its own. The problem is still there.

I'd really appreciate if someone could give me some pointers to rectify
this problem. Thanks a lot.


Here's how I used to make the application before Perl (in the Makefile):


all: dispatcher

dispatcher: dispatcher.o mqseries.o log.o
 cc -o dispatcher dispatcher.o mqseries.o log.o -Llib -lmqm

dispatcher.o: dispatcher.c mqseries.h bool.h log.h
 cc -c dispatcher.c

mqseries.o: mqseries.h mqseries.c bool.h
 cc -c -Iinclude mqseries.c

log.o: log.h log.c bool.h
 cc -c log.c


Here are the contents of the lib/ and include/ directories:


> Mon Jun  7, 12:40:57 $ ls include/
cmqc.h
> Mon Jun  7, 12:40:59 $ ls lib/
libmqm.a


Here's how I build it with perl:


all: dispatcher

dispatcher: dispatcher.o mqseries.o log.o
          cc -o dispatcher dispatcher.o mqseries.o log.o -Llib -lmqm `perl
-MExtUtils::Embed -e ldopts`

dispatcher.o: dispatcher.c mqseries.h bool.h log.h
          cc -c dispatcher.c `perl -MExtUtils::Embed -e ccopts`

mqseries.o: mqseries.h mqseries.c bool.h
          cc -c -Iinclude mqseries.c

log.o: log.h log.c bool.h
          cc -c log.c


Here's the output from "perl -MExtUtils::Embed -e ccopts":


   -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1 -qnoansialias
-DUSE_NATIVE_DLOPEN -I/usr/local/include -q32 -D_LARGE_FILES -qlonglong
-I/usr/local/lib/perl5/5.8.4/aix/CORE


Here's the output from "perl -MExtUtils::Embed -e ldopts":


    -bE:/usr/local/lib/perl5/5.8.4/aix/CORE/perl.exp  -brtl -L/usr/local/lib
-b32 /usr/local/lib/perl5/5.8.4/aix/auto/DynaLoader/DynaLoader.a
-L/usr/local/lib/perl5/5.8.4/aix/CORE -lperl -lbind -lnsl -ldl -lld -lm
-lcrypt -lc -lbsd


And finally here's the output from perl -V (after re-building it without
malloc):


Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
    Platform:
      osname=aix, osvers=4.3.3.0, archname=aix
      uname='aix hdndev 3 4 000195334c00 '
      config_args=''
      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=undef use64bitall=undef uselongdouble=undef
      usemymalloc=n, bincompat5005=undef
    Compiler:
      cc='cc', ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-qmaxmem=-1 -qnoansialias -DUSE_NATIVE_DLOPEN -I/usr/local/include -q32
-D_LARGE_FILES -qlonglong',
      optimize=' ',
      cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1
-qnoansialias -DUSE_NATIVE_DLOPEN -I/usr/local/include'
      ccversion='3.6.6.0', gccversion='', gccosandvers=''
      intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
      d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
      ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
      alignbytes=8, prototype=define
    Linker and Libraries:
      ld='ld', ldflags =' -brtl -L/usr/local/lib -b32'
      libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
      libs=-lbind -lnsl -ldbm -ldl -lld -lm -lcrypt -lc -lbsd
      perllibs=-lbind -lnsl -ldl -lld -lm -lcrypt -lc -lbsd
      libc=/lib/libc.a, so=a, useshrplib=false, libperl=libperl.a
      gnulibc_version=''
    Dynamic Linking:
      dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='
-bE:/usr/local/lib/perl5/5.8.4/aix/CORE/perl.exp'
      cccdlflags=' ', lddlflags=' -bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp
-bE:$(BASEEXT).exp -bnoentry -lc -L/usr/local/lib'


Characteristics of this binary (from libperl):
    Compile-time options: USE_LARGE_FILES
    Built under aix
    Compiled at Jun  7 2004 09:59:53
    @INC:
      /usr/local/lib/perl5/5.8.4/aix
      /usr/local/lib/perl5/5.8.4
      /usr/local/lib/perl5/site_perl/5.8.4/aix
      /usr/local/lib/perl5/site_perl/5.8.4
      /usr/local/lib/perl5/site_perl
      /usr/local/lib/perl5/site_perl/5.005/aix
      /usr/local/lib/perl5/site_perl/5.005
      .


Thanks,
Salman

On Fri, 04 Jun 2004 14:17:56 +0100, Nick Ing-Simmons
<[EMAIL PROTECTED]> wrote:

> Salman Mohsin <[EMAIL PROTECTED]> writes:
>>
>> That's where the problem started. When I changed my code,
>> compiled/linked
>> it, and then tried to run it, it core dumped at MQCONN(). Somehow even
>> if you don't have any Perl related code embedded in your code but still
>> you
>> linked it with embedded perl, it'd core dump at the 1st MQSeries call.
>> I'm compiling & linking by adding (as appropriately suggested by
>> "perlembed") `perl -MExtUtils::Embed -e ccopts` and `perl
>> -MExtUtils::Embed -e ldopts` to my existing compiler and linker
>> commands respectively. This also makes sure that I'm
>> incorporating/linking Perl into my code exactly the way
>> actual Perl executable has been built on our system.
>>
>> Has anyone else seen this problem of perl and MQSeries??
>
> I don't even know what MQSeries is but here is my ?0.02 anyway.
>
> 1. It is possible that ccopts has provied some -D flags that change
>    things. In paticular things like:
>    -D_LARGEFILE_SOURCE can mean that structs get an "off_t" that is now
>    64-bit and mis-match with libraries expectation of 32-bit.
>
> 2. Most likely though is that ldopts has added something like -lpthreads
>    or some network library which behaves differently.
>
> 3. Even if libaries are okay together the _order_ of libraries
>    on final LD line can be vital.
>
> 4. ldopts often adds -L/usr/local/lib. It is not unknown for
> /usr/local/lib
>    to be full of junk.
>
> Given 2..4 it would be helpful to see what your ldopts are, and
> the before/after adding ldopts.
-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/



"Nick Ing-Simmons" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Salman Mohsin <[EMAIL PROTECTED]> writes:
>
>That's where the problem started. When I changed my code, compiled/linked
>it, and then tried to run it, it core dumped at MQCONN(). Somehow even if
>you don't have any Perl related code embedded in your code but still you
>linked it with embedded perl, it'd core dump at the 1st MQSeries call. I'm
>compiling & linking by adding (as appropriately suggested by "perlembed")
>`perl -MExtUtils::Embed -e ccopts` and `perl -MExtUtils::Embed -e ldopts`
>to my existing compiler and linker commands respectively. This also makes
>sure that I'm incorporating/linking Perl into my code exactly the way
>actual Perl executable has been built on our system.
>
>Has anyone else seen this problem of perl and MQSeries??

I don't even know what MQSeries is but here is my ?0.02 anyway.

1. It is possible that ccopts has provied some -D flags that change
   things. In paticular things like:
   -D_LARGEFILE_SOURCE can mean that structs get an "off_t" that is now
   64-bit and mis-match with libraries expectation of 32-bit.

2. Most likely though is that ldopts has added something like -lpthreads
   or some network library which behaves differently.

3. Even if libaries are okay together the _order_ of libraries
   on final LD line can be vital.

4. ldopts often adds -L/usr/local/lib. It is not unknown for /usr/local/lib
   to be full of junk.

Given 2..4 it would be helpful to see what your ldopts are, and
the before/after adding ldopts.


>Can someone shed
>some light on it? Is there someone who's been successful in getting
>MQSeries and embedded perl work??
>
>I'm kinda lost here and if I'm not able to get this resolved, I'd have to
>(horrors!) try the whole thing in C (which anyone won't really want,
>especially when having already done that so easily in Perl).
>
>Any help would be greatly appreciated.
>
>Thanks,
>Salman


Reply via email to