MCMrARM / mcpelauncher-linux

Please note this is a legacy repository, please go to: https://github.com/minecraft-linux/mcpelauncher-manifest/wiki
GNU General Public License v3.0
312 stars 46 forks source link

mcpelauncher-linux crashing on startup under Fedora 22 - SIGILL #49

Closed Stormwind99 closed 8 years ago

Stormwind99 commented 8 years ago

I got mcpelauncher-linux building and starting under Fedora 22 (32-bit x86), downloaded the x86 minecraftpe apk, extracted it, and ran.

However, I get a SIGILL crash when running.

Even with debug symbols, I get a corrupt stacktrace of "??"'s in gdb. And I did make sure I downloaded the x86 apk, and file libminecraftpe.so reports ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped.

strace ends with following output:

getcwd("/home/minecraft-pe/mcpelauncher-linux", 4096) = 38
stat64("/home/minecraft-pe/mcpelauncher-linux/libs/libminecraftpe.so", {st_mode=S_IFREG|0664, st_size=10984984, ...}) = 0
open("/home/minecraft-pe/mcpelauncher-linux/libs/libminecraftpe.so", O_RDONLY) = 3
lseek(3, 0, SEEK_SET)                   = 0
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0\0\0\0004\0\0\0"..., 4096) = 4096
lseek(3, -8, SEEK_END)                  = 10984976
read(3, "\1\0\0\0\0\0\0\0", 8)          = 8
mmap2(NULL, 11472896, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6822000
mmap2(0xb6822000, 10513400, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xb6822000
mprotect(0xb6822000, 10514432, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
mmap2(0xb7229000, 473472, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0xa06000) = 0xb7229000
mmap2(0xb729d000, 480105, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb729d000
close(3)                                = 0
mprotect(0xb6822000, 10514432, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
mprotect(0xb7229000, 471040, PROT_READ|PROT_WRITE) = 0
futex(0xb740a740, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0xb740a748, FUTEX_WAKE_PRIVATE, 2147483647) = 0
gettimeofday({1462145316, 270077}, NULL) = 0
--- SIGILL {si_signo=SIGILL, si_code=ILL_ILLOPN, si_addr=0xb741ad63} ---
+++ killed by SIGILL (core dumped) +++
Illegal instruction (core dumped)

Small diff I made for Fedora 22 (will submit pull request once everything is working):

diff --git a/src/main.cpp b/src/main.cpp
index 2e5d59e..87832a7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -293,6 +293,10 @@ std::string getOSLibraryPath(std::string libName) {
     if (access(p.c_str(), F_OK) != -1) {
         return p;
     }
+    p = std::string("/usr/lib/") + libName;
+    if (access(p.c_str(), F_OK) != -1) {
+        return p;
+    }

     std::cout << "could not find os library: " << libName << "\n";
     abort();
Stormwind99 commented 8 years ago

Primitive stdout debugging shows crash is happening during void* handle = hybris_dlopen((getCWD() + "libs/libminecraftpe.so").c_str(), RTLD_LAZY); in src/main.cpp .

Stormwind99 commented 8 years ago

Futher info: crash occurs when hybrid_dlopen() calls android_dlopen() and it calls call_constructors_recursive(ret).

Stormwind99 commented 8 years ago

.. and call_array (ctor=0xb7a5b360, count=23, reverse=0) at /home/minecraft-pe/mcpelauncher-linux/hybris/src/jb/linker.c:1537 is trying to call the following constructor, which I'm guessing has been improperly decoded: [ 0 Calling func @ 0xb72c4d05 ]

MCMrARM commented 8 years ago

Download libs from: http://mrarm.io/download/mcpelauncher_libs_amd.zip and replace them. Then run mcpelauncher with --temp-amd-fix.

Stormwind99 commented 8 years ago

That did it, even though it is an Intel processor!

Just the new libs were enough - it starts without the command line parameter "--temp-amd-fix" too.

Thanks!

From /proc/cpuinfo:

vendor_id       : GenuineIntel
cpu family      : 6
model           : 15
model name      : Intel(R) Core(TM)2 Duo CPU     E6850  @ 3.00GHz
stepping        : 11
microcode       : 0xb6

Output (including some debug output I added locally):

[minecraft-pe@linus mcpelauncher-linux]$ ./mcpelauncher
loading MCPE
oslib: /usr/lib/libGLESv2.so: 155884272
oslib: /home/minecraft-pe/mcpelauncher-linux/libs/native/libfmod.so.7.7: 155886256
stubSymbols
hybris_hook
more loadLibrary
hybris_dlopen
libBase
loaded MCPE (at 3061923840)
apply patches
original: 85 87 86 83 232
post patch: 233 248 11 88 81
original: 85 87 86 83 232
post patch: 233 206 58 88 81
original: 85 137 229 87 86
post patch: 233 141 42 83 81
original: 87 86 83 232 248
post patch: 233 139 58 88 81
patches applied!
init app platform vtable
init app platform
app platform initialized
init window
MCMrARM commented 8 years ago

So it works now or not?

Stormwind99 commented 8 years ago

Got past that - now dealing with #52