Trying to port gmp v4.1.2 to QNX4. No luck...

Two problems so far:

  1. ./configure strangely reports it did not like <stdio.h> file and that
    there will be no FILE prototypes in result. (The configuration finishes
    correctly though…)
  2. every time “make” needs to create a library - if the command line is
    too long - “/bin/expr” blows with “Stack overflow at 0007:0002207F”. The
    library files appear but they are somehow defective, when "make check"ing
  • the linker complains about “No dictionary” there.

Please comment.

Tony.

Tony wrote:

Two problems so far:

  1. ./configure strangely reports it did not like <stdio.h> file and
    that there will be no FILE prototypes in result. (The configuration
    finishes correctly though…)
  2. every time “make” needs to create a library - if the command line is
    too long - “/bin/expr” blows with “Stack overflow at 0007:0002207F”.
    The library files appear but they are somehow defective, when "make
    check"ing - the linker complains about “No dictionary” there.

Please comment.

On 6.3.0, building gmp 4.1.4 seems to work out of the box, although I
did have to install m4 first.

…/configure ; make

“make check” to run the tests seems to fail on a locale test, but the
other tests appear to all work.


Chris Herborth (cherborth@qnx.com)
Never send a monster to do the work of an evil scientist.

On Mon, 06 Dec 2004 12:34:23 -0500, Chris Herborth <cherborth@qnx.com>
wrote:

On 6.3.0, building gmp 4.1.4 seems to work out of the box, although I
did have to install m4 first.
I should have said that I’m on QNX4 …

While I was strugling with v4.1.2 the GMP has advanced to v4.1.4. I have
the same problems with /bin/expr and /bin/wlib (Watcom C v10.6B).
But by now I’ve found a way to build the libraries, the tests are all OK
but the three - locale, printf and scanf. Theese three are failing (I
believe) because of <stdio.h> was disliked by ./configure which reported
that no FILE prototypes will be available. (I wonder why?)

Is it possible to obtain either sources of /bin/expr or the binary that
would be built with the stack ~8~16Mb? I believe QNX v4.25G /bin/expr has
a smallish stack…

Tony.

PS Linking a program with gmp v4.1.4 gives me nearly twice the speed
compared to the program with gmp v2.0.2, quite impressive!

booBotwrote:
On Mon, 06 Dec 2004 12:34:23 -0500, Chris Herborth

<cherborth@qnx.com>

wrote:

hile I was strugling with v4.1.2 the GMP has advanced to v4.1.4. I
have
the same problems with /bin/expr and /bin/wlib (Watcom C v10.6B).
But by now I’ve found a way to build the libraries, the tests are
all OK
but the three - locale, printf and scanf. Theese three are failing
(I
believe) because of <stdio.h> was disliked by ./configure
which reported
that no FILE prototypes will be available. (I wonder why?)
Is it possible to obtain either sources of /bin/expr or the binary
that
would be built with the stack ~8~16Mb? I believe QNX v4.25G
/bin/expr has
a smallish stack…

How do you redefine function va_copy() in gmp-impl.h (140)?
Original definition won’t work.

booBotwrote:
On Mon, 06 Dec 2004 12:34:23 -0500, Chris Herborth

<cherborth@qnx.com>

wrote:

While I was strugling with v4.1.2 the GMP has advanced to v4.1.4. I
have
the same problems with /bin/expr and /bin/wlib (Watcom C v10.6B).
But by now I’ve found a way to build the libraries, the tests are
all OK
but the three - locale, printf and scanf. Theese three are failing
(I
believe) because of <stdio.h> was disliked by ./configure
which reported
that no FILE prototypes will be available. (I wonder why?)
Tony.

Look in gmp-h.in
#if defined (FILE)
|| defined (H_STDIO)
|| defined (_H_STDIO) /* AIX /
|| defined (_STDIO_H) /
glibc, Sun, SCO /
|| defined (STDIO_H) /
BSD, OSF /
|| defined (STDIO_H) /
IRIX /
|| defined (_STDIO_INCLUDED) /
HPUX */
|| defined (_dj_include_stdio_h) /*HPUX /
|| defined (_FILE_DEFINED) /
Microsift /
|| defined (STDIO) /
Apple MPW MrC */
#define _GMP_H_HAVE_FILE 1
#endif

add for QNX4
|| define (_STDIO_H_INCLUDED) /* QNX4 */
and configure will work properly

On Thu, 01 Sep 2005 09:59:55 +0400, KBOB
<kbob@mobilcard-dot-ru.no-spam.invalid> wrote:

add for QNX4
|| define (_STDIO_H_INCLUDED) /* QNX4 */
Seems, there is a ^typo here.

Should it be this way:
#if defined (FILE)
|| defined (H_STDIO)
|| defined (_H_STDIO) /* AIX /
|| defined (_STDIO_H) /
glibc, Sun, SCO /
|| defined (STDIO_H) /
BSD, OSF /
|| defined (STDIO_H) /
IRIX /
|| defined (_STDIO_INCLUDED) /
HPUX */
|| defined (_dj_include_stdio_h) /*HPUX /
|| defined (_FILE_DEFINED) /
Microsift /
|| defined (STDIO) /
Apple MPW MrC /
|| defined (_STDIO_H_INCLUDED) /
QNX4 */
#define _GMP_H_HAVE_FILE 1
#endif

Thank you for the suggestion, I’ll try it ASAP.

Tony.

On Thu, 01 Sep 2005 09:59:55 +0400, KBOB
<kbob@mobilcard-dot-ru.no-spam.invalid> wrote:

How do you redefine function va_copy() in gmp-impl.h (140)?
Original definition won’t work.
I had to hack “gmp-impl.h” back and forth during the compilation to get

past “mpz_inp_str_nowhite __gmpz_inp_str_nowhite” type definition…

But I did not hack anything about va_copy() as far as I can understand.
(Or, may be I’m wrong again, it was quite long ago.)

Tony.

KBOB <kbob@mobilcard-dot-ru.no-spam.invalid> wrote:

I’ve got some clue for locale, printf and scanf tests fails.
When I porting gmp-4.0, I’ve got some problems with va_copy().
Original definition
#define va_copy(dst,src) do { (dst) = (src); } while (0)
don’t compile.
When I try gmp-4.1.4 version, va_copy() redefined to
#define va_copy(dst,src) do { memcpy (&(dst), &(src), sizeof
(va_list)); } while (0)
It compiles but test fails.
When I define Va_copy() like
#define va_copy(dst,src) do { *(dst) = *(src); } while (0)
locale and printf tests pass.
Scanf test fails, but without sigsegv and stack overflow!
I don’t clearly understand what va_copy used for in gmp.
May be for return to previose state of va_list()?
But I think that problem is in va_copy definition.

Hello KBOB,

Don’t know if this will help, but some time ago while porting samba I had
to define va_copy() (to get samba’s version of snprintf.c working) like
this:

#ifndef va_copy
#ifdef WATCOMC
#define va_copy(d, s) (*(d) = (s))
#endif
#endif /
va_copy */

Note that the QNX4 compiler supports assignment of aggregate types (except
arrays). I.e. if d and s are pointers to structs of the same type, then
you can do *d = *s.

In general one would use va_copy() (which was added to the C standard
after the one the QNX4 compiler conformes to) in situations where a
va_list object needs to be saved for later use. You would have to debug
the test to see why it’s failing and to get a clue how to define va_copy()
properly for your case. (Or to find a work-arround.)

Good luck.

regards,
rick

Yes, with this modification “./configure --host=none” works out well.
I can compile the package and get all the tests OK except the three in
“./misc” subdirectory - just as before. And as before - the library itself
is usable - tested by linking with it my favourite “ssh-1.2.33” project.

I can’t let ./configure to guess the host type because it then tryes to
use ASM sources and this fails.

However - unlike KBOB, I do not see ANY problems with “va_copy()” here.
I wonder why?..

Tony.