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

Add support for mips64el #11208

Merged
merged 16 commits into from Nov 24, 2017

Conversation

Projects
None yet
3 participants
@zcbenz
Contributor

zcbenz commented Nov 22, 2017

To build:

env LIBCHROMIUMCONTENT_MIRROR=https://s3.amazonaws.com/gh-contractor-zcbenz/libchromiumcontent ./script/bootstrap.py -v -d --target_arch mips64el
./script/build.py -c D

zcbenz added some commits Nov 21, 2017

Add CI job for mips64el
Note that our CI server is not ready for mips64el yet, so the binaries
of libcc are not available yet. Currently it is downloading the binaries
created by me manually, we should redirect to the official mirror before
merging this PR.

@zcbenz zcbenz requested review from electron/browserview as code owners Nov 22, 2017

zcbenz added some commits Nov 22, 2017

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Nov 22, 2017

@ClarkWang-2013 It looks like that the sysroot image still lacks some necessary dependencies, but unfortunately the linker can not list all missing ones at one time.

Can you checkout this branch and build it, and then add all missing dependencies to the sysroot image? You can find build steps above, and the sysroot image is downloaded to vendor/debian_jessie_mips64-sysroot.

@ClarkWang-2013

This comment has been minimized.

ClarkWang-2013 commented Nov 22, 2017

@zcbenz ok. I try it.

@ClarkWang-2013

This comment has been minimized.

ClarkWang-2013 commented Nov 22, 2017

@zcbenz I encountered a very troublesome problem。Recently, domestic visits to foreign are more stringent,even googlesource.com also can't visit, So I try it and occur errors as follows:

Submodule path 'vendor/breakpad': checked out '82f0452e6b687b3c1e14e08d172b2f3fb79ae91a'
Submodule 'src' (https://chromium.googlesource.com/breakpad/breakpad/src) registered for path 'src'
Cloning into 'src'...
fatal: unable to access 'https://chromium.googlesource.com/breakpad/breakpad/src/': Failed to connect to chromium.googlesource.com port 443: Connection timed out
fatal: clone of 'https://chromium.googlesource.com/breakpad/breakpad/src' into submodule path 'src' failed
Failed to recurse into submodule path 'vendor/breakpad'

For the time being I have no better way to solve this problem,If convenient, can you pack the code and push somewhere I upload.

Thanks!

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Nov 22, 2017

@ClarkWang-2013 Hmm bootstrapping step also requires downloading some large archives, so uploading only the source code would not be enough.

Can you add following dependencies to sysroot image, and I'll try it on my side:
libp11-kit.so.0, libtspi.so.1, libtasn1.so.6, libnettle.so.4, libhogweed.so.2, libgmp.so.10

@ClarkWang-2013

This comment has been minimized.

ClarkWang-2013 commented Nov 22, 2017

@zcbenz update sysroot complete, look at https://github.com/ClarkWang-2013/Sysroot

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Nov 22, 2017

@ClarkWang-2013 Thanks, I'm now meeting following missing dependencies:
libcrypto.so.10, libssl.so.10,

@ClarkWang-2013

This comment has been minimized.

ClarkWang-2013 commented Nov 22, 2017

@zcbenz Extract more trouble everytime, So I push libraries you need to github, and you can push them into the debian_jessie_mips64-sysroot/ corresponding directory.
Thanks!

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Nov 22, 2017

@ClarkWang-2013 I now get no more linking errors, thanks for your help! I'll provide prebuilt binaries tomorrow so you can test whether it works or not.

@ClarkWang-2013

This comment has been minimized.

ClarkWang-2013 commented Nov 22, 2017

@zcbenz ok

zcbenz added some commits Nov 22, 2017

Fix creating dist for mips64el
Note that dump_syms can not parse mips64 binaries, so we don't have
symbols archive for mips64 arch.
@zcbenz

This comment has been minimized.

@ClarkWang-2013

This comment has been minimized.

ClarkWang-2013 commented Nov 23, 2017

@zcbenz it doesn't work.
run electron occurs Segmentation fault, I run with gdb found:
Program received signal SIGSEGV, Segmentation fault from libnode.so

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Nov 23, 2017

@ClarkWang-2013 Can you replace electron and libnode.so with the ones in this archive, and paste the stack trace? https://s3.amazonaws.com/gh-contractor-zcbenz/tmp/electron_libnode.7z

@ClarkWang-2013

This comment has been minimized.

ClarkWang-2013 commented Nov 23, 2017

@zcbenz

Starting program: /home/loongson/electron_libnode/electron
Missing separate debuginfos, use: debuginfo-install glibc-2.20-14.fc21.loongson.9.mips64el
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0xffec11ae80 (LWP 1888)]
Detaching after fork from child process 1895.

Program received signal SIGSEGV, Segmentation fault.
0x000000fff6e374b8 in NoBarrier_Store (value=0, ptr=0xf) at ../../v8/src/base/atomicops_internals_portable.h:153
153     ../../v8/src/base/atomicops_internals_portable.h: 没有那个文件或目录.
Missing separate debuginfos, use: debuginfo-install alsa-lib-1.0.28-2.fc21.loongson.mips64el atk-2.14.0-1.fc21.loongson.mips64el avahi-libs-0.6.31-30.fc21.loongson.1.mips64el bzip2-libs-1.0.6-14.fc21.loongson.mips64el cairo-1.13.1-0.4.git337ab1f.fc21.loongson.mips64el cups-libs-1.7.5-13.fc21.loongson.mips64el dbus-libs-1.8.6-3.fc21.loongson.mips64el elfutils-libelf-0.160-1.fc21.loongson.mips64el elfutils-libs-0.160-1.fc21.loongson.mips64el expat-2.1.0-10.fc21.loongson.mips64el flac-libs-1.3.0-5.fc21.loongson.mips64el fontconfig-2.11.1-5.fc21.loongson.mips64el freetype-2.5.3-11.fc21.loongson.mips64el gdk-pixbuf2-2.31.1-1.fc21.loongson.mips64el glib2-2.42.1-1.fc21.loongson.1.mips64el gmp-6.0.0-8.fc21.loongson.1.mips64el gnutls-3.3.10-1.fc21.loongson.mips64el graphite2-1.2.4-4.fc21.loongson.1.mips64el gsm-1.0.13-12.fc21.loongson.mips64el gtk-murrine-engine-0.98.2-7.fc21.loongson.mips64el gtk2-2.24.25-2.fc21.loongson.2.mips64el harfbuzz-0.9.34-1.fc21.loongson.mips64el json-c-0.12-5.fc21.loongson.mips64el keyutils-libs-1.5.9-4.fc21.loongson.mips64el krb5-libs-1.12.2-10.fc21.loongson.1.mips64el libICE-1.0.9-3.fc21.loongson.1.mips64el libSM-1.2.2-2.fc21.loongson.mips64el libX11-1.6.2-2.fc21.loongson.mips64el libXScrnSaver-1.2.2-8.fc21.loongson.mips64el libXau-1.0.8-4.fc21.loongson.mips64el libXcomposite-0.4.4-6.fc21.loongson.mips64el libXcursor-1.1.14-4.fc21.loongson.mips64el libXdamage-1.1.4-6.fc21.loongson.mips64el libXdmcp-1.1.1-7.fc21.loongson.mips64el libXext-1.3.3-2.fc21.loongson.mips64el libXfixes-5.0.1-4.fc21.loongson.mips64el libXi-1.7.4-2.fc21.loongson.mips64el libXinerama-1.1.3-4.fc21.loongson.mips64el libXrandr-1.4.2-2.fc21.loongson.mips64el libXrender-0.9.8-4.fc21.loongson.mips64el libXtst-1.2.2-4.fc21.loongson.mips64el libXxf86vm-1.1.3-4.fc21.loongson.mips64el libasyncns-0.8-8.fc21.loongson.mips64el libattr-2.4.47-9.fc21.loongson.mips64el libbsd-0.6.0-4.fc21.loongson.mips64el libcap-2.24-8.fc21.loongson.1.mips64el libcom_err-1.42.11-4.fc21.loongson.mips64el libdrm-2.4.65-1.fc21.loongson.mips64el libffi-3.1-7.fc21.loongson.1.mips64el libgcc-4.9.3-6.fc21.loongson.6.mips64el libgcrypt-1.6.1-7.fc21.loongson.mips64el libgpg-error-1.13-3.fc21.loongson.mips64el libogg-1.3.0-8.fc21.loongson.mips64el libpng-1.6.17-2.fc21.loongson.2.mips64el libselinux-2.3-5.fc21.loongson.mips64el libsndfile-1.0.25-12.fc21.loongson.mips64el libstdc++-4.9.3-6.fc21.loongson.6.mips64el libtasn1-4.2-1.fc21.loongson.mips64el libuuid-2.25.2-1.fc21.loongson.mips64el libvorbis-1.3.4-3.fc21.loongson.mips64el libwayland-client-1.6.0-1.fc21.loongson.mips64el libwayland-server-1.6.0-1.fc21.loongson.mips64el libxcb-1.11-2.fc21.loongson.mips64el libxshmfence-1.1-3.fc21.loongson.mips64el mesa-libEGL-11.1.0-5.20151218.fc21.loongson.4.mips64el mesa-libGL-11.1.0-5.20151218.fc21.loongson.4.mips64el mesa-libgbm-11.1.0-5.20151218.fc21.loongson.4.mips64el mesa-libglapi-11.1.0-5.20151218.fc21.loongson.4.mips64el nettle-2.7.1-5.fc21.loongson.mips64el nspr-4.10.8-2.fc21.loongson.1.mips64el nss-3.18.0-2.fc21.loongson.1.mips64el nss-softokn-freebl-3.18.0-1.fc21.loongson.mips64el nss-util-3.18.0-2.fc21.loongson.1.mips64el openssl-libs-1.0.1j-2.fc21.loongson.1.mips64el p11-kit-0.22.1-1.fc21.loongson.mips64el pango-1.36.8-1.fc21.loongson.mips64el pcre-8.35-7.fc21.loongson.mips64el pixman-0.32.6-7.fc21.loongson.2.mips64el pulseaudio-libs-6.0-2.fc21.loongson.mips64el systemd-libs-216-12.fc21.loongson.mips64el tcp_wrappers-libs-7.6-80.fc21.loongson.1.mips64el trousers-0.3.13-3.fc21.loongson.mips64el xz-libs-5.1.2-14alpha.fc21.loongson.mips64el zlib-1.2.8-9.fc21.loongson.2.mips64el
@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Nov 23, 2017

@ClarkWang-2013 Can you paste the stack trace with bt command in the debugger?

@ClarkWang-2013

This comment has been minimized.

ClarkWang-2013 commented Nov 23, 2017

@zcbenz Sorry, I forgot to paste.

(gdb) bt
#0  0x000000fff6e374b8 in v8::internal::RegExpResultsCache::Clear(v8::internal::FixedArray*) (value=0, ptr=0xf) at ../../v8/src/base/atomicops_internals_portable.h:153
#1  0x000000fff6e374b8 in v8::internal::RegExpResultsCache::Clear(v8::internal::FixedArray*) (value=0x0, index=<optimized out>, this=0x0) at ../../v8/src/objects-inl.h:2395
#2  0x000000fff6e374b8 in v8::internal::RegExpResultsCache::Clear(v8::internal::FixedArray*) (cache=0x0) at ../../v8/src/regexp/jsregexp.cc:6926
#3  0x000000fff6e75564 in v8::internal::Heap::MarkCompactPrologue() (this=0x127405020) at ../../v8/src/heap/heap.cc:1529
#4  0x000000fff6e850d0 in v8::internal::Heap::MarkCompact() (this=0x127405020) at ../../v8/src/heap/heap.cc:1481
#5  0x000000fff6e8db18 in v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) (this=0x127405020, collector=<optimized out>, gc_callback_flags=<optimized out>) at ../../v8/src/heap/heap.cc:1343
#6  0x000000fff6e8e1d8 in v8::internal::Heap::CollectGarbage(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*, v8::GCCallbackFlags) (this=0x127405020, collector=<optimized out>, gc_reason=<optimized out>, collector_reason=<optimized out>, gc_callback_flags=<optimized out>) at ../../v8/src/heap/heap.cc:1023
#7  0x000000fff6e8ead4 in v8::internal::Heap::ReserveSpace(v8::internal::List<v8::internal::Heap::Chunk, v8::internal::FreeStoreAllocationPolicy>*, v8::internal::List<unsigned char*, v8::internal::FreeStoreAllocationPolicy>*) (gc_callback_flags=v8::kNoGCCallbackFlags, gc_reason=v8::internal::GarbageCollectionReason::kDeserializer, flags=2, this=0x127405020) at ../../v8/src/heap/heap.cc:881
#8  0x000000fff6e8ead4 in v8::internal::Heap::ReserveSpace(v8::internal::List<v8::internal::Heap::Chunk, v8::internal::FreeStoreAllocationPolicy>*, v8::internal::List<unsigned char*, v8::internal::FreeStoreAllocationPolicy>*) (this=0x127405020, reservations=0xffffffa310, maps=0xffffffa390) at ../../v8/src/heap/heap.cc:1239
#9  0x000000fff74ca1ec in v8::internal::Deserializer::Deserialize(v8::internal::Isolate*) (this=0xffffffa290) at ../../v8/src/snapshot/deserializer.cc:64
#10 0x000000fff74ca1ec in v8::internal::Deserializer::Deserialize(v8::internal::Isolate*) (this=0xffffffa290, isolate=<optimized out>)
    at ../../v8/src/snapshot/deserializer.cc:88
#11 0x000000fff6c2429c in v8::internal::Isolate::Init(v8::internal::Deserializer*) (this=0x127405000, des=<optimized out>) at ../../v8/src/isolate.cc:2756
#12 0x000000fff7185bc4 in v8::internal::Snapshot::Initialize(v8::internal::Isolate*) (isolate=0x127405000) at ../../v8/src/snapshot/snapshot-common.cc:44
#13 0x000000fff733ffbc in v8::IsolateNewImpl(v8::internal::Isolate*, v8::Isolate::CreateParams const&) (isolate=0x127405000, params=...) at ../../v8/src/api.cc:8336
#14 0x00000001217e1a28 in gin::IsolateHolder::IsolateHolder(scoped_refptr<base::SingleThreadTaskRunner>, gin::IsolateHolder::AccessMode, gin::IsolateHolder::AllowAtomicsWaitMode) (this=0x127402c58, task_runner=..., access_mode=<optimized out>, atomics_wait_mode=<optimized out>) at ../../gin/isolate_holder.cc:53
#15 0x00000001217e1bbc in gin::IsolateHolder::IsolateHolder(scoped_refptr<base::SingleThreadTaskRunner>, gin::IsolateHolder::AccessMode) (this=<optimized out>, task_runner=..., access_mode=<optimized out>) at ../../gin/isolate_holder.cc:37
#16 0x00000001217e1c4c in gin::IsolateHolder::IsolateHolder(scoped_refptr<base::SingleThreadTaskRunner>) (this=<optimized out>, task_runner=...)
    at ../../gin/isolate_holder.cc:32
#17 0x00000001254e9ec4 in atom::JavascriptEnvironment::JavascriptEnvironment() (this=0x127402c50) at ../../atom/browser/javascript_environment.cc:28
#18 0x00000001254e1d64 in atom::AtomBrowserMainParts::PostEarlyInitialization() (this=0x127358950) at ../../atom/browser/atom_browser_main_parts.cc:129
#19 0x0000000120d1f098 in content::BrowserMainLoop::EarlyInitialization() (this=0x127357e10) at ../../content/browser/browser_main_loop.cc:622
#20 0x0000000120dbbe80 in content::BrowserMainRunnerImpl::Initialize(content::MainFunctionParams const&) (this=0x127357830, parameters=...)
    at ../../content/browser/browser_main_runner.cc:106
#21 0x0000000120c20498 in content::BrowserMain(content::MainFunctionParams const&) (parameters=...) at ../../content/browser/browser_main.cc:42
#22 0x000000012169a8f0 in content::ContentMainRunnerImpl::Run() (this=0x127347680) at ../../content/app/content_main_runner.cc:740
#23 0x0000000125463a88 in service_manager::Main(service_manager::MainParams const&) (params=...) at ../../services/service_manager/embedder/main.cc:179
#24 0x0000000121698ee4 in content::ContentMain(content::ContentMainParams const&) (params=...) at ../../content/app/content_main.cc:19
#25 0x00000001207dfae8 in main(int, char const**) (argc=<optimized out>, argv=0xffffffaed8) at ../../atom/app/atom_main.cc:176
@ClarkWang-2013

This comment has been minimized.

ClarkWang-2013 commented Nov 23, 2017

@zcbenz I cross-compile a chromium project also encountered V8 problems before, it‘s mainly about loongson platform pagesize(16K on loongson platform)。

The same code compiling on loongson is ok, but run error when cross compiling. I solve this problem as follows:

v8/src/base/platform/platform-posix.cc
intptr_t OS::CommitPageSize() {
  +#if V8_TARGET_ARCH_MIPS64
  +  static intptr_t page_size = 16384;
  +#else
      static intptr_t page_size = getpagesize(); 
  +#endif
return page_size; 
}

size_t OS::AllocateAlignment() {
-return static_cast<size_t>(sysconf(_SC_PAGESIZE)); 
+return 16384;
} 

v8/src/base/sys-info.cc

#elif V8_OS_POSIX
long pages = sysconf(_SC_PHYS_PAGES);    // NOLINT(runtime/int) 
-long page_size = sysconf(_SC_PAGESIZE);  // NOLINT(runtime/int) 
+long page_size = 16384;  // NOLINT(runtime/int)

some places may not need to change,
Hope to help you!

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Nov 23, 2017

I'll try applying that patch to libchromiumcontent.

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Nov 23, 2017

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Nov 23, 2017

@fangyaling

This comment has been minimized.

fangyaling commented Nov 23, 2017

@zcbenz error again, and the error info is follow:
[New Thread 0xffec10ee80 (LWP 4468)]
Detaching after fork from child process 4471.
[New Thread 0xffeb67ee80 (LWP 4499)]

Electron 1.8.2-beta.2 - Build cross platform desktop apps with JavaScript, HTML, and CSS
Usage: electron [options] [path]

A path to an Electron app may be specified. It must be one of the following:
- index.js file.
- Folder containing a package.json file.
- Folder containing an index.js file.
- .html/.htm file.
- http://, https://, or file:// URL.

Options:
-d, --default Run the default bundled Electron app.
-i, --interactive Open a REPL to the main process.
-r, --require Module to preload (option can be repeated).
-v, --version Print the version.
-a, --abi Print the Node ABI version.
[New Thread 0xffea16ae80 (LWP 4507)]
[New Thread 0xffe996ae80 (LWP 4508)]
[New Thread 0xffe916ae80 (LWP 4509)]
[New Thread 0xffe891ee80 (LWP 4511)]
[New Thread 0xffd362ee80 (LWP 4512)]
[New Thread 0xffe811ee80 (LWP 4513)]
[New Thread 0xffd2e2ee80 (LWP 4514)]
[New Thread 0xffd262ee80 (LWP 4515)]
[New Thread 0xffd1e2ee80 (LWP 4516)]
[New Thread 0xffd162ee80 (LWP 4517)]
[New Thread 0xffd0e2ee80 (LWP 4519)]
[New Thread 0xffb3ffee80 (LWP 4520)]
[New Thread 0xffb37fee80 (LWP 4521)]
[New Thread 0xffb2ffee80 (LWP 4522)]
[New Thread 0xffb27fee80 (LWP 4523)]
[New Thread 0xffb1ffee80 (LWP 4524)]
[New Thread 0xffb17fee80 (LWP 4525)]
[New Thread 0xffb0ffee80 (LWP 4526)]
[New Thread 0xffb07fee80 (LWP 4527)]
[New Thread 0xff8fffee80 (LWP 4528)]
[New Thread 0xff8f7fee80 (LWP 4529)]
[New Thread 0xff8effee80 (LWP 4530)]
[New Thread 0xff8e7fee80 (LWP 4531)]
[New Thread 0xff8dffee80 (LWP 4533)]
[New Thread 0xff8d7fee80 (LWP 4534)]
[New Thread 0xff8cffee80 (LWP 4535)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xffb07fee80 (LWP 4527)]
0x0000000000000000 in ?? ()

and the bt info is:
(gdb) bt
#0 0x0000000000000000 in ()
#1 0x000000ffd052e71c in sqlite3DbMallocRaw () at /lib64/libsqlite3.so.0
#2 0x000000ffd057e504 in sqlite3_vmprintf () at /lib64/libsqlite3.so.0
#3 0x000000ffd057e610 in sqlite3_mprintf () at /lib64/libsqlite3.so.0
#4 0x000000ffe807d710 in s_open () at /lib64/libsoftokn3.so

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Nov 23, 2017

It seems that Electron has successfully started, but crashed when calling APIs from third party dependencies. The crash seems to have happened in IO thread, since libsoftokn3 is a dependency of nss.

Is it possible to get a longer stack trace? It is too short to know what happened.

@ClarkWang-2013

This comment has been minimized.

ClarkWang-2013 commented Nov 23, 2017

@zcbenz We can only get these information

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Nov 24, 2017

I'm merging this PR since it already builds locally, and does not affect other builds. (It is still crashing though.)

The CI job for mips64el has been disabled.

@zcbenz zcbenz merged commit f8adaed into master Nov 24, 2017

6 checks passed

ci/circleci: electron-linux-arm Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm64 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-ia32 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-x64 Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/jenkins/pr-head This commit looks good
Details

@zcbenz zcbenz deleted the mips64el branch Nov 24, 2017

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Nov 24, 2017

I noticed that the debugger seemed to indicate you were using Fedora, but the binaries were cross-compiled for debian sysroot, could that be related to the crash?

@ClarkWang-2013

This comment has been minimized.

ClarkWang-2013 commented Nov 24, 2017

@zcbenz I made the sysroot image according to Fedora, I think it should not matter with this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment