ALVR icon indicating copy to clipboard operation
ALVR copied to clipboard

Error building client - linking to libunwind?

Open zdjeffri opened this issue 1 year ago • 1 comments

Description

Unable to build android client. I am new to ALVR and Android Development/RUST but well versed with C++ development on Ubuntu. I was successful in building the streamer.

Thanks in advance for any help!

I am targeting using ALVR after this commit -> for this feature

The following shows the error when building the client - linking to libunwind

~/ALVR/ALVR$ export JAVA_HOME=/usr/lib/jvm/default-java/bin
~/ALVR/ALVR$ export ANDROID_HOME=$HOME/Android/Sdk
~/ALVR/ALVR$ export ANDROID_NDK_HOME=/usr/lib/android-sdk/ndk-bundle
~/ALVR/ALVR$ cargo xtask prepare-deps --platform android --release &>/dev/null
~/ALVR/ALVR$ cargo xtask build-client --release
   Compiling bincode v1.3.3
   Compiling settings-schema v0.2.0 (https://github.com/alvr-org/settings-schema-rs?rev=676185f#676185f3)
   Compiling alvr_common v21.0.0-dev00 (/home/zdjeffries/ALVR/ALVR/alvr/common)
warning: [email protected]: cpp/graphics.cpp:502:18: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
warning: [email protected]:                  i,
warning: [email protected]:                  ^
warning: [email protected]: cpp/utils.h:18:65: note: expanded from macro 'LOGD'
warning: [email protected]:         __android_log_print(ANDROID_LOG_DEBUG, "[ALVR Native]", __VA_ARGS__);                        \
warning: [email protected]:                                                                 ^~~~~~~~~~~
warning: [email protected]: 1 warning generated.
   Compiling alvr_sockets v21.0.0-dev00 (/home/zdjeffries/ALVR/ALVR/alvr/sockets)
   Compiling alvr_packets v21.0.0-dev00 (/home/zdjeffries/ALVR/ALVR/alvr/packets)
   Compiling alvr_audio v21.0.0-dev00 (/home/zdjeffries/ALVR/ALVR/alvr/audio)
error: linking with `/usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/zdjeffries/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-
  
  ######################################################################
  ######### (A whole bunch of terminal spam that I don't think is usefule...) ###########
  ######################################################################
  
  z,relro,-z,now" "-nodefaultlibs" "--target=aarch64-linux-android26"
  = note: /usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lunwind
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          
The following warnings were emitted during compilation:

warning: [email protected]: cpp/graphics.cpp:502:18: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
warning: [email protected]:                  i,
warning: [email protected]:                  ^
warning: [email protected]: cpp/utils.h:18:65: note: expanded from macro 'LOGD'
warning: [email protected]:         __android_log_print(ANDROID_LOG_DEBUG, "[ALVR Native]", __VA_ARGS__);                        \
warning: [email protected]:                                                                 ^~~~~~~~~~~
warning: [email protected]: 1 warning generated.

error: could not compile `alvr_client_core` (lib) due to 1 previous error
Error: Command `AR_aarch64-linux-android=/usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar CARGO_ENCODED_RUSTFLAGS=-Clink-arg=--target=aarch64-linux-android26 CARGO_TARGET_AARCH64_LINUX_ANDROID_AR=/usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=/usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang CC_aarch64-linux-android=/usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang CFLAGS_aarch64-linux-android=--target=aarch64-linux-android26 CXXFLAGS_aarch64-linux-android=--target=aarch64-linux-android26 CXX_aarch64-linux-android=/usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ cargo build --target aarch64-linux-android --target-dir /home/zdjeffries/ALVR/ALVR/target` had a non-zero exit code.
thread 'main' panicked at alvr/xtask/src/build.rs:394:6:
called `Result::unwrap()` on an `Err` value: command exited with non-zero code `cargo apk build --target-dir=/home/zdjeffries/ALVR/ALVR/target`: 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Checking Android SDK:

~/ALVR/ALVR$ ls ~/Android/Sdk/platforms
android-29

And running with the RUST backtrace did not yield any new information.

Checking libunwind

~/ALVR/ALVR$ sudo apt install libunwind-dev
[sudo] password for zdjeffries: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libunwind-dev is already the newest version (1.3.2-2build2.1).
0 upgraded, 0 newly installed, 0 to remove and 48 not upgraded.

Checking the 2nd error path: (check that ld exists - it does...)

note: /usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lunwind
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
ls /usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/aarch64-linux-android/bin
ar  as  ld  ld.bfd  ld.gold  nm  objcopy  objdump  ranlib  readelf  strip

Checking the 1st error path: (check that clang exists - it does... also idk why lack of a linter util would cause a build to fail, maybe tests to not pass)

ls /usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin
... (removed for brevity) ...
clang
... (removed for brevity) ...

General Troubleshooting

  • [x] I carefully followed the instructions in the README and successfully completed the setup wizard
  • [x] I read the ALVR Wikis here and here

Environment

Dell Laptop

Hardware

Note: for Linux, an upload to the hw-probe database is preferred: hw-probe -all -upload I cannot do this for other reasons. If something is pertinent and not contained below, please let me know.

CPU: 12th Gen Intel® Core™ i7-12850HX

GPU: NVIDIA RTX A1000 Laptop GPU

GPU Driver Version: 535.154.05 (CUDA 12.2)

Audio: Intel Corportation Audio Device (Internal)

Installation

ALVR Version: master as of 19Feb2024 1400 EST

ALVR Settings File: n/a

SteamVR Version: n/a

Install Type:

  • [ ] Packaged (exe, deb, rpm, etc)
  • [ ] Portable (zip)
  • [x] Source

OS Name and Version (winver on Windows or grep PRETTY_NAME /etc/os-release on most Linux distributions): Ubuntu 22.04.3 LTS

zdjeffri avatar Feb 19 '24 22:02 zdjeffri

Wellllll... I foolishly used the NDK that Android Studio installed (along with SDK 29 and 34)...

After replacing it with this NDK it built.

zdjeffri avatar Feb 19 '24 22:02 zdjeffri

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Apr 20 '24 00:04 github-actions[bot]