Skip to content
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

droidVNCserver compiled for armeabi architecture #126

Open
hoehermann opened this issue Mar 4, 2017 · 7 comments
Open

droidVNCserver compiled for armeabi architecture #126

hoehermann opened this issue Mar 4, 2017 · 7 comments

Comments

@hoehermann
Copy link

hoehermann commented Mar 4, 2017

Ever since Android 5.0, Android enforces PIC (position independent code). As a result, the binary supplied in @f95fa6b will not start, resulting in #98 #104 #107 #119 . After the partial success described in #117, I want to share my experience, too. I did not compile the Java (GUI frontend) part of droidVncServer, I concentrated on the VNC server exclusively.

I have a Samsung Galaxy Nexus "Maguro" phone running CyanogenMod 13.0, which is Android 6.0.1 "Marshmallow".

Here is what I did:

  1. Based on this article by Nick Desaulniers, I installed the current linux version "r14" of the Android NDK for compiling native applications. I set my PATH to temporarily include the supplied cross compilers and ndk-build.

  2. droidVNCserver is relies on a VNC server implementation included in the module vnc. vnc itself shall be statically linked against three libraries jpeg libpng openssl. Additionally. vnc uses two dynamically loaded libraries flinger gralloc.
    I compiled vnc and its libraries with APP_ALLOW_MISSING_DEPS=true ndk-build. I needed APP_ALLOW_MISSING_DEPS=true since ndk-build complained about zlib being missing (although it is allegedly included in the Android system). The jpeg module fails for any architecture other than armeabi (same in Trouble compiling. #91 and Does not compile with current NDK #106; Compile failure jni/jpeg/jidctfst.S #118 mentions a possible workaround; failing to build libjpeg results in linking errors as described in how to resolve "turbojpeg.c:469: error: undefined reference to 'jpeg_std_error'", thanks #121). For this reason, I set APP_ABI:=armeabi in Application.mk.
    I did not manage to compile the two dynamically loaded libraries flinger gralloc. viren-nadkarni/droid-vnc-server@8bd5fcb states, you need the Android Open Source Project (AOSP) code. 160GB disk space and 16GB RAM looks a bit steep for a simple compilation. For now, I just use the precompiled ones included in the nativeMethods directory. I suppose, this causes the problems described below.

  3. I pushed the androidvncserver binary on my device and ran it:

    $ adb push libs/armeabi/androidvncserver /data/local/tmp/androidvncserver
    $ adb shell /data/local/tmp/androidvncserver
    Initializing grabber method...
    No grabber method selected, auto-detecting...
    --Loading flinger native lib--
    Loading lib: /data/data/org.onaips.vnc/lib//libdvnc_flinger_sdk10.so
    Couldnt load flinger library /data/data/org.onaips.vnc/lib//libdvnc_flinger_sdk10.so! Error string: (null)
    Loading lib: /data/data/org.onaips.vnc/lib//libdvnc_flinger_sdk14.so
    Couldnt load flinger library /data/data/org.onaips.vnc/lib//libdvnc_flinger_sdk14.so! Error string: (null)
    --Loading gralloc native lib--
    Loading lib: /data/data/org.onaips.vnc/lib//libdvnc_gralloc_sdk10.so
    WARNING: linker: /data/data/org.onaips.vnc/lib/libdvnc_gralloc_sdk10.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
    --Initializing gralloc access method--
    WARNING: linker: /system/vendor/lib/hw/gralloc.omap4460.so: unused DT entry: type 0xf arg 0x53b
    WARNING: linker: /system/vendor/lib/libsrv_um_SGX540_120.so: unused DT entry: type 0xf arg 0xeb9
    WARNING: linker: /system/vendor/lib/libpvr2d_SGX540_120.so: unused DT entry: type 0xf arg 0x767
    Gralloc method not supported by this device!
    Loading lib: /data/data/org.onaips.vnc/lib//libdvnc_gralloc_sdk14.so
    Couldnt load library /data/data/org.onaips.vnc/lib//libdvnc_gralloc_sdk14.so! Error string: (null)
    --Initializing framebuffer access method--
    line_lenght=2944 xres=720, yres=1280, xresv=720, yresv=1280, xoffs=0, yoffs=0, bpp=32
    Using Droid workaround
    Initializing virtual keyboard and touch device...
    ---Initializing uinput...---
    Initializing VNC server:
    width:  720
    height: 1280
    bpp:    32
    port:   5901
    Colourmap_rgba=16:8:0:24    lenght=8:8:8:8
    04/03/2017 09:20:51 Listening for VNC connections on TCP port 5901
    04/03/2017 09:20:51 Listening for HTTP connections on TCP port 5801
    04/03/2017 09:20:51   URL http://localhost:5801
    Starting IPC connection...binded to port 13132
    
    Waiting for a connection
    04/03/2017 09:20:58 Got connection from client
    04/03/2017 09:20:58   other clients:
    04/03/2017 09:20:58 Normal socket connection
    04/03/2017 09:20:58 Client Protocol Version 3.8
    04/03/2017 09:20:58 Protocol version sent 3.8, using 3.8
    04/03/2017 09:20:58 rfbProcessClientSecurityType: executing handler for type 1
    04/03/2017 09:20:58 rfbProcessClientSecurityType: returning securityResult for client rfb version >= 3.8
    04/03/2017 09:20:58 Pixel format for client:
    04/03/2017 09:20:58   32 bpp, depth 24, little endian
    04/03/2017 09:20:58   true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0
    04/03/2017 09:20:58 Enabling full-color cursor updates for client
    04/03/2017 09:20:58 Enabling NewFBSize protocol extension for client
    04/03/2017 09:20:58 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFFFECC)
    04/03/2017 09:20:58 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFFFECD)
    04/03/2017 09:20:58 Enabling LastRect protocol extension for client
    04/03/2017 09:20:58 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFFFEC7)
    04/03/2017 09:20:58 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFFFEC8)
    04/03/2017 09:20:58 Using image quality level 8 for client
    04/03/2017 09:20:58 Using JPEG subsampling 0, Q92 for client
    04/03/2017 09:20:58 Using raw encoding for client
    04/03/2017 09:21:46 Client gone
    04/03/2017 09:21:46 Statistics            events    Transmit/ RawEquiv ( saved)
    04/03/2017 09:21:46  FramebufferUpdate   :      1 |        0/       0 (  0.0%)
    04/03/2017 09:21:46  raw               :      1 |   3686412/  3686412 (  0.0%)
    04/03/2017 09:21:46  RichCursor         :      1 |       255/      255 (  0.0%)
    04/03/2017 09:21:46  TOTALS             :      3 |   3686667/  3686667 (  0.0%)
    04/03/2017 09:21:46 Statistics            events    Received/ RawEquiv ( saved)
    04/03/2017 09:21:46  ClientCutText       :      2 |       50/       50 (  0.0%)
    04/03/2017 09:21:46  KeyEvent           :      2 |       16/       16 (  0.0%)
    04/03/2017 09:21:46  FramebufferUpdate   :      2 |       20/       20 (  0.0%)
    04/03/2017 09:21:46  SetEncodings       :      1 |       60/       60 (  0.0%)
    04/03/2017 09:21:46  SetPixelFormat      :      1 |       20/       20 (  0.0%)
    04/03/2017 09:21:46  PointerEvent       :     36 |       216/      216 (  0.0%)
    04/03/2017 09:21:46  TOTALS             :     44 |       382/      382 (  0.0%)
    
  4. I connected with TigerVNC 1.7.0 and... was disappointed. There is a couple of issues:

These problems considered, I suspect the VNC server assumes incorrect framebuffer dimensions (width and height). With that, any mouse pointer position conversions are amiss. Reading from the framebuffer at invalid positions may result in the garbled or a black screen. I suspect, using a recent build of flinger and gralloc could help.

For those desperate ones, who want to experiment with this build, I uploaded the binary to my server. viren-nadkarni/droid-vnc-server@8bd5fcb provides binaries of flinger and gralloc, but using them androidvncserver terminates upon client connect.

@pedroelisio
Copy link

Can you explain how can I compile it with libvncserver 0.9.11 but for an Android device 6.01 x86_64?
Best regards,
Pedro Elisio

@hoehermann
Copy link
Author

I did not try myself. You probably need to edit Application.mk and make changes so it reads APP_ABI:=x86_64 and then simply invoke ndk-build. However, the source code for the JPEG library in oNaiPs fork seems to compile for architecture armeabi only. Please confer to the aforementioned issues and/or try another fork.

@pedroelisio
Copy link

I can't find an library that is compatible with X86 and X86/64.
Can you point a fork that explicits the compatibility for the @least X86_64?
Best Regards,
Pedro Elisio

@hoehermann
Copy link
Author

You may try #118 (comment) . Apart from that, I do not have any further information about this particular issue. I am sorry.

@alexander-arce
Copy link

alexander-arce commented May 10, 2017

@hoehermann
Hi, can you write an explanation for setup environment. And instructions for compile this project.
It's my first time compiling a Android app.
Best regards.

@pedroelisio
Copy link

I don't think that there are all libraries available. I was not able to compile it.
Even DroidVNC app which is based on this github is not working in all phones. At least in my Asus Zenfone 3 is not working.
Best regards,
Pedro Elisio

@vrufino
Copy link

vrufino commented Nov 21, 2017

I somehow made it work fine in Android L (tested in a 5.1.1), but the mouse is inverted.
Utilized the TightVNC client, some settings must had been done to optimize the speed.

Edit: Found the answer about the xy mouse inverted. In my case, is a ZTE device, so I started the app with -z parameter:
/data/data/org.onaips.vnc/lib/libandroidvncserver.so -z

working fine :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants