Using GCC 3.3.1 on QNX NC 6.3.0

bridged with qnx.development_tools
Evan Hillas

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Evan Hillas » Thu Jun 09, 2005 2:04 pm

Colin Burgess wrote:
For kicks try ntox86-gcc-3.3.1 instead of gcc (without the -V3.3.1)
Cool, ./configure works now. :)


"make" next ... it fails on the very first compile. :(

================================================================

make[2]: Entering directory `/root/progs/boinc_public/api'
source='boinc_api.C' object='boinc_api.o' libtool=no \
DEPDIR=.deps depmode=gcc /bin/sh ../depcomp \
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../lib -I../api -I../db -I../RSAEuro/source
-I../client -I../tools -I../sched -include ../config.h -D__NO_CTYPE -I../lib -
I../api -I../db -I../RSAEuro/source -I../client -I../tools -I../sched -include
../config.h -I/usr/include -c -o boinc_api.o boinc_api.C
In file included from boinc_api.C:41:
.../lib/diagnostics.h:152: warning: invalid character in macro parameter name
.../lib/diagnostics.h:152: badly punctuated parameter list in `#define'
make[2]: *** [boinc_api.o] Error 1

================================================================

I'm guessing I'm getting into portability territory now. Here is line 152 from ../lib/diagnostics.h

#define BOINCTRACE(...)

I'm afraid that three dots not something I'm familiar with - removed.

Next error:

================================================================

boinc_api.C: In function `int set_worker_timer()':
boinc_api.C:668: `SA_RESTART' undeclared (first use this function)
boinc_api.C:668: (Each undeclared identifier is reported only once
boinc_api.C:668: for each function it appears in.)

================================================================

It don't make much sense but ped says that line 668 is the first line of the following:

struct sigaction sa;
itimerval value;
sa.sa_handler = timer_signal_handler;
sa.sa_flags = SA_RESTART;
retval = sigaction(SIGALRM, &sa, NULL);

Bedtime calls ... night all.


Evan

Colin Burgess

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Colin Burgess » Thu Jun 09, 2005 2:08 pm

Evan Hillas wrote:
Colin Burgess wrote:

For kicks try ntox86-gcc-3.3.1 instead of gcc (without the -V3.3.1)


Cool, ./configure works now. :)


"make" next ... it fails on the very first compile. :(

================================================================

make[2]: Entering directory `/root/progs/boinc_public/api'
source='boinc_api.C' object='boinc_api.o' libtool=no \
DEPDIR=.deps depmode=gcc /bin/sh ../depcomp \
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../lib -I../api -I../db
-I../RSAEuro/source
-I../client -I../tools -I../sched -include ../config.h -D__NO_CTYPE
-I../lib -
I../api -I../db -I../RSAEuro/source -I../client -I../tools -I../sched
-include
../config.h -I/usr/include -c -o boinc_api.o boinc_api.C
In file included from boinc_api.C:41:
../lib/diagnostics.h:152: warning: invalid character in macro parameter
name
../lib/diagnostics.h:152: badly punctuated parameter list in `#define'
make[2]: *** [boinc_api.o] Error 1

================================================================
Now it's switched to using g++ again - try forcing it to use
ntox86-g++-3.3.1
I'm guessing I'm getting into portability territory now. Here is line
152 from ../lib/diagnostics.h

#define BOINCTRACE(...)
I'm afraid that three dots not something I'm familiar with - removed.

Next error:

================================================================

boinc_api.C: In function `int set_worker_timer()':
boinc_api.C:668: `SA_RESTART' undeclared (first use this function)
boinc_api.C:668: (Each undeclared identifier is reported only once
boinc_api.C:668: for each function it appears in.)

================================================================

It don't make much sense but ped says that line 668 is the first line of
the following:

struct sigaction sa;
itimerval value;
sa.sa_handler = timer_signal_handler;
sa.sa_flags = SA_RESTART;
retval = sigaction(SIGALRM, &sa, NULL);
QNX doesn't support SA_RESTART - although we USED to have it defined in
our headers.

--
cburgess@qnx.com

Evan Hillas

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Evan Hillas » Fri Jun 10, 2005 8:33 am

I solved the version issue completely I think, the final piece was to define CPPFLAGS instead of CFLAGS + CXXFLAGS

So the final configure command looks like this:
CPPFLAGS="-I/usr/include" LDFLAGS="-I/usr/lib" CC="ntox86-gcc-3.3.1" CXX="ntox86-g++-3.3.1" ./configure

Now back to making, the error list has simply exploded. I'm getting a little worried this is requiring a lot more infrastructure than QNX is providing. :(


Here is just the start of pages and pages of errors for the API compile ...

make[2]: Entering directory `/root/progs/boinc_public/api'
if ntox86-g++-3.3.1 -DHAVE_CONFIG_H -I. -I. -I.. -I../lib -I../api -I../db -I..
/RSAEuro/source -I../client -I../tools -I../sched -include ../config.h -I/usr/
include -D__NO_CTYPE -I../lib -I../api -I../db -I../RSAEuro/source -I../client -
I../tools -I../sched -include ../config.h -g -O2 -MT boinc_api.o -MD -MP -MF
".deps/boinc_api.Tpo" -c -o boinc_api.o boinc_api.C; \
then mv -f ".deps/boinc_api.Tpo" ".deps/boinc_api.Po"; else rm -f ".deps/boinc_a
pi.Tpo"; exit 1; fi
In file included from ../config.h:370,
from <command line>:24:
.../lib/std_fixes.h:56:21: algorithm: No such file or directory
.../lib/std_fixes.h:57:20: iterator: No such file or directory
In file included from ../config.h:370,
from <command line>:24:
.../lib/std_fixes.h:96: error: `std::FILE* fopen(const char*, const char*)'
conflicts with previous using declaration `std::FILE* std::fopen(const
char*, const char*)'
.../lib/std_fixes.h:96: error: `std::FILE* fopen(const char*, const char*)'
conflicts with used function
/usr/include/stdio.h:211: error: `std::FILE* std::fopen(const char*, const
char*)' previously declared here
.../lib/std_fixes.h:97: error: `std::FILE* freopen(const char*, const char*,
std::FILE*)' conflicts with previous using declaration `std::FILE*
std::freopen(const char*, const char*, std::FILE*)'
.../lib/std_fixes.h:97: error: `std::FILE* freopen(const char*, const char*,
std::FILE*)' conflicts with used function

Evan Hillas

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Evan Hillas » Fri Jun 10, 2005 8:39 am

And here's lines 55, 56 and 57 from "../lib/std_fixes.h"

#ifndef HAVE_STD_TRANSFORM
#include <algorithm>
#include <iterator>

Umm, maybe a missing c++ include path me thinks ...


Evan

Mike Gorchak

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Mike Gorchak » Fri Jun 10, 2005 12:47 pm

Hello, Evan!

EH> So the final configure command looks like this:
EH> CPPFLAGS="-I/usr/include" LDFLAGS="-I/usr/lib" CC="ntox86-gcc-3.3.1"
EH> CXX="ntox86-g++-3.3.1" ./configure

My congrats, you have throw away the C and C++ flags and adds the
preprocessor flags only.

With best regards, Mike Gorchak. E-mail: mike@malva.com.ua

Mike Gorchak

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Mike Gorchak » Fri Jun 10, 2005 12:49 pm

Hello, Evan!

EH> #ifndef HAVE_STD_TRANSFORM
EH> #include <algorithm>
EH> #include <iterator>
EH> Umm, maybe a missing c++ include path me thinks ...

So why you have excluded them then ???

With best regards, Mike Gorchak. E-mail: mike@malva.com.ua

Colin Burgess

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Colin Burgess » Fri Jun 10, 2005 4:22 pm

Try adding -v to your command line?

Mike Gorchak wrote:
Hello, Evan!

EH> #ifndef HAVE_STD_TRANSFORM
EH> #include <algorithm
EH> #include <iterator
EH> Umm, maybe a missing c++ include path me thinks ...

So why you have excluded them then ???

With best regards, Mike Gorchak. E-mail: mike@malva.com.ua

--
cburgess@qnx.com

Evan Hillas

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Evan Hillas » Sat Jun 11, 2005 1:38 am

Mike Gorchak wrote:
Hello, Evan!

EH> #ifndef HAVE_STD_TRANSFORM
EH> #include <algorithm
EH> #include <iterator
EH> Umm, maybe a missing c++ include path me thinks ...

So why you have excluded them then ???
cos they didn't help. I've put them back in but still got the exact same result.


Evan

Evan Hillas

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Evan Hillas » Sat Jun 11, 2005 1:55 am

Colin Burgess wrote:
Try adding -v to your command line?
# make -v
GNU Make 3.80
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.


I figured that wasn't what you wanted so if added it to the CC/CXX commands:

CPPFLAGS="-I/usr/include" CFLAGS="-I/usr/include" CXXFLAGS="-I/usr/include" LDFLAGS="-I/usr/lib" CC="ntox86-gcc-3.3.1 -v" CXX="ntox86-g++-3.3.1 -v" ./configure $1


make[2]: Entering directory `/root/progs/boinc_public/api'
if ntox86-g++-3.3.1 -v -DHAVE_CONFIG_H -I. -I. -I.. -I../lib -I../api -I../db -I../RSAEuro/source -I../client -I../tools -I../sched -include ../config.h -I/usr/include -D
__NO_CTYPE -I../lib -I../api -I../db -I../RSAEuro/source -I../client -I../tools -I../sched -include ../config.h -I/usr/include -MT boinc_api.o -MD -MP -MF ".deps/boinc_ap
i.Tpo" -c -o boinc_api.o boinc_api.C; \
then mv -f ".deps/boinc_api.Tpo" ".deps/boinc_api.Po"; else rm -f ".deps/boinc_api.Tpo"; exit 1; fi
Reading specs from /usr/qnx630/host/qnx6/x86/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.1/specs
Configured with: ../configure --srcdir=.. --enable-cheaders=c --with-gnu-as --with-gnu-ld --with-qnxsysroot=/ --target=i386-pc-nto-qnx6.3.0 --srcdir=/home/toolsbuild/cvs/too
ls/gcc/nto-x86-o-ntox86/.. --prefix=/usr --exec-prefix=/usr --with-local-prefix=/usr --enable-haifa --enable-languages=c++ --enable-threads=posix --disable-nls --enable-shar
ed --enable-multilib
Thread model: posix
gcc version 3.3.1 (qnx-nto)
/usr/qnx630/host/qnx6/x86/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.1/cc1plus -quiet -v -I. -I. -I.. -I../lib -I../api -I../db -I../RSAEuro/source -I../client -I../tools -I.
../sched -I/usr/include -I../lib -I../api -I../db -I../RSAEuro/source -I../client -I../tools -I../sched -I/usr/include -MD boinc_api.d -MF .deps/boinc_api.Tpo -MP -MT boinc_a
pi.o -MQ boinc_api.o -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=1 -D__X86__ -Di386 -D__QNXNTO__ -D__QNX__ -D__LITTLEENDIAN__ -D__ELF__ -D__X86__ -D__i386__ -D__QN
XNTO__ -D__QNX__ -D__LITTLEENDIAN__ -D__ELF__ -D__i386 -Asystem=unix -Asystem=nto -Asystem=qnxnto -Asystem=qnx -nostdinc -nostdinc++ -idirafter QNX_TARGET_TAG/usr/include -i
system QNX_TARGET_TAG/usr/include/c++/3.3.1 -isystem QNX_TARGET_TAG/usr/include/c++/3.3.1/i386-pc-nto-qnx6.3.0 -isystem QNX_TARGET_TAG/usr/include/c++/3.3.1/backward -isyste
m QNX_TARGET_TAG/usr/include -isystem QNX_HOST_TAG/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.1/include -DHAVE_CONFIG_H -D__NO_CTYPE -include ../config.h -include ../config.h
boinc_api.C -D__GNUG__=3 -quiet -dumpbase boinc_api.C -auxbase-strip boinc_api.o -version -o /tmp/ccYmdRAY.s
ignoring nonexistent directory "QNX_TARGET_TAG/usr/include"
ignoring nonexistent directory "QNX_TARGET_TAG/usr/include/c++/3.3.1"
ignoring nonexistent directory "QNX_TARGET_TAG/usr/include/c++/3.3.1/i386-pc-nto-qnx6.3.0"
ignoring nonexistent directory "QNX_TARGET_TAG/usr/include/c++/3.3.1/backward"
ignoring nonexistent directory "QNX_TARGET_TAG/usr/include"
ignoring nonexistent directory "QNX_HOST_TAG/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.1/include"
GNU C++ version 3.3.1 (qnx-nto) (i386-pc-nto-qnx6.3.0)
compiled by GNU C version 2.95.3qnx-nto 20010315 (release).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring duplicate directory "."
ignoring duplicate directory "../api"
ignoring duplicate directory "../lib"
ignoring duplicate directory "../api"
ignoring duplicate directory "../db"
ignoring duplicate directory "../RSAEuro/source"
ignoring duplicate directory "../client"
ignoring duplicate directory "../tools"
ignoring duplicate directory "../sched"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
.
..
../lib
../db
../RSAEuro/source
../client
../tools
../sched
/usr/include
End of search list.
In file included from ../config.h:370,
from <command line>:24:
.../lib/std_fixes.h:56:21: algorithm: No such file or directory
.../lib/std_fixes.h:57:20: iterator: No such file or directory
In file included from ../config.h:370,
from <command line>:24:
.../lib/std_fixes.h:96: error: `std::FILE* fopen(const char*, const char*)'
conflicts with previous using declaration `std::FILE* std::fopen(const
char*, const char*)'

....... on and on and on and on ......


Evan

Colin Burgess

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Colin Burgess » Sat Jun 11, 2005 8:24 pm

Ok I think we have a gcc bug. I've reported it to the tools guys...

You see all host QNX_HOST_TAG and QNX_TARGET_TAG lines - they should be
replaced with $QNX_HOST and $QNX_TARGET.

Looking at the specs file on my system they appear to be alright, so you
might have to manually add them to your cc flags.

Just reproduce the -isystem etc etc stuff you see in that cpp0 line...

Colin

Evan Hillas wrote:
Colin Burgess wrote:

Try adding -v to your command line?


# make -v
GNU Make 3.80
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.


I figured that wasn't what you wanted so if added it to the CC/CXX
commands:

CPPFLAGS="-I/usr/include" CFLAGS="-I/usr/include"
CXXFLAGS="-I/usr/include" LDFLAGS="-I/usr/lib" CC="ntox86-gcc-3.3.1 -v"
CXX="ntox86-g++-3.3.1 -v" ./configure $1


make[2]: Entering directory `/root/progs/boinc_public/api'
if ntox86-g++-3.3.1 -v -DHAVE_CONFIG_H -I. -I. -I.. -I../lib -I../api
-I../db -I../RSAEuro/source -I../client -I../tools -I../sched -include
../config.h -I/usr/include -D
__NO_CTYPE -I../lib -I../api -I../db -I../RSAEuro/source -I../client
-I../tools -I../sched -include ../config.h -I/usr/include -MT
boinc_api.o -MD -MP -MF ".deps/boinc_ap
i.Tpo" -c -o boinc_api.o boinc_api.C; \
then mv -f ".deps/boinc_api.Tpo" ".deps/boinc_api.Po"; else rm -f
".deps/boinc_api.Tpo"; exit 1; fi
Reading specs from
/usr/qnx630/host/qnx6/x86/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.1/specs
Configured with: ../configure --srcdir=.. --enable-cheaders=c
--with-gnu-as --with-gnu-ld --with-qnxsysroot=/
--target=i386-pc-nto-qnx6.3.0 --srcdir=/home/toolsbuild/cvs/too
ls/gcc/nto-x86-o-ntox86/.. --prefix=/usr --exec-prefix=/usr
--with-local-prefix=/usr --enable-haifa --enable-languages=c++
--enable-threads=posix --disable-nls --enable-shar
ed --enable-multilib
Thread model: posix
gcc version 3.3.1 (qnx-nto)
/usr/qnx630/host/qnx6/x86/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.1/cc1plus
-quiet -v -I. -I. -I.. -I../lib -I../api -I../db -I../RSAEuro/source
-I../client -I../tools -I.
./sched -I/usr/include -I../lib -I../api -I../db -I../RSAEuro/source
-I../client -I../tools -I../sched -I/usr/include -MD boinc_api.d -MF
.deps/boinc_api.Tpo -MP -MT boinc_a
pi.o -MQ boinc_api.o -D__GNUC__=3 -D__GNUC_MINOR__=3
-D__GNUC_PATCHLEVEL__=1 -D__X86__ -Di386 -D__QNXNTO__ -D__QNX__
-D__LITTLEENDIAN__ -D__ELF__ -D__X86__ -D__i386__ -D__QN
XNTO__ -D__QNX__ -D__LITTLEENDIAN__ -D__ELF__ -D__i386 -Asystem=unix
-Asystem=nto -Asystem=qnxnto -Asystem=qnx -nostdinc -nostdinc++
-idirafter QNX_TARGET_TAG/usr/include -i
system QNX_TARGET_TAG/usr/include/c++/3.3.1 -isystem
QNX_TARGET_TAG/usr/include/c++/3.3.1/i386-pc-nto-qnx6.3.0 -isystem
QNX_TARGET_TAG/usr/include/c++/3.3.1/backward -isyste
m QNX_TARGET_TAG/usr/include -isystem
QNX_HOST_TAG/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.1/include
-DHAVE_CONFIG_H -D__NO_CTYPE -include ../config.h -include ../config.h
boinc_api.C -D__GNUG__=3 -quiet -dumpbase boinc_api.C -auxbase-strip
boinc_api.o -version -o /tmp/ccYmdRAY.s
ignoring nonexistent directory "QNX_TARGET_TAG/usr/include"
ignoring nonexistent directory "QNX_TARGET_TAG/usr/include/c++/3.3.1"
ignoring nonexistent directory
"QNX_TARGET_TAG/usr/include/c++/3.3.1/i386-pc-nto-qnx6.3.0"
ignoring nonexistent directory
"QNX_TARGET_TAG/usr/include/c++/3.3.1/backward"
ignoring nonexistent directory "QNX_TARGET_TAG/usr/include"
ignoring nonexistent directory
"QNX_HOST_TAG/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.1/include"
GNU C++ version 3.3.1 (qnx-nto) (i386-pc-nto-qnx6.3.0)
compiled by GNU C version 2.95.3qnx-nto 20010315 (release).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring duplicate directory "."
ignoring duplicate directory "../api"
ignoring duplicate directory "../lib"
ignoring duplicate directory "../api"
ignoring duplicate directory "../db"
ignoring duplicate directory "../RSAEuro/source"
ignoring duplicate directory "../client"
ignoring duplicate directory "../tools"
ignoring duplicate directory "../sched"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
.
..
../lib
../db
../RSAEuro/source
../client
../tools
../sched
/usr/include
End of search list.
In file included from ../config.h:370,
from <command line>:24:
../lib/std_fixes.h:56:21: algorithm: No such file or directory
../lib/std_fixes.h:57:20: iterator: No such file or directory
In file included from ../config.h:370,
from <command line>:24:
../lib/std_fixes.h:96: error: `std::FILE* fopen(const char*, const char*)'
conflicts with previous using declaration `std::FILE* std::fopen(const
char*, const char*)'

...... on and on and on and on ......


Evan
--
cburgess@qnx.com

Evan Hillas

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Evan Hillas » Sat Jun 11, 2005 11:28 pm

Colin Burgess wrote:
Ok I think we have a gcc bug. I've reported it to the tools guys...
Excellent. Thanks for the attention.

Thanks, also, to Mike Gorchak for the help with env variables.

You see all host QNX_HOST_TAG and QNX_TARGET_TAG lines - they should be
replaced with $QNX_HOST and $QNX_TARGET.

Looking at the specs file on my system they appear to be alright, so you
might have to manually add them to your cc flags.
Umm, cc flags? Changing CFLAGS and co don't work. I presume I'm to dig in the resultant Makefile or someplace like that?


Evan

Colin Burgess

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Colin Burgess » Sun Jun 12, 2005 12:33 am

Try adding something like

ntox86-gcc-3.3.5 -c foo.cpp -v \
-isystem C:/QNX630/target/qnx6/usr/include/c++/3.3.5 \
-isystem C:/QNX630/target/qnx6/usr/include/c++/3.3.5/i386-pc-nto-qnx6.3.0 \
-isystem C:/QNX630/target/qnx6/usr/include/c++/3.3.5/backward \
-isystem C:/QNX630/target/qnx6/usr/include \
-isystem
C:/QNX630/host/win32/x86/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.5/inc
lude
~

Evan Hillas wrote:
Colin Burgess wrote:

Ok I think we have a gcc bug. I've reported it to the tools guys...


Excellent. Thanks for the attention.

Thanks, also, to Mike Gorchak for the help with env variables.


You see all host QNX_HOST_TAG and QNX_TARGET_TAG lines - they should be
replaced with $QNX_HOST and $QNX_TARGET.

Looking at the specs file on my system they appear to be alright, so
you might have to manually add them to your cc flags.


Umm, cc flags? Changing CFLAGS and co don't work. I presume I'm to dig
in the resultant Makefile or someplace like that?


Evan
--
cburgess@qnx.com

Evan Hillas

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Evan Hillas » Thu Jun 16, 2005 1:04 pm

Right, got that done and compiling now. :)

I added to the CPPFLAGS -DSA_RESTART=0 to bypass that particular error.


Next is a rather confusing error for me:

parse.C: In function `bool parse_int(const char*, const char*, int&)':
parse.C:68: error: invalid conversion from `const char*' to `char*'
parse.C: In function `bool parse_double(const char*, const char*, double&)':
parse.C:81: error: invalid conversion from `const char*' to `char*'

Lines 67 and 68 from parse.C ...

bool parse_int(const char* buf, const char* tag, int& x) {
char* p = strstr(buf, tag);

Looking up strstr() in string.h I find a tangle that is more than I can understand. It is declared as const all round ...

extern _Const_return char *strstr( const char *__s1, const char *__s2 );

I'm a bit concerned about that _Const_return piece.
And later there is this little gem ...

inline char *strstr(char *_S, const char *_P)
{ /* call with const first argument */
union { char *_Out; _Const_return char * _In; } _Result;
return (_Result._In = _CSTD strstr((const char *)_S, _P)), _Result._Out; }


Evan

Evan Hillas

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Evan Hillas » Thu Jun 16, 2005 1:18 pm

Evan Hillas wrote:
parse.C: In function `bool parse_int(const char*, const char*, int&)':
parse.C:68: error: invalid conversion from `const char*' to `char*'

Lines 67 and 68 from parse.C ...

bool parse_int(const char* buf, const char* tag, int& x) {
char* p = strstr(buf, tag);
Oh, click!, it is returning a pointer to a const char which means p should be declared as such. Hmm, I just assumed they would have something like that all nice and clean in such, supposedly, portable code.


Evan

Colin Burgess

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Colin Burgess » Thu Jun 16, 2005 2:24 pm

Evan Hillas wrote:
Right, got that done and compiling now. :)

I added to the CPPFLAGS -DSA_RESTART=0 to bypass that particular error.
Danger - we don't support SA_RESTART so that was why it wasn't defined.
So you may have problems with interrupted kernel calls.
Next is a rather confusing error for me:

parse.C: In function `bool parse_int(const char*, const char*, int&)':
parse.C:68: error: invalid conversion from `const char*' to `char*'
parse.C: In function `bool parse_double(const char*, const char*,
double&)':
parse.C:81: error: invalid conversion from `const char*' to `char*'

Lines 67 and 68 from parse.C ...

bool parse_int(const char* buf, const char* tag, int& x) {
char* p = strstr(buf, tag);

Looking up strstr() in string.h I find a tangle that is more than I can
understand. It is declared as const all round ...

extern _Const_return char *strstr( const char *__s1, const char *__s2 );

I'm a bit concerned about that _Const_return piece.
And later there is this little gem ...

inline char *strstr(char *_S, const char *_P)
{ /* call with const first argument */
union { char *_Out; _Const_return char * _In; } _Result;
return (_Result._In = _CSTD strstr((const char *)_S, _P)),
_Result._Out; }


Evan
--
cburgess@qnx.com

Post Reply

Return to “qnx.development_tools”