-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V8-7.4.288 is missing libtorque_base.a #43
Comments
2c1d8d6 Fixed. |
That unfortunately doesn't fix it. I used a similar fix to see if it would work without that particular lib. Compiling android for arm64 first resulted in a bunch of errors like these
which can be fixed with prepending void to each setting operation eg.
and a few const L char const casts to fix L use in android compile chain. These fixes can be found here (getnamo@baacac7), pull #44 That then brings the issue to the linker which stops with
Which is where I'm currently hitting a roadblock. Some possible follow ups: stack overflow similar question: https://stackoverflow.com/questions/55254088/malformed-archive-while-compiling-v8, google groups: https://groups.google.com/forum/#!topic/v8-users/WH_Az7NRG2k Hints at maybe the libs were compiled are the 'thin' variant when they should be standalone/full type? What's your pipeline for compiling the android variants for v8? Edit update: Looking at the file sizes compared to win64, mac, and iOS, the Linux and Android libs seem much much smaller in size (5MB Android vs 618MB win64 vs 2GB for iOS). It does hint at libs being compiled as a thin archive. Another link about building v8 for android on e.g. linux (https://gist.github.com/magmastonealex/a9158173828932def9ffb81672d6c578) |
Btw compiling for armv7 instead of arm64 gives these errors
and a ton of
Not sure if the more verbose errors points to this being a armv7 lib with missing links or arm64 lib built incorrectly (thin variant?). Edit update: likely thin arm64 archive variant problem, see previous comment. |
I had same thin archive problem. After I removed thin archive option, there were bunch of link errors implying that stdlib is mismatching. Actually UE4 still uses libstdc++ on Android but v8 uses only libc++. Now I am trying to modify v8 build config to force using libstdc++. |
I managed to get it compiled and linked successfully, but still there is runtime crash during class exposure. Here is my configuration and code modifications(arm64 only).
diff --git a/config/android/BUILD.gn b/config/android/BUILD.gn
index b69d42b..1c4562e 100644
--- a/config/android/BUILD.gn
+++ b/config/android/BUILD.gn
@@ -105,9 +105,17 @@ config("runtime_library") {
# arm-linux-androideabi-4.4.3 toolchain (circa Gingerbread) will exhibit
# strange errors. The include ordering here is important; change with
# caution.
- cflags_cc = [ "-isystem" +
- rebase_path("$android_ndk_root/sources/android/support/include",
- root_build_dir) ]
+ cflags_cc = [
+ "-isystem" +
+ rebase_path("$android_ndk_root/sources/android/support/include",
+ root_build_dir),
+ "-isystem" +
+ rebase_path("$android_ndk_root/sources/cxx-stl/gnu-libstdc++/4.9/include",
+ root_build_dir),
+ "-isystem" +
+ rebase_path("$android_ndk_root/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/include",
+ root_build_dir),
+ ]
defines = [
"__GNU_SOURCE=1", # Necessary for clone().
diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn
index 402dac4..14a5a81 100644
--- a/config/compiler/BUILD.gn
+++ b/config/compiler/BUILD.gn
@@ -1456,7 +1456,8 @@ config("default_warnings") {
# Don't warn about "maybe" uninitialized. Clang doesn't include this
# in -Wall but gcc does, and it gives false positives.
- cflags += [ "-Wno-maybe-uninitialized" ]
+ # cflags += [ "-Wno-maybe-uninitialized" ]
+ cflags += [ "-Wno-uninitialized" ]
cflags += [ "-Wno-deprecated-declarations" ]
# -Wcomment gives too many false positives in the case a
@@ -1709,7 +1710,7 @@ config("thin_archive") {
# have a "thin archive" mode (it does accept -T, but it means truncating
# archive names to 16 characters, which is not what we want).
if ((is_posix && !is_nacl && !is_mac && !is_ios) || is_fuchsia) {
- arflags = [ "-T" ]
+ # arflags = [ "-T" ]
} else if (is_win && use_lld) {
arflags = [ "/llvmlibthin" ]
} These build script modifications cause some compile errors but you can easily fix them except |
Please update to https://github.com/ncsoft/Unreal.js/wiki/V8 :) |
I'd like to, but I should resolve existing runtime and other problems before posting whole solution. I think it takes some time... |
@nullbus got a link to the libstd++ build of v8 for arm64? I wouldn't mind looking into the runtime crashes to see if I can't help you identify what's missing. Also do we know if v8 has to be jitless for android? https://v8.dev/blog/jitless, or is this not an issue? |
@getnamo I couldn't take this issue recently because of my business. I returned to this end of the week. If you want you can build libstdc++ version with modifications I mentioned above. jitless mode is necessary for iOS, because it forbids writing on execution memory. I think jit would be working on most of Android devices. |
Here is updated modification. diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn
index 9e843f3..6e718e1 100644
--- a/config/BUILDCONFIG.gn
+++ b/config/BUILDCONFIG.gn
@@ -438,7 +438,6 @@ default_compiler_configs = [
"//build/config/compiler:no_exceptions",
"//build/config/compiler:no_rtti",
"//build/config/compiler:runtime_library",
- "//build/config/compiler:thin_archive",
"//build/config/coverage:default_coverage",
"//build/config/sanitizers:default_sanitizer_flags",
]
diff --git a/config/android/BUILD.gn b/config/android/BUILD.gn
index b69d42b..c2c0897 100644
--- a/config/android/BUILD.gn
+++ b/config/android/BUILD.gn
@@ -27,6 +27,9 @@ config("compiler") {
# Forces full rebuilds on NDK rolls. To rebuild everything when NDK version
# stays the same, increment the suffix number.
"ANDROID_NDK_VERSION_ROLL=${android_ndk_version}_1",
+ "_GLIBCXX_USE_C99=1",
+ "_GLIBCXX_HAVE_WCSTOF=1",
+ "_GLIBCXX_USE_C99_MATH_TR1=1",
]
if (current_cpu == "mips64el") {
@@ -109,6 +112,26 @@ config("runtime_library") {
rebase_path("$android_ndk_root/sources/android/support/include",
root_build_dir) ]
+ if (current_cpu == "arm") {
+ cflags_cc += [
+ "-isystem" +
+ rebase_path("$android_ndk_root/sources/cxx-stl/gnu-libstdc++/4.9/include",
+ root_build_dir),
+ "-isystem" +
+ rebase_path("$android_ndk_root/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include",
+ root_build_dir),
+ ]
+ } else if (current_cpu == "arm64") {
+ cflags_cc += [
+ "-isystem" +
+ rebase_path("$android_ndk_root/sources/cxx-stl/gnu-libstdc++/4.9/include",
+ root_build_dir),
+ "-isystem" +
+ rebase_path("$android_ndk_root/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/include",
+ root_build_dir),
+ ]
+ }
+
defines = [
"__GNU_SOURCE=1", # Necessary for clone().
"CHROMIUM_CXX_TWEAK_INLINES", # Saves binary size.
diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn
index 402dac4..ee3015a 100644
--- a/config/compiler/BUILD.gn
+++ b/config/compiler/BUILD.gn
@@ -1456,7 +1456,7 @@ config("default_warnings") {
# Don't warn about "maybe" uninitialized. Clang doesn't include this
# in -Wall but gcc does, and it gives false positives.
- cflags += [ "-Wno-maybe-uninitialized" ]
+ cflags += [ "-Wno-uninitialized" ]
cflags += [ "-Wno-deprecated-declarations" ]
# -Wcomment gives too many false positives in the case a With this edit, you don't have to change any other source code. But still I have runtime assertion failure. And here is a link if you want to try on your project(arm64 only for now). |
Anyway, it works well with non-debug library. I build it with ubuntu 16.04 image in docker and 7.4.288.28 version of v8. Here is it: But I noticed |
FYI V8-7.7.299 libs provided are still the thin variant types and will need to be updated with @nullbus script. From the looks of the lib sizes and compile tests this still affects both linux and android builds and returns with |
@nullbus. I also encountered the same problem, your solution doesn't work to my situation, btw my v8 version is 7.4.288, which version you used? |
I made a patch build for 4.23-android which uses the older 7.4.288 that nullbus shared: https://github.com/getnamo/Unreal.js-core/tree/UE4.23-V8-7.4.288 Hope it can be useful until we get the 7.7.299 android build working. |
@cooperkuo Which problem do you have? If it is runtime crash with binaries that I uploaded, it should be replaced to fixed one. With pure V8 source, it needs one more fix like below: diff --git a/src/api.cc b/src/api.cc
index 704c46aa68..33725e980f 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1347,7 +1347,7 @@ void Template::Set(v8::Local<Name> name, v8::Local<Data> value,
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
i::HandleScope scope(isolate);
auto value_obj = Utils::OpenHandle(*value);
- CHECK(!value_obj->IsJSReceiver() || value_obj->IsTemplateInfo());
+ // CHECK(!value_obj->IsJSReceiver() || value_obj->IsTemplateInfo());
if (value_obj->IsObjectTemplateInfo()) {
templ->set_serial_number(i::Smi::kZero);
if (templ->IsFunctionTemplateInfo()) { I believe that ncsoft's modified V8 already has that fix. |
BTW the company that I am working recently released a game which uses UnrealJS. I tried to use as higher v8 version as I could, but I had frequent crashes for Android at 7.7 and 7.6 version of v8. I couldn't figure out what's the problem. I am using 7.4 version now. |
@nullbus. The problem is a compile-time error, but the v8 source I use is the pure one (from google), which is version 7.4.288. Maybe different versions of source code (google's or ncsoft's) cause problems in different way. The binaries you uploaded work perfectly for me, I have not encountered the runtime problem you mentioned. So I want to re-build libraries by myself with the solution you shared. My gn configuration is same with yours: $ cat out/arm-release/args.gn
v8_use_external_startup_data = false
v8_use_snapshot = false
v8_enable_i18n_support = false
is_debug = false
v8_static_library = true
is_component_build = false
target_os = "android"
target_cpu = "arm"
v8_target_cpu = "arm"
use_custom_libcxx = false
use_custom_libcxx_for_host = true I compile by this command, of course the libraries it produces ain't complete, I think that is so called "thin_archive problem":
My thin_archive problem is solved when I do such modification: diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn
index f89e7e831..9825d6b80 100644
--- a/config/BUILDCONFIG.gn
+++ b/config/BUILDCONFIG.gn
@@ -434,7 +434,7 @@ default_compiler_configs = [
"//build/config/compiler:no_exceptions",
"//build/config/compiler:no_rtti",
"//build/config/compiler:runtime_library",
- "//build/config/compiler:thin_archive",
+ # "//build/config/compiler:thin_archive",
"//build/config/compiler:default_init_stack_vars", Now problems come. If I'm right, I should now modify
So I directly compile v8 libraries (no compile time errors), then I encountered "a ton of undefined reference errors" when I embeded these libraries to Unreal Engine, this is one piece of them: Then I copy Can you tell my which v8 source you used when compiled your posted v8 libraries (google's or ncsoft's), and the version of android ndk? It's okay even if you used ncsoft's v8 source, I will try that one later, but it will be very nice if you have any idea to the problems I encountered 😄 |
@cooperkuo did you run And I built them from pure v8 source from Google. |
@nullbus It works! After checking out 7.4.288 release and running |
What is this game name? Would be interesting to see any game using UnrealJS in production |
One of published game using UnrealJS is 9M Pro Baseball but I'm not sure it is available outside Korea. But it also have Taiwan version. Most of UI code(UMG) is written in Typescript and it supports Android iOS, and Windows. |
https://github.com/ncsoft/Unreal.js-core/releases/tag/V8-7.4.288 (and 4.22 marketplace build) is missing libtorque_base.a for android (and iOS), but it's still referenced in the android build.cs section causing a linking error, what's the best way to build or download this file?
The V8 module is also not whitelisted so it will not get compiled and it will show up as missing when trying to load a script via Javascript Component on device.
The text was updated successfully, but these errors were encountered: