I faced a problem on Solaris 11.4 Sparc, tested with vanilla duktape:
cat program.js
alert( 'Hello, world!' );
Compile duk binary without any options, or with -DDUK_USE_BYTEORDER=3:
$ make -f Makefile.cmdline
gcc -o duk -Os -pedantic -std=c99 -Wall -fstrict-aliasing -fomit-frame-pointer -I./examples/cmdline -I./src -DDUK_CMDLINE_PRINTALERT_SUPPORT -I./extras/print-alert -DDUK_CMDLINE_CONSOLE_SUPPORT -I./extras/console -DDUK_CMDLINE_LOGGING_SUPPORT -I./extras/logging -DDUK_CMDLINE_MODULE_SUPPORT -I./extras/module-duktape src/duktape.c examples/cmdline/duk_cmdline.c extras/print-alert/duk_print_alert.c extras/console/duk_console.c extras/logging/duk_logging.c extras/module-duktape/duk_module_duktape.c -lm
duk_bi_date_unix.c: In function 'duk_bi_date_get_local_tzoffset_gmtime':
duk_bi_date_unix.c:138:9: warning: implicit declaration of function 'gmtime_r'; did you mean 'ctime_r'? [-Wimplicit-function-declaration]
duk_bi_date_unix.c:139:9: warning: implicit declaration of function 'localtime_r'; did you mean 'localtime'? [-Wimplicit-function-declaration]
duk_bi_date_unix.c: In function 'duk_bi_date_parse_string_strptime':
duk_bi_date_unix.c:215:6: warning: implicit declaration of function 'strptime'; did you mean 'strftime'? [-Wimplicit-function-declaration]
duk_bi_date_unix.c:215:46: warning: comparison between pointer and integer
$ ./duk -c /tmp/program.bin program.js
$ ./duk -b /tmp/program.bin
TypeError: invalid bytecode
at [anon] (duk_api_bytecode.c:742) internal
error in executing file /tmp/program.bin
Compile duk binary with -DDUK_USE_BYTEORDER=1:
$ make -f Makefile.cmdline
gcc -o duk -Os -pedantic -std=c99 -Wall -fstrict-aliasing -fomit-frame-pointer -DDUK_USE_BYTEORDER=1 -I./examples/cmdline -I./src -DDUK_CMDLINE_PRINTALERT_SUPPORT -I./extras/print-alert -DDUK_CMDLINE_CONSOLE_SUPPORT -I./extras/console -DDUK_CMDLINE_LOGGING_SUPPORT -I./extras/logging -DDUK_CMDLINE_MODULE_SUPPORT -I./extras/module-duktape src/duktape.c examples/cmdline/duk_cmdline.c extras/print-alert/duk_print_alert.c extras/console/duk_console.c extras/logging/duk_logging.c extras/module-duktape/duk_module_duktape.c -lm
duk_bi_date_unix.c: In function 'duk_bi_date_get_local_tzoffset_gmtime':
duk_bi_date_unix.c:138:9: warning: implicit declaration of function 'gmtime_r'; did you mean 'ctime_r'? [-Wimplicit-function-declaration]
duk_bi_date_unix.c:139:9: warning: implicit declaration of function 'localtime_r'; did you mean 'localtime'? [-Wimplicit-function-declaration]
duk_bi_date_unix.c: In function 'duk_bi_date_parse_string_strptime':
duk_bi_date_unix.c:215:6: warning: implicit declaration of function 'strptime'; did you mean 'strftime'? [-Wimplicit-function-declaration]
duk_bi_date_unix.c:215:46: warning: comparison between pointer and integer
$ ./duk -c /tmp/program.bin program.js
$ ./duk -b /tmp/program.bin
Hello, world!
Hello,
I faced a problem on Solaris 11.4 Sparc, tested with vanilla duktape:
cat program.js alert( 'Hello, world!' );
Compile duk binary without any options, or with -DDUK_USE_BYTEORDER=3:
Compile duk binary with -DDUK_USE_BYTEORDER=1:
-DDUK_USE_BYTEORDER with "1" is for little endian, "3" is for big endian. https://wiki.duktape.org/configoptions
I understand Spare processor is big endian, so I expected "3" is a suitable option for Sparc. The behavior is expected result?