我正在尝试使用 low_memory.yaml 配置文件构建 duktape,并启用指针压缩选项。具体来说,我取消了以下几行的注释:
DUK_USE_STRTAB_PTRCOMP: true # sometimes useful with pointer compression
DUK_USE_REFCOUNT16: true
DUK_USE_REFCOUNT32: false
DUK_USE_STRHASH16: true
DUK_USE_STRLEN16: true
DUK_USE_BUFLEN16: true
DUK_USE_OBJSIZES16: true
DUK_USE_HSTRING_CLEN: false
DUK_USE_HSTRING_LAZY_CLEN: false
DUK_USE_HOBJECT_HASH_PART: false
DUK_USE_HEAPPTR16
DUK_USE_HEAPPTR_DEC16
DUK_USE_HEAPPTR_ENC16
其余行保持不变。当我像这样使用 python 实用程序时:
python tools/configure.py --output-directory ~/duktape-src/low_mem_t --option-file config/examples/low_memory_t1.yaml
我有很多例外:
Traceback (most recent call last):
File "/home/pi/duktape-2.2.1/tools/genconfig.py", line 1522, in <module>
main()
File "/home/pi/duktape-2.2.1/tools/genconfig.py", line 1519, in main
genconfig(opts, args)
File "/home/pi/duktape-2.2.1/tools/genconfig.py", line 1498, in genconfig
result, active_opts = generate_duk_config_header(opts, meta_dir)
File "/home/pi/duktape-2.2.1/tools/genconfig.py", line 970, in generate_duk_config_header
forced_opts = get_forced_options(opts)
File "/home/pi/duktape-2.2.1/tools/genconfig.py", line 795, in get_forced_options
doc = yaml.load(StringIO(val))
File "/home/pi/.local/lib/python2.7/site-packages/yaml/__init__.py", line 71, in load
return loader.get_single_data()
File "/home/pi/.local/lib/python2.7/site-packages/yaml/constructor.py", line 37, in get_single_data
node = self.get_single_node()
File "/home/pi/.local/lib/python2.7/site-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/home/pi/.local/lib/python2.7/site-packages/yaml/composer.py", line 55, in compose_document
node = self.compose_node(None, None)
File "/home/pi/.local/lib/python2.7/site-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/home/pi/.local/lib/python2.7/site-packages/yaml/composer.py", line 127, in compose_mapping_node
while not self.check_event(MappingEndEvent):
File "/home/pi/.local/lib/python2.7/site-packages/yaml/parser.py", line 98, in check_event
self.current_event = self.state()
File "/home/pi/.local/lib/python2.7/site-packages/yaml/parser.py", line 428, in parse_block_mapping_key
if self.check_token(KeyToken):
File "/home/pi/.local/lib/python2.7/site-packages/yaml/scanner.py", line 115, in check_token
while self.need_more_tokens():
File "/home/pi/.local/lib/python2.7/site-packages/yaml/scanner.py", line 149, in need_more_tokens
self.stale_possible_simple_keys()
File "/home/pi/.local/lib/python2.7/site-packages/yaml/scanner.py", line 289, in stale_possible_simple_keys
"could not find expected ':'", self.get_mark())
yaml.scanner.ScannerError: while scanning a simple key
in "<file>", line 85, column 1
could not find expected ':'
in "<file>", line 86, column 1
Traceback (most recent call last):
File "tools/configure.py", line 993, in <module>
main()
File "tools/configure.py", line 605, in main
exec_print_stdout(cmd)
File "tools/configure.py", line 60, in exec_print_stdout
ret = exec_get_stdout(cmd, input=input, print_stdout=True)
File "tools/configure.py", line 51, in exec_get_stdout
raise Exception('command failed, return code %d: %r' % (proc.returncode, cmd))
Exception: command failed, return code 1: ['/usr/bin/python', '/home/pi/duktape-2.2.1/tools/genconfig.py', '--output', '/tmp/tmp-duk-prepare-Xu0Jx4/duk_config.h.tmp', '--output-active-options', '/tmp/tmp-duk-prepare-Xu0Jx4/duk_config_active_options.json', '--git-commit', 'external', '--git-describe', 'external', '--git-branch', 'external', '--used-stridx-metadata', '/tmp/tmp-duk-prepare-Xu0Jx4/duk_used_stridx_bidx_defs.json.tmp', '--metadata', '/home/pi/duktape-2.2.1/config', '--option-file', '/tmp/tmp-duk-prepare-Xu0Jx4/genconfig0.yaml', 'duk-config-header']
感谢您的建议。