我在使用 Emscripten 预加载文件时做错了什么?
What I'm doing wrong with Emscripten preload-file?
我有这样的目录结构:
workfolder\
l4\
font\
Roboto-Black.ttf
sdl_font.c
当我尝试使用此命令制作 HTML 文件时
emcc l4/sdl_font.c --emrun --preload-file l4/font -s USE_SDL=2 -s USE_SDL_TTF=2 -o bin/sdl_font.html
我收到这个错误:
cache:INFO: generating port: sysroot\lib\wasm32-emscripten\libharfbuzz.a... (this will be cached in "E:\prog\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libharfbuzz.a" for subsequent builds)
root:INFO: building port: harfbuzz
configure: cmake -G "Unix Makefiles" -BE:\prog\emsdk\upstream\emscripten\cache\ports-builds\harfbuzz -HE:\prog\emsdk\upstream\emscripten\cache\ports\harfbuzz\harfbuzz-1.7.5 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=E:\prog\emsdk\upstream\emscripten\cache\ports-builds\harfbuzz -DFREETYPE_INCLUDE_DIRS=E:\prog\emsdk\upstream\emscripten\cache\sysroot\include\freetype2\freetype;E:\prog\emsdk\upstream\emscripten\cache\sysroot\include\freetype2\freetype\config -DFREETYPE_LIBRARY=E:\prog\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libfreetype.a -DHB_HAVE_FREETYPE=ON
-DCMAKE_TOOLCHAIN_FILE=E:\prog\emsdk\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR="E:/prog/emsdk/node/14.15.5_64bit/bin/node.exe"
Traceback (most recent call last):
File "E:\prog\emsdk\upstream\emscripten\emcc.py", line 3317, in <module>
sys.exit(main(sys.argv))
File "E:\prog\emsdk\upstream\emscripten\emcc.py", line 3310, in main
ret = run(args)
File "E:\prog\emsdk\upstream\emscripten\emcc.py", line 1953, in run
system_libs.add_ports_cflags(cflags, shared.Settings)
File "E:\prog\emsdk\upstream\emscripten\tools\system_libs.py", line 1855, in add_ports_cflags
port.get(Ports, settings, shared)
File "E:\prog\emsdk\upstream\emscripten\tools\ports\harfbuzz.py", line 71, in get
return [shared.Cache.get_lib(get_lib_name(settings), create, what='port')]
File "E:\prog\emsdk\upstream\emscripten\tools\cache.py", line 130, in get_lib
return self.get(name, *args, **kwargs)
File "E:\prog\emsdk\upstream\emscripten\tools\cache.py", line 158, in get
creator(cachename)
File "E:\prog\emsdk\upstream\emscripten\tools\ports\harfbuzz.py", line 64, in create
building.configure(configure_args)
File "E:\prog\emsdk\upstream\emscripten\tools\building.py", line 326, in configure
run_process(args, stdout=stdout, stderr=stderr, env=env, **kwargs)
File "E:\prog\emsdk\upstream\emscripten\tools\shared.py", line 96, in run_process
ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
File "E:\prog\zzmal\Python39\lib\subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "E:\prog\zzmal\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "E:\prog\zzmal\Python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Не удается найти указанный файл (File not found)
我尝试更改一些参数或路径,但仍然出现此错误。
我 运行 也对这个确切的问题感兴趣。这是由于 Harfbuzz 库现在是 SDL_ttf 的依赖项。 Harfbuzz 需要安装 make
。 emscripten Github 上有一个 open issue,它提出了几种解决方法:
- 等待2.0.16版本
- 使用来自 #13655
的补丁在本地修改 tools/ports/harfbuzz.py
- 在您的 Windows 机器上安装 make
我有这样的目录结构:
workfolder\
l4\
font\
Roboto-Black.ttf
sdl_font.c
当我尝试使用此命令制作 HTML 文件时
emcc l4/sdl_font.c --emrun --preload-file l4/font -s USE_SDL=2 -s USE_SDL_TTF=2 -o bin/sdl_font.html
我收到这个错误:
cache:INFO: generating port: sysroot\lib\wasm32-emscripten\libharfbuzz.a... (this will be cached in "E:\prog\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libharfbuzz.a" for subsequent builds)
root:INFO: building port: harfbuzz
configure: cmake -G "Unix Makefiles" -BE:\prog\emsdk\upstream\emscripten\cache\ports-builds\harfbuzz -HE:\prog\emsdk\upstream\emscripten\cache\ports\harfbuzz\harfbuzz-1.7.5 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=E:\prog\emsdk\upstream\emscripten\cache\ports-builds\harfbuzz -DFREETYPE_INCLUDE_DIRS=E:\prog\emsdk\upstream\emscripten\cache\sysroot\include\freetype2\freetype;E:\prog\emsdk\upstream\emscripten\cache\sysroot\include\freetype2\freetype\config -DFREETYPE_LIBRARY=E:\prog\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libfreetype.a -DHB_HAVE_FREETYPE=ON
-DCMAKE_TOOLCHAIN_FILE=E:\prog\emsdk\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR="E:/prog/emsdk/node/14.15.5_64bit/bin/node.exe"
Traceback (most recent call last):
File "E:\prog\emsdk\upstream\emscripten\emcc.py", line 3317, in <module>
sys.exit(main(sys.argv))
File "E:\prog\emsdk\upstream\emscripten\emcc.py", line 3310, in main
ret = run(args)
File "E:\prog\emsdk\upstream\emscripten\emcc.py", line 1953, in run
system_libs.add_ports_cflags(cflags, shared.Settings)
File "E:\prog\emsdk\upstream\emscripten\tools\system_libs.py", line 1855, in add_ports_cflags
port.get(Ports, settings, shared)
File "E:\prog\emsdk\upstream\emscripten\tools\ports\harfbuzz.py", line 71, in get
return [shared.Cache.get_lib(get_lib_name(settings), create, what='port')]
File "E:\prog\emsdk\upstream\emscripten\tools\cache.py", line 130, in get_lib
return self.get(name, *args, **kwargs)
File "E:\prog\emsdk\upstream\emscripten\tools\cache.py", line 158, in get
creator(cachename)
File "E:\prog\emsdk\upstream\emscripten\tools\ports\harfbuzz.py", line 64, in create
building.configure(configure_args)
File "E:\prog\emsdk\upstream\emscripten\tools\building.py", line 326, in configure
run_process(args, stdout=stdout, stderr=stderr, env=env, **kwargs)
File "E:\prog\emsdk\upstream\emscripten\tools\shared.py", line 96, in run_process
ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
File "E:\prog\zzmal\Python39\lib\subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "E:\prog\zzmal\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "E:\prog\zzmal\Python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Не удается найти указанный файл (File not found)
我尝试更改一些参数或路径,但仍然出现此错误。
我 运行 也对这个确切的问题感兴趣。这是由于 Harfbuzz 库现在是 SDL_ttf 的依赖项。 Harfbuzz 需要安装 make
。 emscripten Github 上有一个 open issue,它提出了几种解决方法:
- 等待2.0.16版本
- 使用来自 #13655 的补丁在本地修改 tools/ports/harfbuzz.py
- 在您的 Windows 机器上安装 make