Insta360Develop / CameraSDK-Cpp

CameraSDK-Cpp is a C++ library to control Insta360 cameras.
https://www.insta360.com
115 stars 16 forks source link

"/lib//libCameraSDK.so: file not recognized: file format not recognized" on Raspberry Pi #8

Open jonespoon opened 2 years ago

jonespoon commented 2 years ago

I can successfully compile the sdk on a amd ubuntu machine but failed to do so on raspberry pi 4. It seems to me it is due to the cpu architecture but the document says it supports Raspberry pi The compilation error log is below:

pi@raspberrypi:~/insta/Linux_20210628/CameraSDK $ g++ -v -std=c++11 ./example/main.cc -I./include/ -L./lib/ -lCameraSDK -lpthread -ludev -o ./bin/CameraSDKTest Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/8/lto-wrapper Target: arm-linux-gnueabihf Configured with: ../src/configure -v --with-pkgversion='Raspbian 8.3.0-6+rpi1' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --disable-werror --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf Thread model: posix gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1) COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-I' './include/' '-L./lib/' '-o' './bin/CameraSDKTest' '-shared-libgcc' '-mfloat-abi=hard' '-mfpu=vfp' '-mtls-dialect=gnu' '-marm' '-march=armv6+fp' /usr/lib/gcc/arm-linux-gnueabihf/8/cc1plus -quiet -v -I ./include/ -imultilib . -imultiarch arm-linux-gnueabihf -D_GNU_SOURCE ./example/main.cc -quiet -dumpbase main.cc -mfloat-abi=hard -mfpu=vfp -mtls-dialect=gnu -marm -march=armv6+fp -auxbase main -std=c++11 -version -o /tmp/cc2PBJ3e.s GNU C++11 (Raspbian 8.3.0-6+rpi1) version 8.3.0 (arm-linux-gnueabihf) compiled by GNU C version 8.3.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.20-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring duplicate directory "/usr/include/arm-linux-gnueabihf/c++/8" ignoring nonexistent directory "/usr/local/include/arm-linux-gnueabihf" ignoring nonexistent directory "/usr/lib/gcc/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/include"

include "..." search starts here:

include <...> search starts here:

./include/ /usr/include/c++/8 /usr/include/arm-linux-gnueabihf/c++/8 /usr/include/c++/8/backward /usr/lib/gcc/arm-linux-gnueabihf/8/include /usr/local/include /usr/lib/gcc/arm-linux-gnueabihf/8/include-fixed /usr/include/arm-linux-gnueabihf /usr/include End of search list. GNU C++11 (Raspbian 8.3.0-6+rpi1) version 8.3.0 (arm-linux-gnueabihf) compiled by GNU C version 8.3.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.20-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 7defdc925cf5fede452fc531d54623d1 COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-I' './include/' '-L./lib/' '-o' './bin/CameraSDKTest' '-shared-libgcc' '-mfloat-abi=hard' '-mfpu=vfp' '-mtls-dialect=gnu' '-marm' '-march=armv6+fp' as -v -I ./include/ -march=armv6 -mfloat-abi=hard -mfpu=vfp -meabi=5 -o /tmp/ccNNj58N.o /tmp/cc2PBJ3e.s GNU assembler version 2.31.1 (arm-linux-gnueabihf) using BFD version (GNU Binutils for Raspbian) 2.31.1 COMPILER_PATH=/usr/lib/gcc/arm-linux-gnueabihf/8/:/usr/lib/gcc/arm-linux-gnueabihf/8/:/usr/lib/gcc/arm-linux-gnueabihf/:/usr/lib/gcc/arm-linux-gnueabihf/8/:/usr/lib/gcc/arm-linux-gnueabihf/ LIBRARY_PATH=/usr/lib/gcc/arm-linux-gnueabihf/8/:/usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/:/usr/lib/gcc/arm-linux-gnueabihf/8/../../../:/lib/arm-linux-gnueabihf/:/lib/:/usr/lib/arm-linux-gnueabihf/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-I' './include/' '-L./lib/' '-o' './bin/CameraSDKTest' '-shared-libgcc' '-mfloat-abi=hard' '-mfpu=vfp' '-mtls-dialect=gnu' '-marm' '-march=armv6+fp' /usr/lib/gcc/arm-linux-gnueabihf/8/collect2 -plugin /usr/lib/gcc/arm-linux-gnueabihf/8/liblto_plugin.so -plugin-opt=/usr/lib/gcc/arm-linux-gnueabihf/8/lto-wrapper -plugin-opt=-fresolution=/tmp/ccGdmVpu.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -dynamic-linker /lib/ld-linux-armhf.so.3 -X --hash-style=gnu -m armelf_linux_eabi -o ./bin/CameraSDKTest /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crt1.o /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crti.o /usr/lib/gcc/arm-linux-gnueabihf/8/crtbegin.o -L./lib/ -L/usr/lib/gcc/arm-linux-gnueabihf/8 -L/usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf -L/usr/lib/gcc/arm-linux-gnueabihf/8/../../.. -L/lib/arm-linux-gnueabihf -L/usr/lib/arm-linux-gnueabihf /tmp/ccNNj58N.o -lCameraSDK -lpthread -ludev -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/arm-linux-gnueabihf/8/crtend.o /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crtn.o ./lib//libCameraSDK.so: file not recognized: file format not recognized collect2: error: ld returned 1 exit status

edomil90 commented 2 years ago

same problem here with jetson nano

jonespoon commented 2 years ago

same problem here with jetson nano

A work around is to use OSC commands but be careful of the issues like a few of commands will freeze the camera. And it cannot delete the taken photos in the same power cycle.

OSC delete photo Frozen

edomil90 commented 2 years ago

Thanks for the tip, I use also the OSC commands, but the getLivePreview is disabled. I am interested in streaming a 360 view that is why I am trying to use the SDK

ubi15 commented 1 year ago

I am interested in this as well, we are trying to compile on ARM devices but the released .so does not work there. Could someone like @capjason-insta360 or @capjason read this and provide an arm-compatible shared object?

That would unlock a lot of possible applications for the insta360 products.

Thanks.

ubi15 commented 1 year ago

We found a workaround: you can run the code in a Docker container using an amd64 image. Assuming a raspbian/ubuntu rpi host:

sudo apt-get remove --purge docker docker.io containerd runc
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Install multiplatform support
sudo apt install -y qemu-user-static binfmt-support
# Create builder
docker buildx create --name testbuilder --platform linux/amd64

# THIS: docker build --output type=docker -t devbubu -f SDKDockerfile --platform linux/amd64 --builder testbuilder .
# OR THIS: docker buildx build --output type=image -t devbubu -f SDKDockerfile --platform linux/amd64 --builder testbuilder .
# Or the one working
docker build --load -t devbubu -f SDKDockerfile --platform linux/amd64 --builder testbuilder .
FROM ubuntu 

RUN apt-get update 
RUN apt-get install -y build-essential cmake git
RUN apt-get install -y fswebcam python3

COPY ./cameradk_linux_20220909 /data/ # The insta 360 dev libraries

# Mount some volumes...
ADD ./images /data/images/
# Random command
CMD /usr/bin/python3 -m http.server 80

No way to get an ARM-compatible version of the SDK though: we contacted the assistance but they said they cannot provide it.

Kocicak commented 1 year ago

Hi, has anyone tried SDK using emulator like box86 or similar? I want to use SDK on RPI as well, but this is a deal breaker. Thanks.

Tianweihaihaihai commented 1 year ago

need to contact insta360 support team to get arm sdk https://www.insta360.com/cn/sdk/home