posix_mq : Problem installing on HPUX

T

Tadeusz Bochan

Hello,

I'm trying to gem install posix_mq on :
HP-UX tiths303 B.11.11 U 9000/800 4162012158 unlimited-user license
ruby 1.8.6 (2007-09-24 patchlevel 111)

I am not in any way C-literate and generally try to muddle through as
best I can. (read: don't know what the hell I'm doing!)
Installing any Ruby stuff on HPUX is pretty much hit & miss, and there
does not seem to be much expertise out there with Ruby on HPUX.
So ANY help would be very much appreciated.

After a gem install posix_mq I got an error about not knowing about
ruby.h & defines.h.
So I copied these from somewhere else into the posix_mq directory. Ok.
Then I did a gmake,
and got the error indicated below.
Could you please suggest a workaround so that I can get to the next
problem ?
The HPUX C compiler seems to be ultra conservative or just plain
rubbish!

u91134@tiths303>/mtitres/rec/acore/ruby/lib/ruby/gems/1.8/gems/posix_mq-0.6.0/gmake
cc -I. -I. -I/home/acore/ruby/lib/ruby/1.8/hppa2.0w-hpux11.11 -I.
-DHAVE_SIGNAL_H -DHAVE_MQUEUE_H -DHAVE_PTHREAD_H -I /home/fcux_dev
/cengiza/include -I /usr/include -I /usr/local/include +Z -g +Z -c
posix_mq.c
cc: "posix_mq.c", line 712: error 1558: The ! operator takes a scalar
operand.
gmake: *** [posix_mq.o] Error 1


static VALUE _close(VALUE self)
{
struct posix_mq *mq = get(self, 1);

if ( ! MQ_IO_CLOSE(mq) ) { /* line 712 */
if (mq_close(mq->des) == -1)
rb_sys_fail("mq_close");
}
mq->des = MQD_INVALID;

return Qnil;
}
 
T

Tadeusz Bochan

More info ...

I commented the offending code (see below) and the compile worked.
But now when I run the command line utility
MQUEUE=/testq.acore posix-mq-rb create
the queue is created, but the program crashes with

/usr/lib/dld.sl: Unresolved symbol: MQ_IO_NIL_P (code) from
.../posix_mq_ext.sl

nm posix_mq_ext.sl | grep MQ_IO_NIL # gives =>
MQ_IO_NIL_P | |undef |code |
MQ_IO_NIL_P | 12976|uext |stub |
Which tells me that the symbol exists.
So I haven't a clue as to what is going on.
Any ideas ??

Tad


static VALUE _close(VALUE self)
{
struct posix_mq *mq = get(self, 1);

/* The if statement doesn't compile - error 1558: The ! operator takes a
scalar
if ( ! MQ_IO_CLOSE(mq) ) { /* line 712 */
if (mq_close(mq->des) == -1)
rb_sys_fail("mq_close");
}
*/
mq->des = MQD_INVALID;

return Qnil;
}
 
P

Peter Zotov

More info ...

I commented the offending code (see below) and the compile worked.
But now when I run the command line utility
MQUEUE=/testq.acore posix-mq-rb create
the queue is created, but the program crashes with

/usr/lib/dld.sl: Unresolved symbol: MQ_IO_NIL_P (code) from
.../posix_mq_ext.sl

nm posix_mq_ext.sl | grep MQ_IO_NIL # gives =>
MQ_IO_NIL_P | |undef |code |
MQ_IO_NIL_P | 12976|uext |stub |
Which tells me that the symbol exists.
So I haven't a clue as to what is going on.
Any ideas ??

Tad


static VALUE _close(VALUE self)
{
struct posix_mq *mq = get(self, 1);

/* The if statement doesn't compile - error 1558: The ! operator
takes a scalar
if ( ! MQ_IO_CLOSE(mq) ) { /* line 712 */
if (mq_close(mq->des) == -1)
rb_sys_fail("mq_close");
}
*/
mq->des = MQD_INVALID;

return Qnil;
}

The MQ_* capitalized things are indeed macros, and it looks like
they are screwed up on your system. Can you grep for MQ_IO_CLOSE and
MQ_IO_NIL_P in system header files (and maybe compare that to Linux's)?
 
T

Tadeusz Bochan

Hello Peter,
I searched /usr/include and could not find anything with MQ_IO*,
particularly not in mqueue.h. I don't have a linux available to compare.
I have progressed with the problem though, albeit using the 'throwing
darts' technique of problem solving.

source:
http://bogomips.org/ruby_posix_mq.git/tree/ext/posix_mq/posix_mq.c

In posix_mq.c there was only one reference to MQ_IO_NIL_P so I changed
it:

if (mq->des != MQD_INVALID && MQ_IO_NIL_P(mq)) {
to
if (mq->des != MQD_INVALID && NIL_P(mq)) {

and that eliminated that problem, although I don't know what impact this
will have at runtime. Seems to work.

The next problem was while testing the receive method.
I got the Unresolved symbol : rb_str_set_len
So I changed :
static void rb_18_str_set_len(VALUE str, long len)
to
static void rb_str_set_len(VALUE str, long len)

And so far it all seems to be working.
So I made 3 changes :
1) Commenting out the syntax error on the 'if' statement
2) Changing the reference to MQ_IO_NIL_P to NIL_P
3) Changing rb_18_str_set_len to rb_str_set_len

and still none the wiser about C programming !!
 
E

Eric Wong

Tadeusz Bochan said:
And so far it all seems to be working.

I'll take a look at this next week, I never expected this to run on
HP-UX. Can you send patches/pull requests to
(e-mail address removed) ? Thanks!
 
T

Tadeusz Bochan

FYI,
I also had to

export LD_PRELOAD=/home/..../ext/posix_mq/posix_mq_ext.sl

to avoid a crash because of :
"Can't dlopen a library containing Thread Local Storage .... "
which doesn't make me happy.

If I want to use gem, I have to include etc.sl in LD_PRELOAD,
but if I forget to unset it, some crazy things start happening.
A number of programs and utilities just stop functioning.
For example, 'man' stops working and displays nothing.
So I avoid having the LD_PRELOAD variable set if at all possible.

Cheers,
Tad
 
T

Tadeusz Bochan

Hi Eric,

I originally sent this post to (e-mail address removed),
but I've had no response, so I wasn't sure it was working.

We use pmq's quite a lot (mostly from Cobol !), and I originally built a
Ruby PMQ class using syscall.
This was clumsy, but it worked ok.
At the time (3 or 4 years ago) , there was nothing available on posix
message queues in Ruby, so I was a bit stuck.
Specifing the numbers for syscall wasn't very portable or nice.

Stangely enough, when I tried to access the mq_* routines via DL,
(dlopen)
I got crashes, so I gave up down that route, and decided to wait for
someone to develop posix_mq :))

I will let you know if I find any more problems with posix_mq after some
more testing.

Regards,
Tad
 
T

Tadeusz Bochan

Bummer !

/usr/lib/librt.sl does not have mq_timedreceive or mq_timedsend !!!

This makes posix_mq pretty much unusable on HP-UX B.11.11
 
E

Eric Wong

Tadeusz Bochan said:
Hi Eric,

I originally sent this post to (e-mail address removed),
but I've had no response, so I wasn't sure it was working.

With Librelist, you should've gotten an automatic response asking you to
reply+confirm the subscription. Once you respond to the confirmation
message, you'll be subscribed and be able to post. Librelist requires a
subscription to post, but it doesn't require any passwords/signup which
is nice.

Reading your other emails...
 
E

Eric Wong

Tadeusz Bochan said:
Bummer !

/usr/lib/librt.sl does not have mq_timedreceive or mq_timedsend !!!

This makes posix_mq pretty much unusable on HP-UX B.11.11

Does it have the non-timed receive/send variants? I could add checks
for those and maybe some other platforms could be supported...
 
E

Eric Wong

Eric Wong said:
Does it have the non-timed receive/send variants? I could add checks
for those and maybe some other platforms could be supported...

I just pushed out a pre-release[1] with some attempted fixes
to RubyGems.org along with some cleanups. Relevant commits
are listed here if you want to review them yourself:

http://bogomips.org/ruby_posix_mq.git/commit/?id=3a8a20d
http://bogomips.org/ruby_posix_mq.git/commit/?id=a549167
http://bogomips.org/ruby_posix_mq.git/commit/?id=7144a4e

Let us know how it goes and I'll make a real release if all goes well.

[1] gem install --pre posix_mq (should get you 0.6.0.7.g3a8a)
 
T

Tadeusz Bochan

Hi Eric,
thanks for all that !!

I'll try to get that checked out today

Regards,
Tad
 
T

Tadeusz Bochan

Hi Eric,
The compile failed with the --pre version.

# gmake
cc -I. -I /home/acore/ruby/lib/ruby/1.8/hppa2.0w-hpux11.11
-DHAVE_SIGNAL_H -DHAVE_MQUEUE_H -DHAVE_PTHREAD_H
-I /home/acore/ruby/lib/ruby/1.8/hppa2.0w-hpux11.11 -I /usr/include -I
/usr/local/include +Z -g +Z -c posix_mq.c
cc: "posix_mq.c", line 284: error 1547: "&&" operator requires scalar
operands.
cc: "posix_mq.c", line 284: error 1563: Expression in if must be scalar.
cc: "posix_mq.c", line 737: error 1558: The ! operator takes a scalar
operand.
gmake: *** [posix_mq.o] Error 1

I sent a more complete log to ruby.posix.mq@librelist

Cheers,
Tad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top