BelledonneCommunications / linphone-sdk

Mirror for linphone-sdk (https://gitlab.linphone.org/BC/public/linphone-sdk.git)
GNU Affero General Public License v3.0
106 stars 81 forks source link

[Bug]: Unable to compile on Raspberry Pi Zero 2 : hangs on belle_sip_messageParser #438

Closed samy closed 4 days ago

samy commented 1 week ago

Context

I'm trying to compile Linphone SDK on a Raspberry Pi Zero 2, to use it to connect old phones using SIP protocol (on a random way, I named this project "bar-roulette", I want to put phones on bars, when you pick up the phone, you are connected to a random bar, like "Chatroulette" :)

General information

Expected behaviour

The compilation must finish without problem

To Reproduce

  1. Install the following packages sudo apt install -y cmake automake autoconf libtool intltool yasm libasound2-dev libpulse-dev libv4l-dev nasm git libglew-dev ninja-build gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
  2. Clone the SDK with recursive option
  3. In the SDK folder, use cmake with following options: cmake . -DLINPHONESDK_PLATFORM=Desktop -DENABLE_OPENH264=ON -DENABLE_LIME_X3DH=OFF -DENABLE_ADVANCED_IM=OFF -DENABLE_WEBRTC_AEC=OFF -DENABLE_UNIT_TESTS=OFF -DENABLE_MKV=OFF -DENABLE_FFMPEG=OFF -DENABLE_CXX_WRAPPER=OFF -DENABLE_NON_FREE_CODECS=ON -DENABLE_VCARD=OFF -DENABLE_BV16=OFF -DENABLE_V4L=ON -DENABLE_CONSOLE_UI=ON -DENABLE_DAEMON=ON -DENABLE_FLEXIAPI=OFF -DENABLE_QRCODE=OFF -DENABLE_VIDEO=OFF -DCMAKE_C_FLAGS="-O1 -march=armv8-a+simd+crypto+crc+sb -mtune=cortex-a53" -DCMAKE_CXX_FLAGS="-O1 -march=armv8-a+simd+crypto+crc+sb -mtune=cortex-a53" -DENABLE_SQLITE=OFF -DENABLE_DB_STORAGE=OFF -DENABLE_ZRTP=OFF
  4. Launch compilation using make -d
  5. The compilation stops on: bellesip.dir/grammars/belle_sip_messageParser.c.o and doesn't continue (it don't crash, it just stops on this line)

Additional context

If I launch htop on another session, the compilation process is marked as "d" (uninterruptible sleep)

I needed to remove SQLite (using the CMAKE flag) because I had same problem with SQLite: the compilation stopped on SQLite line.

SDK logs URL

No response

samy commented 1 week ago

I will try also to compile it using WSL2 (but using RPi toolchain)

Viish commented 1 week ago

Hi @samy,

You can try using the master branch of linphone-sdk, we've removed belle-sip dependency to AntLR.

Cheers,

samy commented 1 week ago

Thanks I wll try with master branch, I'll post here the result :)

samy commented 1 week ago

On master branch the cmake command doesn't succeed cmake . -DLINPHONESDK_PLATFORM=Desktop -DENABLE_OPENH264=ON -DENABLE_LIME_X3DH=OFF -DENABLE_ADVANCED_IM=OFF -DENABLE_WEBRTC_AEC=OFF -DENABLE_UNIT_TESTS=OFF -DENABLE_MKV=OFF -DENABLE_FFMPEG=OFF -DENABLE_CXX_WRAPPER=OFF -DENABLE_NON_FREE_CODECS=ON -DENABLE_VCARD=OFF -DENABLE_BV16=OFF -DENABLE_V4L=ON -DENABLE_CONSOLE_UI=ON -DENABLE_DAEMON=ON -DENABLE_FLEXIAPI=OFF -DENABLE_QRCODE=OFF -DENABLE_VIDEO=OFF -DCMAKE_C_FLAGS="-march=armv8-a+simd+crypto+crc+sb -mtune=cortex-a53" -DCMAKE_CXX_FLAGS="-march=armv8-a+simd+crypto+crc+sb -mtune=cortex-a53" -DENABLE_OPENH264=OFF -DENABLE_PYTHON_WRAPPER=OFF -DENABLE_JAVA_WRAPPER=OFF -DENABLE_CSHARP_WRAPPER=OFF -DENABLE_CXX_WRAPPER=OFF -DENABLE_DOC=OFF

ENABLE_HW_SANITIZER not defined
ENABLE_UNIT_TESTS already defined
ENABLE_WINDOWS_TOOLS_CHECK not defined
ENABLE_AMRNB already defined
ENABLE_AMRWB already defined
ENABLE_WASAPI not defined
ENABLE_AV1 not defined
ENABLE_FFMPEG already defined
ENABLE_H263 not defined
ENABLE_H263P not defined
ENABLE_MPEG4 not defined
ENABLE_JPEG not defined
ENABLE_LIBYUV not defined
ENABLE_OPENH264 already defined
ENABLE_EMBEDDED_OPENH264 not defined
ENABLE_QRCODE already defined
ENABLE_V4L already defined
ENABLE_VPX not defined
ENABLE_MSWINRTVIDEO not defined
ENABLE_DNS_SERVICE not defined
ENABLE_MICROSOFT_STORE_APP not defined
ENABLE_EKT_SERVER_PLUGIN already defined
ENABLE_LIME_X3DH already defined
ENABLE_OPENSSL already defined
ENABLE_PQCRYPTO already defined
ENABLE_ZRTP already defined
ENABLE_GOCLEAR already defined
ENABLE_SWIFT_WRAPPER_COMPILATION not defined
ENABLE_SWIFT_DOC not defined
ENABLE_AAUDIO not defined
ENABLE_OBOE not defined
ENABLE_CAMERA2 not defined
Generated source code in /home/samy/linphone-sdk/external/decaf/src/GENERATED
Target architecture is 64 bits general purpose(arm64 shall use this)
-- JsonCpp Version: 1.9.5
######################################################
# jsoncpp should not be configured & built in the jsoncpp source directory
# You must run cmake in a build directory.
# For example:
# mkdir jsoncpp-Sandbox ; cd jsoncpp-sandbox
# git clone https://github.com/open-source-parsers/jsoncpp.git # or download & unpack the source tarball
# mkdir jsoncpp-build
# this will create the following directory structure
#
# jsoncpp-Sandbox
#  +--jsoncpp
#  +--jsoncpp-build
#
# Then you can proceed to configure and build
# by using the following commands
#
# cd jsoncpp-build
# cmake ../jsoncpp # or ccmake, or cmake-gui
# make
#
# NOTE: Given that you already tried to make an in-source build
#       CMake have already created several files & directories
#       in your source tree. run 'git status' to find them and
#       remove them by doing:
#
#       cd jsoncpp-Sandbox/jsoncpp
#       git clean -n -d
#       git clean -f -d
#       git checkout --
#
######################################################
CMake Error at external/jsoncpp/include/PreventInSourceBuilds.cmake:41 (message):
  Quitting configuration
Call Stack (most recent call first):
  external/jsoncpp/include/PreventInSourceBuilds.cmake:45 (AssureOutOfSourceBuilds)
  external/jsoncpp/CMakeLists.txt:71 (include)

I found this protobuf issue about it: https://github.com/protocolbuffers/protobuf/issues/10749 (but doesn't know if it applies here)

Viish commented 1 week ago

Hi @samy,

First of all, you have both -DENABLE_OPENH264=ON and -DENABLE_OPENH264=OFF in your cmake command line, you should remove one of them.

That being said, the way of using CMake has changed, you need to set the preset and the build directory like this: cmake --preset=default -B build-desktop <OPTIONS>. Everything is explained in the README.

Cheers,

samy commented 6 days ago

I finally succeeded on compiling the SDK (on master branch) using https://github.com/ptrsr/pi-ci project (it took around 5 hours, but it compiled!)

But when I launch the linphonecsh command on a real PI, I have this error message:

./linphonecsh: error while loading shared libraries: libortp.so.15: cannot open shared object file: No such file or directory

Perhaps too many CMAKE flags disabled required features ?

I will retry on 5.3.90 tag (for 5.3 branch) and if it don't work, on last tag of 5.2 branch

samy commented 5 days ago

I retried, but the error is not on liblinphone.so.10 The most strange thing is the fact the executable works on the Pi "emulator", on same file path (I recreated the same folder structure) But when I rsync the folder build-desktop folder on the Pi, and if I try to run the executable "linphonec", I have this error

./linphonec: error while loading shared libraries: liblinphone.so.10: cannot open shared object file: No such file or directory

Probably I miss something (gcc version and OS are the same on both machines)

EDIT: it seems to be related I compiled and tested the binary under the root account, and I try on the real Pi using a user account, not root. So I need to play with ldconfig, etc

EDIT2: I finally succeeded on compiling and making a working executable using BUILD_SHARED_LIBS=OFF

EDIT3: still problems about sip_grammar, but solved by copying the share/belr/grammars folder structure to the same folder as the linphone binaries.

AND IT WORKS \o/ YEAH

Thanks @Viish for your advices