duhow / xiaoai-patch

Patching for XiaoAi Speakers, add custom binaries and open source software. Tested on LX06, LX01, LX05, L09A
GNU General Public License v3.0
176 stars 29 forks source link

Something wrong with the libraries #83

Open firedevel opened 1 month ago

firedevel commented 1 month ago

I didn't need extra features, so I modified the packages.sh: PACKAGES_TO_BUILD="update-libs update-binaries support jq avahi improv getevent ffmpeg shairport-sync"

but it gives an error when i run something on the speaker:

root@LX01-8083:~# shairport-sync shairport-sync: error while loading shared libraries: /usr/lib/libc.so: invalid ELF header

root@LX01-8083:~# wifi_connect xxx xxx ... Error relocating /usr/lib/libmico-common.so: EVP_CIPHER_CTX_cleanup: symbol not found Error relocating /lib/libuuid.so.1: getrandom: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: getcontext: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: secure_getenv: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: makecontext: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: setcontext: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: register_atfork: symbol not found Error relocating /usr/lib/libmico-common.so: EVP_CIPHER_CTX_init: symbol not found Error relocating /usr/lib/libmico-common.so: EVP_CIPHER_CTX_cleanup: symbol not found Error relocating /lib/libuuid.so.1: getrandom: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: getcontext: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: secure_getenv: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: makecontext: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: setcontext: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: register_atfork: symbol not found Error relocating /usr/lib/libmico-common.so: EVP_CIPHER_CTX_init: symbol not found Error relocating /usr/lib/libmico-common.so: EVP_CIPHER_CTX_cleanup: symbol not found Error relocating /lib/libuuid.so.1: getrandom: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: getcontext: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: secure_getenv: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: makecontext: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: setcontext: symbol not found Error relocating /usr/lib/libcrypto.so.1.1: __register_atfork: symbol not found { "name": "wireless" } { } Error relocating /usr/lib/libmico-common.so: EVP_CIPHER_CTX_init: symbol not found Error relocating /usr/lib/libmico-common.so: EVP_CIPHER_CTX_cleanup: symbol not found Error relocating /lib/libuuid.so.1: getrandom: symbol not found Command failed: Invalid argument

But the architecture seems correct: $ file '/home/ubuntu/ai/build/xiaoai-patch-master/squashfs-root/lib/libc.so' /home/ubuntu/ai/build/xiaoai-patch-master/squashfs-root/lib/libc.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, no section header

firedevel commented 1 month ago

And LX01 has bluetooth but why it ignores building bluetooth support

packages/update-libs/package.mk: if [ "${BUILD_MODEL}" != "LX01" ]; then PACKAGE_DEPENDS="${PACKAGE_DEPENDS} bluez" fi

firedevel commented 1 month ago

$ nm '/home/ubuntu/ai/build/xiaoai-patch-master/build-packages/staging/armv7/usr/lib/libcrypto.so.1.1' | grep setcontext U setcontext@@GLIBC_2.4

$ nm '/home/ubuntu/ai/build/xiaoai-patch-master/build-packages/s2t/armv7/usr/lib/libcrypto.so.1.1' nm: /home/ubuntu/ai/build/xiaoai-patch-master/build-packages/s2t/armv7/usr/lib/libcrypto.so.1.1:无符号(no symbol)

$ nm '/home/ubuntu/ai/build/xiaoai-patch-master/squashfs-root/usr/lib/libcrypto.so.1.1' nm: /home/ubuntu/ai/build/xiaoai-patch-master/squashfs-root/usr/lib/libcrypto.so.1.1:无符号(no symbol)

What's happens when generating dictionary s2t?

duhow commented 1 month ago

@firedevel have you extracted LX01 squashfs-root before building packages? This should define that the packages.sh MODEL is LX01 and will trigger the build for it, otherwise it will build for LX06, which has newer component versions and thus is incompatible with it.

Additionally, please confirm what firmware version are you using, and if you flashed the matching kernel partition as well.

firedevel commented 1 month ago

I tried extract squashfs to xiaoai-patch-master/squashfs-root first, but there is still the same problem

$ sudo docker run -it -v $PWD:/xiaoai xiaoai-patch
------------------------------------------------------------------------------
Host arch         :  x86_64
Target arch       :  armv7
Model detected    :  LX01
Prefix            :  /usr
Make concurrency  :  8

Note: Prefix will be the path to all binaries in target device 
------------------------------------------------------------------------------
Process will begin shortly. Press enter or break run (Ctrl+C). 

I've flashed the kernel image in ota file to kernel1, the xiaoai-patch-master/release/lx01/latest to rootfs1 and boot currently

firedevel commented 1 month ago

ROM Ver:1.56.1 OTA file: https://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/lx01/mico_firmware_c1cac_1.56.1.bin

root@LX01-8083:~# uname -a
Linux LX01-8083 3.4.39 #1 SMP PREEMPT Tue Nov 28 14:33:17 UTC 2023 armv7l GNU/Linux
duhow commented 1 month ago

Got it, please note that current target recommended version for LX01 is 1.32.6 . During the build packages.sh process, if the model was previously wrong, you may need to rebuild all packages. Run sudo make clean-packages .

firedevel commented 1 month ago

Thanks, I tried to use 1.32.6, wifi_connect seems works fine, but there is still the same problem with shairport-sync

root@LX01-8083:/# shairport-sync 
shairport-sync: error while loading shared libraries: /usr/lib/libc.so: invalid ELF header
firedevel commented 1 month ago
$ cat 'squashfs-root/usr/lib/libc.so' 
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a  AS_NEEDED ( /lib/ld-linux-armhf.so.3 ) )
$ file 'squashfs-root/usr/lib/libc.so' 
squashfs-root/usr/lib/libc.so: ASCII text

$ file 'squashfs-root/lib/libc.so.6' 
squashfs-root/lib/libc.so.6: symbolic link to libc-2.27.so

$ file 'squashfs-root/lib/libc-2.27.so' 
squashfs-root/lib/libc-2.27.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=241476950cd0fe031d1460dcc35aed847010919a, for GNU/Linux 3.2.0, with debug_info, not stripped
$ cat patch.log | grep -i not 
...
[*] libc not found (musl?), skipping.
firedevel commented 4 weeks ago

Any solutions?