Operating System - HP-UX
1833130 Members
3224 Online
110051 Solutions
New Discussion

error compiling lftp 3.0.3

 
SOLVED
Go to solution
Bill McNAMARA_1
Honored Contributor

error compiling lftp 3.0.3


FileSet.cc: In static member function `static FileInfo*
FileInfo::parse_ls_line(const char*, const char*)':
FileSet.cc:734: error: `strtok_r' undeclared (first use this function)
FileSet.cc:734: error: (Each undeclared identifier is reported only once for
each function it appears in.)
*** Error exit code 1

Stop.
*** Error exit code 1

Stop.


---
installed is

autoconf 2.57 autoconf
automake 1.4.2001-06-12 GNU automake
bison 1.875 bison
ddd 3.3.2001-06-12 A graphical front-end for gdb
flex 2.5.4a flex
gawk 3.1.3 gawk
gcc 3.3.2 gcc
gettext 0.14.1 gettext
gmake 3.79.1.2001-06-12 GNU make
libiconv 1.9.2 libiconv
libpng 1.2.0 libpng
m4 1.4 m4
make 3.80 make
patch 2.5.4.2001-06-12 GNU patch
perl 5.8.3 perl
texinfo 4.5 texinfo

Thanks for any help.
Bill
It works for me (tm)
13 REPLIES 13
Mark Grant
Honored Contributor

Re: error compiling lftp 3.0.3

Bill,

This might work but is almost certainly not the right way do do it!

Try "#include " near the top of FileSet.cc

It's worth a try.
Never preceed any demonstration with anything more predictive than "watch this"
Mark Grant
Honored Contributor

Re: error compiling lftp 3.0.3

Sorry to double post! No points for this particular effort please.

I don't have lftp nor an HPUX box at the moment . A more detailed examination of the code would probably say exactly where strtok_r should be defined.
Never preceed any demonstration with anything more predictive than "watch this"
Bill McNAMARA_1
Honored Contributor

Re: error compiling lftp 3.0.3

same thing with suggested modification..
It works for me (tm)
Robert-Jan Goossens_1
Honored Contributor

Re: error compiling lftp 3.0.3

Can I make you happy with a precompiled 2.6.10 release ?

ftp://ftp.thewrittenword.com/packages/by-architecture/hppa1.1-hp-hpux11.11/lftp-2.6.10/

Robert-Jan
Mark Grant
Honored Contributor

Re: error compiling lftp 3.0.3

Does HPUX even have strtok_r? It might be worth changing line 734 to "strtok" instead. strtok_r() is the re-entrant version of strtok. Actually, my google search for the HPUX man page would suggest that HPUX does NOT have strtok which would explain why my earlier suggestion doesn't work.

Interestingly, the Linux man page for strtok has this to say

"BUGS
Never use these functions."

Cool!

Never preceed any demonstration with anything more predictive than "watch this"
Bill McNAMARA_1
Honored Contributor

Re: error compiling lftp 3.0.3

when changing to strtok: get more errors..
I'm not a coder so don't want to delve too deply into this ;)

I was specifically asked to compile the 3.0.3 so previous versions.. so I won't suggest previous versions until I've given up trying to compile 3.0.3

--


/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.3.2/include/string.h:81: error: too
many arguments to function `char* strtok(char*, const char*)'
FileSet.cc:735: error: at this point in file
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.3.2/include/string.h:81: error: too
many arguments to function `char* strtok(char*, const char*)'
FileSet.cc:765: error: at this point in file
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.3.2/include/string.h:81: error: too
many arguments to function `char* strtok(char*, const char*)'
FileSet.cc:771: error: at this point in file
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.3.2/include/string.h:81: error: too
many arguments to function `char* strtok(char*, const char*)'
FileSet.cc:777: error: at this point in file
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.3.2/include/string.h:81: error: too
many arguments to function `char* strtok(char*, const char*)'
FileSet.cc:780: error: at this point in file
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.3.2/include/string.h:81: error: too
many arguments to function `char* strtok(char*, const char*)'
FileSet.cc:790: error: at this point in file
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.3.2/include/string.h:81: error: too
many arguments to function `char* strtok(char*, const char*)'
FileSet.cc:809: error: at this point in file
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.3.2/include/string.h:81: error: too
many arguments to function `char* strtok(char*, const char*)'
FileSet.cc:817: error: at this point in file
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.3.2/include/string.h:81: error: too
many arguments to function `char* strtok(char*, const char*)'
FileSet.cc:843: error: at this point in file
*** Error exit code 1

Stop.
*** Error exit code 1

Stop.
It works for me (tm)
Mark Grant
Honored Contributor

Re: error compiling lftp 3.0.3

Ok Bill, I think this could get nasty if we continue down that road.

I think it boils down to the code is probably developed on one platform and there are compilation options for HPUX. Perhaps you can see some "#ifdefs" in there which make different things happen on different platforms. Things like "#ifdef HPUX". It MAY be possible to see that these are wrong. Have you tried a "man strtok_r" to see if it is on HPUX? perhaps we need to "#include " instead of "" though normally one just includes the other.

There is one other possibility, you could do your own "strtok_r" which calls "strtok" but if you are not too confident in coding then that may not be the approach you are after.
Never preceed any demonstration with anything more predictive than "watch this"
Mark Grant
Honored Contributor

Re: error compiling lftp 3.0.3

Also, if you don't mind butchering this code, you could actually keep the strtok_r as strtok and just remove the third parameter each time it is called. As far as I know, if the re-entrant facilities of strtok_r are not required then that third paramter will do nothing useful. It is just an area of RAM that strtok_r uses to do it's stuff that strtok handles internally.
Never preceed any demonstration with anything more predictive than "watch this"
Bill McNAMARA_1
Honored Contributor

Re: error compiling lftp 3.0.3


here's the strtok_r() occurances see attached:

#define FIRST_TOKEN strtok_r(line," \t",&next)
#define NEXT_TOKEN strtok_r(NULL," \t",&next)

char *name=strtok_r(NULL,"",&next);
if(!name)
ERR;
It works for me (tm)
Mark Grant
Honored Contributor
Solution

Re: error compiling lftp 3.0.3

Bill,

For real code butchering remove the ",&next" occurances and change the strtok_r() to strtok().

This should at least compile but i wouldn't guarantee it will actually work. Should do though.
Never preceed any demonstration with anything more predictive than "watch this"
H.Merijn Brand (procura
Honored Contributor

Re: error compiling lftp 3.0.3

a5:/u/usr/merijn 104 > grep -r strtok_r /usr/include /usr/local/pa20_32/include
/usr/include/string.h: extern char *strtok_r(char *, const char *, char **);
/usr/include/string.h: extern char *strtok_r();
Binary file /usr/local/pa20_32/include/c++/3.4.0/hppa2.0w-hp-hpux11.00/bits/stdc++.h.gch/O0g matches
Binary file /usr/local/pa20_32/include/c++/3.4.0/hppa2.0w-hp-hpux11.00/bits/stdc++.h.gch/O2g matches
a5:/u/usr/merijn 105 >

in string.h

extern char *strtok(char *, const char *);
extern char *strerror(int);
_NAMESPACE_STD_END
# ifdef _REENTRANT
extern char *strtok_r(char *, const char *, char **);
# ifdef _PTHREADS_DRAFT4
extern int strerror_r(int, char *, int);
# endif /* _PTHREADS_DRAFT4 */
# endif
# else /* __STDC__ || __cplusplus */


Hey, see that? you need to define _REENTRANT

try to add that to your CFLAGS or CCFLAGS in your Makefile. for gcc -D_REENTRANT, for cc -Ae -D_REENTRANT.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Bill McNAMARA_1
Honored Contributor

Re: error compiling lftp 3.0.3

got different errors compiling after changing the make file to -D_IFORGET.. but in either case it seems to work with the earlier strtok suggestions... I tried a simple test and all was fine.. I'll leave it to the others to test if they've got all the functionality they want with this hack! Thanks all, that would have kept me up for hours!
It works for me (tm)
Bill McNAMARA_1
Honored Contributor

Re: error compiling lftp 3.0.3

above code change
It works for me (tm)