Tencent / xLua

xLua is a lua programming solution for C# ( Unity, .Net, Mono) , it supports android, ios, windows, linux, osx, etc.
Other
9.28k stars 2.44k forks source link

Unity2021.2.12 用demo 导出webgl报错 #969

Open dw317748627 opened 2 years ago

dw317748627 commented 2 years ago

因为要用到webgl的ASTC的图片属性 所以要使用2012.2.12 但是导出webgl失败 报错信息如下

Building Library\Bee\artifacts\WebGL\GameAssembly.\master_WebGL_wasm\u9l0_xlua_webgl.o failed with output: In file included from Assets/Plugins/WebGL/xlua_webgl.cpp:31: G:\U3DWorkSpace\TT\xLua-master\WebGLPlugins\lundump.c:237:33: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] checkliteral(S, LUA_SIGNATURE + 1, "not a"); / 1st char already checked /


G:\U3DWorkSpace\TT\xLua-master\WebGLPlugins\lundump.c:237:33: note: use array indexing to silence this warning
  checkliteral(S, LUA_SIGNATURE + 1, "not a");  /* 1st char already checked */
                                ^
                  &             [  ]
In file included from Assets/Plugins/WebGL/xlua_webgl.cpp:35:
G:\U3DWorkSpace\TT\xLua-master\WebGLPlugins\i64lib.c:409:34: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
        snprintf(temp, sizeof(temp), "%"PRIu64, n);
                                        ^

1 warning and 1 error generated.
emcc2: error: '"C:/Program Files/Unity/Hub/Editor/2021.2.12f1c1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/llvm\clang++.exe" -target wasm32-unknown-emscripten -DEMSCRIPTEN -fno-inline-functions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-cxx-exceptions -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=19 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL "--sysroot=C:\Program Files\Unity\Hub\Editor\2021.2.12f1c1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\cache\sysroot" -Xclang -iwithsysroot/include\compat -D__webgl__ -Wno-c++11-extensions -Wno-nonportable-include-path -ffunction-sections -fno-unwind-tables -fomit-frame-pointer -fno-threadsafe-statics -std=c++11 -Wno-#warnings -Wswitch -Wno-trigraphs -Wno-tautological-compare -Wno-invalid-offsetof -Wno-implicitly-unsigned-literal -Wno-integer-overflow -Wno-shift-negative-value -Wno-unknown-attributes -Wno-implicit-function-declaration -Wno-null-conversion -Wno-missing-declarations -Wno-unused-value -Wno-pragma-once-outside-header -fvisibility=hidden -fexceptions -fno-rtti -fno-strict-overflow -ffunction-sections -fdata-sections -fmessage-length=0 -pipe -DBASELIB_INLINE_NAMESPACE=il2cpp_baselib -DIL2CPP_MONO_DEBUGGER_DISABLED -DRUNTIME_IL2CPP -DHAVE_BDWGC_GC -DUNITY_WEBGL=1 -DNDEBUG -I. -IG:/U3DWorkSpace/TT/xLua-master/Library/Bee/artifacts/WebGL/il2cppOutput/cpp "-IC:/Program Files/Unity/Hub/Editor/2021.2.12f1c1/Editor/Data/il2cpp/libil2cpp/pch" "-IC:/Program Files/Unity/Hub/Editor/2021.2.12f1c1/Editor/Data/il2cpp/libil2cpp" "-IC:/Program Files/Unity/Hub/Editor/2021.2.12f1c1/Editor/Data/il2cpp/external/baselib/Include" "-IC:/Program Files/Unity/Hub/Editor/2021.2.12f1c1/Editor/Data/il2cpp/external/baselib/Platforms/WebGL/Include" -Oz -fcolor-diagnostics -fdiagnostics-absolute-paths -UGC_THREADS -UUSE_MMAP -UUSE_MUNMAP -c -xc++ Assets/Plugins/WebGL/xlua_webgl.cpp -o Library/Bee/artifacts/WebGL/GameAssembly./master_WebGL_wasm/u9l0_xlua_webgl.o' failed (1)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
qinghuifan-dm commented 2 years ago

我也是这个错误。。。

ZiJinZiMing commented 2 years ago

需要留有空格,不能挨着, https://sourcecodeartisan.com/2021/03/06/invalid-suffix-on-literal.html image

Skierhou commented 1 year ago

解决了吗

Gaobobo-C commented 4 months ago

找到WebGLPlugins/lundump.c 第237行,代码代码改成下面这样就可以了 checkliteral(S, &LUA_SIGNATURE[1], "not a");

报错提示是由于在 "LUA_SIGNATURE + 1" 这一表达式中进行了字符指针和整数的相加操作,这样的操作可能会导致错误,因为这不是合法的操作。这个警告意味着编译器认为您可能意图执行一个不确定的操作。解决这个问题的方法是,您可能需要明确地将 LUA_SIGNATURE 的指针与整数进行相加,然后传递给 checkliteral 函数。这可以通过使用数组索引来实现。