|
Post by Pjot on Oct 5, 2020 17:09:47 GMT 1
Thanks gcav,
This is great progress, I can see three issues left now:
(1) the "uintptr_t" is not known, but this easily can be defined as "#define uintptr_t unsigned long" in the bacon source.
(2) the POSIX.2001 function 'strcasecmp' is unknown, this is weird as OSS claims to support POSIX.2001.
(3) the POSIX.2001 function 'setenv' is unknown, this is weird as OSS claims to support POSIX.2001.
I am kind of hoping that the 'strcasecmp' and 'setenv' errors are caused by previous errors. They should be recognized by OSS. The Porting Guide does not mention anything special about these functions.
Can you just try to run the following and see if this makes a difference (it will define uintptr_t):
# bash ./bacon.sh -c c99 -o -D__TANDEM -o -D_XOPEN_SOURCE_EXTENDED=1 -o -Duintptr_t=long -linet bacon.bac
Alternatively, maybe omit -D__TANDEM and see how this works out.
BR Peter
|
|
gcav
New Member
Posts: 34
|
Post by gcav on Oct 5, 2020 20:46:17 GMT 1
Thanks gcav, This is great progress, I can see three issues left now: (1) the "uintptr_t" is not known, but this easily can be defined as "#define uintptr_t unsigned long" in the bacon source. (2) the POSIX.2001 function 'strcasecmp' is unknown, this is weird as OSS claims to support POSIX.2001. (3) the POSIX.2001 function 'setenv' is unknown, this is weird as OSS claims to support POSIX.2001. I am kind of hoping that the 'strcasecmp' and 'setenv' errors are caused by previous errors. They should be recognized by OSS. The Porting Guide does not mention anything special about these functions. Can you just try to run the following and see if this makes a difference (it will define uintptr_t): # bash ./bacon.sh -c c99 -o -D__TANDEM -o -D_XOPEN_SOURCE_EXTENDED=1 -o -Duintptr_t=long -linet bacon.bac
Alternatively, maybe omit -D__TANDEM and see how this works out. BR Peter Hi Pete, 1) uintptr_t is defined is stdint.h as follows.. ...snip... /* * Special integer types ( */
typedef long long intmax_t; typedef unsigned long long uintmax_t;
#if defined(__NSK_OPTIONAL_TYPES__) || defined(__NSK_BOOST_VERSION__) || \ (__CPLUSPLUS_VERSION >= 4) /* * optional types intptr_t/uintptr_t */
typedef long intptr_t; typedef unsigned long uintptr_t;
#endif /* defined(__NSK_OPTIONAL_TYPES__) || defined(__NSK_BOOST_VERSION__)|| \ (__CPLUSPLUS_VERSION >= 4) */ ...snip...
I saw stdint.h in bacon.bac.generic.h. I wonder is the __TANDEM define triggering __NSK_OPTIONAL_TYPES? 3) Setenv is Putenv() for OSS.. Similary we have getenv() <stdlib.h> int putenv ( const char *string ) ; eg; string is "name=value" 2) as for strcasecmp. it is in <strings.h> -- I treid to recompile with the added -Duint... define, to no different effect. The __TANDEM define is required, as it triggers mutliple IFDEFS in all the includes around. gc
|
|
|
Post by Pjot on Oct 6, 2020 8:56:43 GMT 1
Thanks gcav,
(1) the code snippet from <stdint.h> shows that 'uitptr_t' is available when __NSK_OPTIONAL_TYPES__ is defined (the other macros are for C++).
So the new compile line would be:
# bash ./bacon.sh -c c99 -o -D__TANDEM -o -D_XOPEN_SOURCE_EXTENDED=1 -o -D__NSK_OPTIONAL_TYPES__ -linet bacon.bac
I am not sure about the -D__TANDEM, maybe we can omit it.
(2) the 'strcasecmp' is an interesting find, to be as portable as possible BaCon only includes <string.h> (without an 's') and therefore OSS cannot find it. This usually works, but other C compilation environments apparently have issues.
However, it would just be a matter of adding the include using the '-i' option of BaCon. So then the command line then would be:
bash ./bacon.sh -c c99 -i strings.h -o -D__TANDEM -o -D_XOPEN_SOURCE_EXTENDED=1 -o -D__NSK_OPTIONAL_TYPES__ -linet bacon.bac
(3) I can change 'setenv' to 'putenv', but to make things work for now, can you please comment lines 33 and 9779 in 'bacon.bac' (the SETENVIRONMENT statements)? This will prevent 'setenv' to occur in the generated source code.
-------
So with that last command line mentioned in (2), I am curious if compilation succeeds. If so, then I can start adapting the 'configure' scripts to make sure all works in the next package.
Also, can you send me the output of the command line tool 'uname'?
Thanks again, Peter
|
|
gcav
New Member
Posts: 34
|
Post by gcav on Oct 7, 2020 16:03:47 GMT 1
P: I tried with again with: /users/gus/bacon_trunk/build: c99 -Wnowarn -Werrors=10 -D__TANDEM -D_XOPEN_SOURCE_EXTENDED=1 -Wextensions -D__NSK_OPTIONAL_TYPES__ -c bacon.bac.c The __TANDEM defined is required as this one triggers all conditional compiling in the header files. Let me look at sending u the whole include files. Using the __NSK_OPTIONAL define triggers a set of different errors, /users/gus/bacon_trunk/build: c99 -Wnowarn -Werrors=10 -D__TANDEM -D_XOPEN_SOURCE_EXTENDED=1 -Wextensions -D__NSK_OPTIONAL_TYPES__ -c bacon.bac.c /* Portions of this code based on Bob Trower's C implementation at http://base64.sourceforge.net - MIT licensed */ static const char cd64[]="|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq"; ^ "/users/gus/bacon_trunk/build/bacon.bac.functions.h", line 455: error(236): variable "cd64" has already been initialized
static const char cb64[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static void __b2c__encodeblock(unsigned char *in, unsigned char *out, int len) ^ "/users/gus/bacon_trunk/build/bacon.bac.functions.h", line 456: error(236): variable "cb64" has already been initialized
static const char cb64[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static void __b2c__encodeblock(unsigned char *in, unsigned char *out, int len) ^ "/users/gus/bacon_trunk/build/bacon.bac.functions.h", line 456: error(328): function "__b2c__encodeblock" has already been defined
char * __b2c__b64enc (char* src, int len) { long idx; unsigned char in[4], out[4]; int i, j, cur = 0, posit = 0; if (src == NULL) { return (EmptyString); } ^ "/users/gus/bacon_trunk/build/bacon.bac.functions.h", line 459: error(328): function "__b2c__b64enc" has already been defined
static void __b2c__decodeblock(unsigned char in[4], unsigned char out[3]) { out[0] = (unsigned char ) (in[0] << 2 | in[1] >> 4); out[1] = (unsigned char)(in[1] << 4 | in[2] >> 2); ^ "/users/gus/bacon_trunk/build/bacon.bac.functions.h", line 464: error(328): function "__b2c__decodeblock" has already been defined
char *__b2c__b64dec(int l, char *k, char *src) { long idx; unsigned char in[4], out[3], v; int i = 0, stlen, dec_len, len, cur = 0, posit = 0; if(src == NULL){ return (EmptyString); } ^ "/users/gus/bacon_trunk/build/bacon.bac.functions.h", line 466: error(328): function "__b2c__b64dec" has already been defined
unsigned long __b2c__bit(long x) { return(x ? 2<<(x-1) : 1); } unsigned long __b2c__rol(int type, long x) ^ "/users/gus/bacon_trunk/build/bacon.bac.functions.h", line 472: error(328): function "__b2c__bit" has already been defined
unsigned long __b2c__bit(long x) { return(x ? 2<<(x-1) : 1); } unsigned long __b2c__rol(int type, long x) ^ "/users/gus/bacon_trunk/build/bacon.bac.functions.h", line 472: error(328): function "__b2c__rol" has already been defined
unsigned long __b2c__ror(int type, long x) { return((x)&1 ? (((x)>>1)&lrint(pow(2, type*8)-1))|lrint(pow(2, type*8-1)) : ((x)>>1)&lrint(pow(2, type*8)-1)); } ^ "/users/gus/bacon_trunk/build/bacon.bac.functions.h", line 474: error(328): function "__b2c__ror" has already been defined
char *__b2c__bin(int type, long x) { long idx, i; idx = __sbuf_malloc_handle (type*8+1); for(i = 0; i<type*8; i++) ^ "/users/gus/bacon_trunk/build/bacon.bac.functions.h", line 475: error(328): function "__b2c__bin" has already been defined
Error limit reached. 10 errors detected in the compilation of "bacon.bac.c". Compilation terminated.
As for the uname, it is: NONSTOP_KERNEL ns3x L20 05 NSX-G NSX NSX-G NonStop Kernel I'm attaching a config.guess and config.sub that work for Nonstop. I am also attaching a include files that seems to help in converting/porting some functions from open source code to Tandem. g Attachments:config.guess.txt (47.79 KB)
config.sub.txt (33.27 KB)
floss.h (29.87 KB)
|
|
|
Post by Pjot on Oct 8, 2020 19:51:23 GMT 1
Thanks gcav, Regarding that D__NSK_OPTIONAL_TYPES__ macro, weird the compiler starts complaining about the prototypes of internal functions. I guess it should be left out and we need to define 'uintptr_t' separately. The 'floss.h' header looks very promising, it contains 'setenv' which is far more flexible and does not leak any memory (like 'putenv'). Unfortunately it does not define 'uintptr_t'. Also I am not sure if we need an additional linking flag, like '-lfloss' or so. The Porting Guide mentions the Free Library for OSS on page 82, just noting its support for memory maps. Unfortunately I could not find more information about FLOSS, the Internet Archive could not help me further either. It's been a week now and looking at the last results, I am not sure how to continue... again, if you are aware of a VM or a freely accessible test environment using HP NonStop then this might speed up the process. Best regards Peter
|
|