This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

cannot locate symbol "log2" referenced by "libMGD.so" Android firmware 4.2.2

Hello,

Recently I'm trying to debug using MGD on an unrooted device.

The device is Alcatel One Touch IdolX+ (6043D).

I followed the guide, and I got that error. This doesn't happen in firmware 4.3 and above.

I've checked in my NDK, in "platforms\android-<API_LEVEL>\arch-arm\usr\include" folder and found that "log2" isn't present in firmware 17 and below.

there is only "log2l". Is this the cause of the error?

if so is there any workaround to solve this?

I'm using NDK r12b.

  • Well, in the NDK, it seems that the symbol is present in libm_hard.so. Can you check the libm.so of your system, see if it contains log2 ? Something like

    grep log2 /system/lib/libm.so

    might do the trick.

     

    Also, what command precisely returns this error ?

  • Thank you for the answer, i'll check it.

    the command is System.loadLibrary("MGD");
    in my java side of the code.

  • If your system does not have log2, I don't know what would be the best workaround, as I do not think that it is possible to abuse LD_PRELOAD with Java System.loadLibrary.

    The "not-too-ugly" way would be to :

    • compile a new library which defines log2 "in a way that makes sense",
    • make the library depend on libMGD.so during the linking process,
    • load-it.

    The really ugly way would be to :

    • compile a math library for ARM soft-float which defines all the math symbols required by libMGD.so,
    • call it something like libk.so (keep the 'lib' + one letter + '.so' pattern),
    • hexedit libMGD.so and replace references to libm.so by 'libk.so,
    • put 'libk.so' and 'libMGD.so' in the same folder,
    • System.loadLibrary('libk.so') and then System.loadLibrary('libMGD.so').

    Very ugly hack, though.