zlgopen / awtk-web

在浏览器中运行AWTK应用程序
GNU Lesser General Public License v2.1
24 stars 8 forks source link

awtk-web无法编译 #7

Closed Tracker647 closed 6 months ago

Tracker647 commented 6 months ago

一.安装emsdk

git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk.bat install latest
./emsdk.bat activate latest
./emsdk_env.bat

安装完成。

二. 编译 awtk 本身

git clone https://github.com/zlgopen/awtk.git
cd awtk
scons -j 8

编译完成。

三. 编译awtk-web

./build_win32.sh ../awtk/build.json debug

ignoring nonexistent directory "D:\Devtools\emsdk\upstream\emscripten\cache\sysroot/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
 src/c
 D:\Devtools\awtk-web\webroot\demoui\res
 D:\Devtools\awtk/3rd
 D:\Devtools\awtk
 D:\Devtools\awtk\src
 D:\Devtools\awtk\src/ext_widgets
 D:\Devtools\emsdk\upstream\emscripten\cache\sysroot\include\SDL2
 D:\Devtools\emsdk\upstream\emscripten\cache\sysroot/include\compat
 D:\Devtools\emsdk\upstream\lib\clang\19\include
 D:\Devtools\emsdk\upstream\emscripten\cache\sysroot/include
End of search list.
D:\Devtools\awtk\src\base\assets_manager.c:708:30: error: call to undeclared function 'assets_manager_get_system_info'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  708 |       system_info_t* sinfo = assets_manager_get_system_info(am);
      |                              ^
D:\Devtools\awtk\src\base\assets_manager.c:708:30: note: did you mean 'assets_manager_set_system_info'?
D:\Devtools\awtk\src\base\assets_manager.c:637:7: note: 'assets_manager_set_system_info' declared here
  637 | ret_t assets_manager_set_system_info(assets_manager_t* am, system_info_t* system_info) {
      |       ^
D:\Devtools\awtk\src\base\assets_manager.c:708:22: error: incompatible integer to pointer conversion initializing 'system_info_t *'
      (aka 'struct _system_info_t *') with an expression of type 'int' [-Wint-conversion]
  708 |       system_info_t* sinfo = assets_manager_get_system_info(am);
      |                      ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
emcc: error: 'D:/Devtools/emsdk/upstream/bin\clang.exe -target wasm32-unknown-emscripten -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --sysroot=D:\Devtools\emsdk\upstream\emscripten\cache\sysroot -DEMSCRIPTEN -Werror=implicit-function-declaration -isystem D:\Devtools\emsdk\upstream\emscripten\cache\sysroot\include\SDL2 -Xclang -iwithsysroot/include\compat -v -g3 -g -DSAFE_HEAP=1 -DASSERTIONS=1 -DSTACK_OVERFLOW_CHECK=1 -DWITH_DATA_READER_WRITER -DHAS_STD_MALLOC -DNDEBUG -DAWTK_WEB -Isrc/c -DWITH_WINDOW_ANIMATORS -DWITH_NANOVG_GPU -ID:\Devtools\awtk-web\webroot\demoui\res -ID:\Devtools\awtk/3rd -ID:\Devtools\awtk -ID:\Devtools\awtk\src -ID:\Devtools\awtk\src/ext_widgets D:\Devtools\awtk\src\base\assets_manager.c -c -o C:\Users\nihaoa\AppData\Local\Temp\emscripten_temp_19czmjdx\assets_manager_87.o' failed (returned 1)
D:\Devtools\awtk-web\webroot\demoui\js\app.js
[] D:\Devtools\awtk-web\webroot\demoui\js\app.js
D:\Devtools\awtk-web\webroot\demoui\js\awtk_web.js
D:\Devtools\awtk-web\webroot\demoui\assets_web.js
src/js/browser.js
gen/app_config.js
src/js/webgl2d.js
src/js/image_cache.js
src/js/assets_manager.js
src/js/image_loader.js
src/js/input_method_web.js
src/js/utils.js
src/js/edit_element.js
src/js/vgcanvas_web.js
src/js/awtk_wrap.js
src/js/key_event.js
src/js/events_source.js
src/js/main_loop_web.js

错误说是implicit function declarations,但检查assets_manager.c,assets_manager_get_system_info函数早已在调用前声明了,完全不知什么原因导致编译不通过。

我的环境: 系统:Windows10 Python: 3.8.2 64位 scons: 4.3.0 emsdk:

emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.60 (42a6ea2052f19f70d7d994e8c324bcad2f1f8939)
clang version 19.0.0git (https:/github.com/llvm/llvm-project bc9823cf60bf91cc8b45248c4205cd2c67b2a3d5)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: D:\Devtools\emsdk\upstream\bin
xianjimli commented 6 months ago

你更新一下awtk再试试。不过显示有点问题,字体偏上,我有空再看看。

xianjimli commented 6 months ago

字体问题已修改,你更新代码试试。谢谢

Tracker647 commented 6 months ago

更新awtk后编译通过了,按流程跑了一遍后成功。 我感觉大概率是那个5月17号版本的问题,因为我在公司电脑和自己家的电脑同样配置了一遍,都出现这个c文件报错的错误,但是我领导的电脑就能正常编译,然后我把领导电脑的awtk拷到我电脑上试,就通过了。 我领导电脑的awtk是今年2月28号的版本。