surdo
Posts: 9
Joined: Sun Dec 16, 2012 6:06 pm
Location: Brasilia

Compilation problem due to 32 bit system?

Fri Jul 24, 2020 10:38 am

Dear forum,

I need to build some non-gui console tools from linphone-desktop (a soft phone system). I have the standard Raspberry Pi OS and my hardware is a Pi 4b.

I have been configuring the source (i'm testing a particular version of linphone-desktop 4.2 that is said to have built properly on a Pi 3) with the following preparatory step:

Code: Select all

./prepare.py no-ui -DENABLE_OPENH264=ON -DENABLE_WEBRTC_AEC=OFF -DENABLE_UNIT_TESTS=OFF -DENABLE_MKV=OFF -DENABLE_FFMPEG=ON -DENABLE_CXX_WRAPPER=OFF -DENABLE_NON_FREE_CODECS=ON -DENABLE_VCARD=OFF -DENABLE_BV16=OFF -DENABLE_V4L=OFF 
This runs with no problems however the compilation process with "make -j4" is throwing errors such as following:

Code: Select all

[ 95%] Building C object CMakeFiles/opus.dir/celt/arm/celt_neon_intr.c.o
In file included from /home/iain/linphone-desktop-release-4.2/linphone-sdk/external/opus/celt/arm/celt_neon_intr.c:37:
/home/iain/linphone-desktop-release-4.2/linphone-sdk/external/opus/celt/arm/celt_neon_intr.c: In function ‘xcorr_kernel_neon_float’:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:6740:1: error: inlining failed in call to always_inline ‘vdupq_n_f32’: target specific option mismatch
 vdupq_n_f32 (float32_t __a)
 ^~~~~~~~~~~
/home/iain/linphone-desktop-release-4.2/linphone-sdk/external/opus/celt/arm/celt_neon_intr.c:118:11: note: called from here
    SUMM = vdupq_n_f32(0);
           ^~~~~~~~~~~~~~
In file included from /home/iain/linphone-desktop-release-4.2/linphone-sdk/external/opus/celt/arm/celt_neon_intr.c:37:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:10392:1: error: inlining failed in call to always_inline ‘vld1q_f32’: target specific option mismatch
 vld1q_f32 (const float32_t * __a) 
So this looks like a problem with the 32 bit system and from Googling it seems like it is possible to "adjust the target". This however i don't know how to do. Other people have mentioned swap size in relation to compilation failure with linphone-desktop.

Can anyone please suggest what I can do?

Thanks. All the best,

User avatar
Paeryn
Posts: 3470
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Compilation problem due to 32 bit system?

Sat Jul 25, 2020 1:02 am

By default in RPiOS gcc is set to generate ARMv6 compatible code so that the resulting executable will run on all models of RPi including the 0 and 1 (which don't have NEON units). It looks like the configuration setup hasn't explicitly told gcc to generate code targeting ARMv7 with NEON which results in gcc telling you that the target needed for the intrinsic function vdupq_n_f32 doesn't match the target it is compiling for.

Telling gcc to do that is simple but I have no idea what option(s) need to be passed to linphone's config program (I assume that is what prepare.py is) to make it add the needed options when calling gcc. Edit: No idea what this prepare.py is, it doesn't seem to be on linphone's git tree.

The simplest options gcc needs are

Code: Select all

-mcpu=native -mfpu=auto
that tells gcc to generate code targeting the CPU it is compiling on (so on an RPi 2, 3 or 4 it will target ARMv7 with NEON). You could specify the exact cpu and fpu you want to target but usually you want to target the machine you are running on.
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

surdo
Posts: 9
Joined: Sun Dec 16, 2012 6:06 pm
Location: Brasilia

Re: Compilation problem due to 32 bit system?

Sat Jul 25, 2020 12:20 pm

Thanks very much Paeryn for the detailed answer. I was able to compile this old release of 4.2 (which has prepare.py, the version of 4.2 and anything more recent on the git do not) and get linphone-daemon working with:

-DCMAKE_C_FLAGS="-mcpu=native -mfpu=auto"

I also tried compiling the latest branch using cmake directly and after having built Qt5.12. It almost compiled to the end but ran into another unrelated issue that I'll try and resolve.

All the best,

idantic
Posts: 2
Joined: Mon Jul 27, 2020 7:13 am

Re: Compilation problem due to 32 bit system?

Mon Jul 27, 2020 7:16 am

surdo wrote: Dear forum,

I need to build some non-gui console tools from linphone-desktop (a soft phone system). I have the standard Raspberry Pi OS and my hardware is a Pi 4b.

I have been configuring the source (i'm testing a particular version of linphone-desktop 4.2 that is said to have built properly on a Pi 3) with the following preparatory step:
Hello,

I am also looking to compile linphone no gui for raspberry. Can you tell me where you found the source code? (linphone 4.2)

Thanks, All the best.

surdo
Posts: 9
Joined: Sun Dec 16, 2012 6:06 pm
Location: Brasilia

Re: Compilation problem due to 32 bit system?

Mon Jul 27, 2020 9:43 am

Hello,

Version 4.2 exists as branch in the git source, however that version doesn't have the prepare.py file used to compile the non-gui tools. A member of the linphone-dev email list sent me an earlier version of 4.2 which does have it and then from within that release, he clones the latest "linphone-sdk" directory to facilitate the build. What might be best, as I'm not sure if i can attach the whole archive that he sent here, is that i write a little tutorial here and I investigate how get the same version via checking out a specific commit in the git.
By the way, the technique I used does not build the linphone app in non-gui mode, it builds the following binaries:

belr-compiler linphone-daemon lp-sendmsg xml2lpc_test
belr-parse linphone-daemon-pipetest lp-test-ecc
linphonec lp-auto-answer mediastream
linphonecsh lpc2xml_test mkvstream

I'm using linphone-daemon to make and receive calls via shell scripts. Will these binaries suit your purposes?

Cheers

surdo
Posts: 9
Joined: Sun Dec 16, 2012 6:06 pm
Location: Brasilia

Re: Compilation problem due to 32 bit system?

Mon Jul 27, 2020 12:26 pm

OK, the following procedure built the non-gui binaries using the standard git source:

1. clone the git with:

Code: Select all

git clone https://gitlab.linphone.org/BC/public/linphone-desktop.git --recursive
2. Using "git log" within the cloned linphone-desktop directory, I chose the last commit of 2018 (which has the prepare.py file and as I discovered later, builds correctly on the pi) and checked it out with:

Code: Select all

git checkout 3098bfe222e94f5f07263649ab60b1108206a393
3. Created my own branch so as to enable me to later commit my changes and return to master branch (or others) if needed:

Code: Select all

git checkout -b mybranch
4. I removed the linphone-sdk directory with:

Code: Select all

rm -rf linphone-sdk
and then cloned the current linphone-sdk with:

Code: Select all

git clone https://gitlab.linphone.org/BC/public/linphone-sdk --recursive
5. Committed my changes with

Code: Select all

git commit -am "my workings with last 2018 commit and with current linphone-sdk"
6. Install dependencies. This from an old tutorial here: https://wiki.linphone.org/xwiki/wiki/pu ... erry%20Pi/

Code: Select all

sudo apt-get install cmake automake autoconf libtool intltool yasm libasound2-dev libpulse-dev libv4l-dev nasm git libglew-dev
7. Configured with the following. Note that the -DCMAKE_C_FLAGS="-mcpu=native -mfpu=auto" argument was needed to get the source to compile on the Pi 4b with the 32bit Raspberry Pi OS.

Code: Select all

./prepare.py no-ui -DCMAKE_C_FLAGS="-mcpu=native -mfpu=auto" -DENABLE_OPENH264=ON -DENABLE_WEBRTC_AEC=OFF -DENABLE_UNIT_TESTS=OFF -DENABLE_MKV=OFF -DENABLE_FFMPEG=ON -DENABLE_CXX_WRAPPER=OFF -DENABLE_NON_FREE_CODECS=ON -DENABLE_VCARD=OFF -DENABLE_BV16=OFF -DENABLE_V4L=OFF
8. Compile with make. Use the -j argument to match the number of cores your Pi has:

Code: Select all

make -j4
9. If all goes well, the binaries will be built in: linphone-desktop/OUTPUT/no-ui/bin/

Note: When I first ran linphone-daemon I ran into an Sqlite3 database error which was resolved by creating a new config directory:

Code: Select all

mkdir ~/.local/share/linphone
Hope this helps. Good luck!

idantic
Posts: 2
Joined: Mon Jul 27, 2020 7:13 am

Re: Compilation problem due to 32 bit system?

Tue Jul 28, 2020 4:09 pm

Thank you very much for your tutorial. I'm going to try.

velvettiere
Posts: 13
Joined: Sat Apr 23, 2016 6:31 pm

Re: Compilation problem due to 32 bit system?

Mon Oct 12, 2020 5:16 am

Do You have resolve This issue? Do You able to compile linphone 4.2 for raspberry pi3?

Thanks.

surdo
Posts: 9
Joined: Sun Dec 16, 2012 6:06 pm
Location: Brasilia

Re: Compilation problem due to 32 bit system?

Mon Oct 12, 2020 9:33 am

I was able to build and use the non-gui binaries of 4.2 as described in the post above on the 27th of July. Good luck.

hsmptg
Posts: 5
Joined: Fri Aug 03, 2012 10:59 am
Location: Porto - Portugal

Re: Compilation problem due to 32 bit system?

Tue Nov 17, 2020 12:50 am

Hi
Can you confirm if with that version, linphonec do not crash with a segmentation fault when running an answer command?
Regards (Abraço ;))

Eirikur
Posts: 156
Joined: Sun Sep 09, 2018 9:43 pm

Re: Compilation problem due to 32 bit system?

Tue Nov 17, 2020 4:54 am

Major congratulations on that git-fu. I've had to do a few things like that lately. It's great that you've broken it down so that people can copy the command lines.

Return to “General discussion”