rnc-archive / react-native-webgl

DEPRECATED: use expo-gl – Implements WebGL for react-native
295 stars 73 forks source link

[Android] Project cannot be build with latest NDK #76

Closed futuun closed 5 years ago

futuun commented 5 years ago

Last version of android ndk (18) removed gnustl which is used to build this package

Tanatcu commented 5 years ago

Any updates of this issue?

futuun commented 5 years ago

Yea, I was able to use NDK 18 with that fix: https://github.com/futuun/react-native-webgl/commit/1a6f84280c26f184e335a6cf6989eaf996c82021 yarn add https://github.com/futuun/react-native-webgl.git#ndk18-fix in case you want to give it a try.

Morphinity commented 5 years ago

On applying the above patch, the build is successful but the app crashes with the error:

    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librnwebgl.so caused by: dlopen failed: library "libc++_shared.so" not found
        at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:703)
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:564)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:500)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:455)
        at fr.greweb.rnwebgl.RNWebGL.<clinit>(RNWebGL.java:8)
        at fr.greweb.rnwebgl.RNWebGL.RNWebGLContextCreate(Native Method)
        at fr.greweb.rnwebgl.RNWebGLView$1.run(RNWebGLView.java:50)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
        at android.os.Looper.loop(Looper.java:193)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
        at java.lang.Thread.run(Thread.java:764)

Any idea how to resolve this?

moxxuk commented 5 years ago

@Morphinity I'm getting the exact same error now.

@futuun is it still working fine for you?

Morphinity commented 5 years ago

@markidm worked for me by changing exclude "**/libc++_shared.so" to include "**/libc++_shared.so" in android/build.gradle f04bc00117f0916f4a1db033df5b4cfa574cae00

moxxuk commented 5 years ago

Wow, thanks @Morphinity! Spent 3 hours trying to figure this out last night with no luck. Your fix works a treat.

rotoxl commented 5 years ago

Hi @futuun,

I'm not sure if I'm missing something. I had react-native-community branch installed, then I executed the yarn fix you provided. It compiled but the app crashed at runtime (could not find libc++_shared.so). Shouldn't your fix had patched my ./node_modules/react-native-webgl/android/build.gradle? I've had to patch it myself (following @Morphinity's instructions).

The patch is working now, I'm just looking for instructions for my CI to start building again.

Thank you all

futuun commented 5 years ago

Hey,

I haven't used that in a while. I’ll try the fix you mentioned and add it to my pr but I don't think i will find time to look at it before Friday. In the meantime you could add post install command that will automatically apply path that is working for you. With sed it would look something like:

sed -i '' 's/include "\*\*\/libc++/exclude "**\/libc++/g' ./node_modules/react-native-webgl/android/build.gradle
bcgilliom commented 5 years ago

@futuun 's changes worked for me - I'm on NDK 19.0.5xxxxxx, RN 0.57.1, webgl 0.8

ducNgbk commented 5 years ago

@adbl @futuun Hi, have you managed to make it work with RN0.58 or above on Android?

adbl commented 5 years ago

@ducNgbk nope 😕

See https://github.com/react-native-community/react-native-webgl/pull/83

ducNgbk commented 5 years ago

@adbl Do you know what did change between RN 0.57 and RN 0.58 that cause thing stops working? I did digging. Then I found some keywords: Javascriptcore and 64 bit support. But nothing helps yet. It always end with this kind of error Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x3ee4 in tid 7743 (mqt_js), pid 7706 (com.testthree)

adbl commented 5 years ago

I have no idea but yeah, those changes sounds like reasonable suspects...

gre commented 5 years ago

let's group the discussion on #95