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!
[email protected]>/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
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 ??
/* 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;
On Mon, 21 Feb 2011 00:29:15 +0900
Tadeusz B. [email protected] wrote:
nm posix_mq_ext.sl | grep MQ_IO_NIL # gives =>
{
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)?
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.
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 :
Commenting out the syntax error on the ‘if’ statement
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.
I originally sent this post to [email protected],
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.
I originally sent this post to [email protected],
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.
/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…
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: