Niels M?ller wrote:
>
> Gabe Foster <[EMAIL PROTECTED]> writes:
>
> > I've managed to get LSH to compile on an SGI running IRIX6 using the
> > sgi compiler. Patches for 0.2.7 are attached. You need to use a
> > configure line like the following:
> >
> > env CPPFLAGS="-I/usr/local/include" CFLAGS="-D inline=__inline
> > -D__OPTIMIZE__ -I
> > /usr/local/include -I/usr/gnu/include" LDFLAGS="-L/usr/local/lib
> > -L/usr/gnu/lib"
> > LIBS="-lmalloc" ./configure --with-zlib --with-tcp-forward
>
> Good to hear. If you have suggestions for what to put in configure.in
> to do some or all of this automatically, that is also appreciated.
Will if I get a chance.
>
> > Many thanks to K. Thurston for his help in getting this far.
> >
> > Unfortunatly, lsh aborts with the following message when trying to
> > connect. It looks like the allocator is getting confused:
> >
> > > src/lsh machine.name.com
> > make_device_random: Failed to open '/dev/urandom' (errno = 2): No such
> > file or directory
> > Warning: Falling back to an insecure pseudorandom generator.
> > lsh_object_check_subtype: Type error!
> > Abort (core dumped)
>
> I don't think I've seen it at at this particular place. To track it
> down, a backtrace from the debugger, as well as the output when
> running with --debug --trace, would be helpful.
>
I'll give that a try as soon as I am able...
> I have a few questions about the patch (although I haven't tried to
> dig into the issues yet; in particular, I don't know how, where and
> why the N_-macro is defined). I'd like to know what problem each of
> the patches solves.
>
> > diff -c -r lsh-0.2.7/src/argp/argp-fmtstream.c
>lsh-0.2.7.new/src/argp/argp-fmtstream.c
> > *** lsh-0.2.7/src/argp/argp-fmtstream.c Wed Feb 2 15:59:53 2000
> > --- lsh-0.2.7.new/src/argp/argp-fmtstream.c Fri Feb 4 07:38:04 2000
> > ***************
> > *** 388,393 ****
> > --- 388,394 ----
> >
> > #endif /* !ARGP_FMTSTREAM_USE_LINEWRAP */
> >
> > + #if !defined( __sgi ) || defined( __GNUC__ )
> > size_t
> > __argp_fmtstream_write (argp_fmtstream_t __fs,
> > __const char *__str, size_t __len)
> > ***************
> > *** 468,471 ****
> > __argp_fmtstream_update (__fs);
> > return __fs->point_col >= 0 ? __fs->point_col : 0;
> > }
> > !
> > --- 469,472 ----
> > __argp_fmtstream_update (__fs);
> > return __fs->point_col >= 0 ? __fs->point_col : 0;
> > }
> > ! #endif /* !defined( __sgi ) || defined( __GNUC__ ) */
>
> Shouldn't it be && rather than ||? And in what way does the definition
> break on sgi?
Nope, It should be right. If you are using gcc on an SGI this code will
(probably) work. The issue that the sgi cc compiler does not like that
each of these functions is already defined in the .h file, so it refuses
to 'redefine' them.
>
> > diff -c -r lsh-0.2.7/src/argp/argp-fmtstream.h
>lsh-0.2.7.new/src/argp/argp-fmtstream.h
> > *** lsh-0.2.7/src/argp/argp-fmtstream.h Wed Nov 3 15:27:17 1999
> > --- lsh-0.2.7.new/src/argp/argp-fmtstream.h Fri Feb 4 07:40:15 2000
> > ***************
> > *** 212,218 ****
> > --- 212,222 ----
> > #endif
> >
> > #ifndef ARGP_FS_EI
> > + #if defined( __sgi ) && !defined( __GNUC__ )
> > + #define ARGP_FS_EI __inline
> > + #else
> > #define ARGP_FS_EI extern inline
> > + #endif
> > #endif
> >
> > ARGP_FS_EI size_t
>
> Hmm. AC_C_INLINE in configure.in is supposed to define inline as
> __inline, if appropriate. Does that happen for you? What does
> configure say about inline? Do you get any relevant definitions in
> config.h? Or Is it the combination of extern and inline that causes
> problems?
AC_C_INLINE does NOT take care of that correctly, but that is not the
real issue that this solves. The SGI cc compiler does not like extern
with __inline.
If you will note the configure line above it contains a '-D
inline=__inline' flag
>
> > diff -c -r lsh-0.2.7/src/argp/argp-parse.c lsh-0.2.7.new/src/argp/argp-parse.c
> > *** lsh-0.2.7/src/argp/argp-parse.c Wed Feb 2 15:59:54 2000
> > --- lsh-0.2.7.new/src/argp/argp-parse.c Thu Feb 3 10:28:22 2000
> > ***************
> > *** 803,809 ****
> > parser, because we pre-compute which parser is supposed to deal
> > with each option. */
> > {
> > ! static const char bad_key_err[] =
> > N_("(PROGRAM ERROR) Option should have been recognized!?");
> > if (group_key == 0)
> > __argp_error (&parser->state, "-%c: %s", opt,
> > --- 803,809 ----
> > parser, because we pre-compute which parser is supposed to deal
> > with each option. */
> > {
> > ! static const char *bad_key_err =
> > N_("(PROGRAM ERROR) Option should have been recognized!?");
> > if (group_key == 0)
> > __argp_error (&parser->state, "-%c: %s", opt,
>
> I don't quite understand what happens here (I didn't write this code).
> Can you explain? Perhaps the bugfix should be sent to the glibc folks.
These statements should be equivalent, I think. The SGI compiler thinks
that character arrays need to be initialized with values in {} rather
than a 'char *' from a string. If you would like to forward the fix on
to the glibc folks, please do. Otherwise, if you can give me the
contact info, I will do it.
>
> > diff -c -r lsh-0.2.7/src/lsh_types.h lsh-0.2.7.new/src/lsh_types.h
> > *** lsh-0.2.7/src/lsh_types.h Mon Jan 10 00:58:47 2000
> > --- lsh-0.2.7.new/src/lsh_types.h Fri Feb 4 07:34:45 2000
> > ***************
> > *** 97,103 ****
> > --- 97,107 ----
> > #if HAVE_STRSIGNAL
> > #define STRSIGNAL strsignal
> > #else
> > + #ifdef __sgi
> > + #define STRSIGNAL(x) (_sys_siglist[x])
> > + #else
> > #define STRSIGNAL(x) (sys_siglist[x])
> > + #endif
> > #endif
>
> This one is pretty obvious. Is #ifdef __sgi the canonical way to test
> for SGI?
__sgi is what I have always used, and is the favored symbol as far as I
know.
>
> Best regards,
> /Niels
--
* J. Gabriel Foster "We have advanced to new and surprising
* Silicon Grail levels of bafflement" - Lois McMaster Bujold
* [EMAIL PROTECTED]