exokitxr / exokit

Native VR/AR/XR engine for JavaScript đŸ¦–
MIT License
997 stars 117 forks source link

Problems compiling for Android: LabSound #1419

Closed jrojoCI3 closed 4 years ago

jrojoCI3 commented 4 years ago

Describe the bug This is not a bug, but more a question about dependencies when trying to apply exokit for SamsungGearVR.

To Reproduce Steps or commands ran to reproduce the behavior:

  1. Follow the instructions to reach the point when npm install works.
  2. Execute ./scripts/oculusmobile/build-android.sh
  3. See how everything works properly until it reaches the linking of libraries with errors like /home/user/android-sdk-linux/ndk-bundle/toolchain/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lLabSound
  4. I've managed to crosscompile most of them but LabSound still resists.

Additional context LabSound is a library focused on low-level audio management. The windows/linux/macOS implementations are fair enough (with a cmake-qmake compiling system already tested). In their README.md it is said:

In the past, LabSound has been demonstrated to work on iOS, Android, and Linux via JACK.

However, there are no instructions or any trace of that (at least I wasn't able to see it). I'm quite new in the crosscompilation pipeline and it might be obvious for others, but not for me. I've opened an issue similar to this one in their repository, but I'm almost certain that someone in the exokit community must have already faced this problem before. So any kind of information or hint on how to successfuly crosscompile LabSound for Android would be greatly appreciated.

System information:

avaer commented 4 years ago

The native module needs to be downloaded and linked as part of the compilation pipeline:

https://github.com/exokitxr/exokit/blob/master/package.json#L64

LabSound is sourced from there.

jrojoCI3 commented 4 years ago

Thank you very much @avaer. We have tried to start from scratch:

  1. We have cloned the exokit repository with the --recursive flag.
  2. We have executed npm install, which installs the native-audio-deps npm module (v0.0.65).
  3. We have run the scripts/oculusmobile/build-android.sh script with the following errors:

Release/obj.target/exokit/deps/oculus-mobile/deps/oboe/src/aaudio/AudioStreamAAudio.o -Wl,--end-group -lskia -lavformat -lavcodec -lavutil -lavdevice -lLabSound -lswscale -lswresample -lopus -lwebrtc -lvrapi /home/usuario/NVPACK/android-sdk-linux/ndk-bundle/toolchain/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lskia /home/usuario/NVPACK/android-sdk-linux/ndk-bundle/toolchain/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lavformat /home/usuario/NVPACK/android-sdk-linux/ndk-bundle/toolchain/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lavcodec /home/usuario/NVPACK/android-sdk-linux/ndk-bundle/toolchain/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lavutil /home/usuario/NVPACK/android-sdk-linux/ndk-bundle/toolchain/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lavdevice /home/usuario/NVPACK/android-sdk-linux/ndk-bundle/toolchain/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lLabSound /home/usuario/NVPACK/android-sdk-linux/ndk-bundle/toolchain/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lswscale /home/usuario/NVPACK/android-sdk-linux/ndk-bundle/toolchain/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lswresample /home/usuario/NVPACK/android-sdk-linux/ndk-bundle/toolchain/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lopus /home/usuario/NVPACK/android-sdk-linux/ndk-bundle/toolchain/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lwebrtc /home/usuario/NVPACK/android-sdk-linux/ndk-bundle/toolchain/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lvrapi clang80++: error: linker command failed with exit code 1 (use -v to see invocation)

Looks like it doesn't find the required libraries for android. Do we need to do anything else? What are we missing?

avaer commented 4 years ago

Are those libraries in the library include path of your build process? libskia.a for example should be in node_modules and linked in from there by the compiler.

If this is a bug, filing a report would be appreciated, but unfortunately the Github issues is not a free support channel.

jrojoCI3 commented 4 years ago

ok. Thank you for the support.

RangerMauve commented 4 years ago

I had this problem too. I think the issue was that I compiled all the binaries for my OS to run exokit as a desktop app first which made bins that couldn't be loaded for the Oculus compile step

Nuking node_modules with rm -rf ./node_modules and running ./scripts/oculusmobile/buildandroid.sh helped.

Got tipped off to do that based on this comment

avaerkazmer commented 4 years ago

Yeah, it might make sense to wipe the previous binaries in the Android build.