Skip navigation.
Home
The QNX Community Portal

View topic - Trying to port gmp v4.1.2 to QNX4. No luck...

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

Read-only archive of qnx.porting (Discuss migrating applications from QNX4, VxWorks, PSOS, or Linux to QNX Neutrino) at inn.qnx.com

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

Postby booBot » Sat Dec 04, 2004 7:39 pm

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.
booBot
Senior Member
 
Posts: 633
Joined: Tue Feb 24, 2004 5:07 pm

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

Postby Chris Herborth » Mon Dec 06, 2004 5:34 pm

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.
Chris Herborth
 

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

Postby booBot » Tue Dec 07, 2004 11:15 am

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!
booBot
Senior Member
 
Posts: 633
Joined: Tue Feb 24, 2004 5:07 pm

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

Postby KBOB » Thu Sep 01, 2005 4:59 am

booBot wrote: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.
KBOB
Active Member
 
Posts: 39
Joined: Mon Jul 04, 2005 9:40 am

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

Postby KBOB » Thu Sep 01, 2005 5:15 am

booBot wrote: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
KBOB
Active Member
 
Posts: 39
Joined: Mon Jul 04, 2005 9:40 am

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

Postby booBot » Thu Sep 01, 2005 2:15 pm

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.
booBot
Senior Member
 
Posts: 633
Joined: Tue Feb 24, 2004 5:07 pm

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

Postby booBot » Thu Sep 01, 2005 2:20 pm

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.
booBot
Senior Member
 
Posts: 633
Joined: Tue Feb 24, 2004 5:07 pm

RE: Re: Trying to port gmp v4.1.2 to QNX4. No luck...

Postby KBOB » Sat Sep 03, 2005 5:33 am

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.
KBOB
Active Member
 
Posts: 39
Joined: Mon Jul 04, 2005 9:40 am

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

Postby Rick Lake » Sun Sep 04, 2005 11:47 am

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
Rick Lake
 

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

Postby booBot » Sat Sep 24, 2005 1:24 pm

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.
booBot
Senior Member
 
Posts: 633
Joined: Tue Feb 24, 2004 5:07 pm


Return to qnx.porting

Who is online

Users browsing this forum: No registered users and 1 guest