[OpenSIPS-Users] Cross Compile OpenSIPS ARMv7

Caio caiortp at gmail.com
Tue Oct 20 22:49:58 CEST 2015


Ovidiu,

My Log

echo $CC_EXTRA_OPTS
-march=armv7-a -marm -mthumb-interwork -mfloat-abi=hard -mfpu=neon
--sysroot=/home/caio/fsl-community-bsp/imx6/tmp/sysroots/imx6"

CPU=armv7a
LD=arm-poky-linux-gnueabi-ld
--sysroot=/home/caio/fsl-community-bsp/imx6/tmp/sysroots/imx6

CC=arm-poky-linux-gnueabi-gcc  -march=armv7-a -marm -mthumb-interwork
-mfloat-abi=hard -mfpu=neon
--sysroot=/home/caio/fsl-community-bsp/imx6/tmp/sysroots/imx6


cat Makefile.conf

#DEFS+= -DPKG_MALLOC #Uses a faster malloc (exclusive w/ USE_SHM_MEM)
DEFS+= -DSHM_MMAP #Use mmap instead of SYSV shared memory
DEFS+= -DUSE_MCAST #Compile in support for IP Multicast
DEFS+= -DDISABLE_NAGLE #Disabled the TCP NAgle Algorithm ( lower delay )
DEFS+= -DSTATISTICS #Enables the statistics manager
DEFS+= -DHAVE_RESOLV_RES #Support for changing some of the resolver
parameters
#DEFS+= -DHP_MALLOC #High performance allocator with fine-grained locking
#DEFS+= -DF_MALLOC #An even faster allocator. Not recommended for debugging
#DEFS+= -DF_MALLOC_OPTIMIZATIONS #Remove all internal checks in F_MALLOC
#DEFS+= -DDBG_QM_MALLOC #Allocator used for debugging information
#DEFS+= -DUSE_SHM_MEM #All PKG allocations are mapped to SHM ( exclusive w/
PKG_MALLOC )
#DEFS+= -DDBG_F_MALLOC #TODO ?
#DEFS+= -DNO_DEBUG #Turns off all debug messages
#DEFS+= -DNO_LOG #Completely turns off all the logging
#DEFS+= -DVQ_MALLOC #TODO ?
#DEFS+= -DFAST_LOCK #Uses fast architecture specific locking
#DEFS+= -DUSE_FUTEX #Uses linux futexs with fast architecture specific
locking
DEFS+= -DUSE_SYSV_SEM #Uses SYSV sems for locking ( slower & limited number
of locks
#DEFS+= -DUSE_PTHREAD_MUTEX #Uses pthread mutexes
#DEFS+= -DBUSY_WAIT #Uses busy waiting on the lock
#DEFS+= -DDBG_LOCK #TODO ?
DEFS+= -DNOSMP #Do not use SMP sompliant locking. Faster but won't work on
SMP machines
#DEFS+= -DEXTRA_DEBUG #Compiles in some extra debugging code


 make all
Compiling blacklists.c
In file included from blacklists.h:30:0,
                 from blacklists.c:38:
ip_addr.h: In function 'sockaddr2ip_addr':
ip_addr.h:224:25: warning: cast increases required alignment of target type
[-Wcast-align]
    memcpy(ip->u.addr, &((struct sockaddr_in*)sa)->sin_addr, 4);
                         ^
ip_addr.h:229:25: warning: cast increases required alignment of target type
[-Wcast-align]
    memcpy(ip->u.addr, &((struct sockaddr_in6*)sa)->sin6_addr, 16);
                         ^
In file included from locking.h:66:0,
                 from blacklists.h:32,
                 from blacklists.c:38:
lock_alloc.h: In function 'lock_set_alloc':
lock_alloc.h:70:13: warning: cast increases required alignment of target
type [-Wcast-align]
   ls->locks=(gen_lock_t*)((char*)ls+sizeof(gen_lock_set_t));
             ^
{standard input}: Assembler messages:
{standard input}:105: Error: bad instruction `btsl $0,[r6]'
{standard input}:106: Error: bad instruction `adcl $0,r3'
{standard input}:208: Error: bad instruction `movb $0,(r3)'
{standard input}:305: Error: bad instruction `btsl $0,[r9]'
{standard input}:306: Error: bad instruction `adcl $0,r3'
{standard input}:390: Error: bad instruction `movb $0,(r3)'
{standard input}:436: Error: bad instruction `btsl $0,[r10]'
{standard input}:437: Error: bad instruction `adcl $0,r3'
{standard input}:480: Error: bad instruction `movb $0,(r3)'
{standard input}:526: Error: bad instruction `btsl $0,[r10]'
{standard input}:527: Error: bad instruction `adcl $0,r3'
{standard input}:555: Error: bad instruction `movb $0,(r2)'
{standard input}:619: Error: bad instruction `btsl $0,[r10]'
{standard input}:620: Error: bad instruction `adcl $0,r3'
{standard input}:718: Error: bad instruction `movb $0,(r3)'
{standard input}:3194: Error: bad instruction `btsl $0,[r7]'
{standard input}:3195: Error: bad instruction `adcl $0,r6'
{standard input}:3249: Error: bad instruction `movb $0,(r3)'
{standard input}:3300: Error: bad instruction `btsl $0,[r7]'
{standard input}:3301: Error: bad instruction `adcl $0,r3'
{standard input}:3340: Error: bad instruction `movb $0,(r0)'
{standard input}:3366: Error: bad instruction `btsl $0,[r6]'
{standard input}:3367: Error: bad instruction `adcl $0,r3'
{standard input}:3411: Error: bad instruction `movb $0,(r1)'
{standard input}:3497: Error: bad instruction `btsl $0,[r6]'
{standard input}:3498: Error: bad instruction `adcl $0,r3'
{standard input}:3542: Error: bad instruction `movb $0,(r1)'
{standard input}:3795: Error: bad instruction `btsl $0,[r6]'
{standard input}:3796: Error: bad instruction `adcl $0,r3'
{standard input}:3839: Error: bad instruction `movb $0,(r3)'
{standard input}:3882: Error: bad instruction `btsl $0,[fp]'
{standard input}:3883: Error: bad instruction `adcl $0,r3'
{standard input}:3981: Error: bad instruction `movb $0,(r3)'
{standard input}:4020: Error: bad instruction `btsl $0,[r6]'
{standard input}:4021: Error: bad instruction `adcl $0,r3'
{standard input}:4081: Error: bad instruction `movb $0,(r3)'
{standard input}:4129: Error: bad instruction `btsl $0,[r10]'
{standard input}:4130: Error: bad instruction `adcl $0,r3'
{standard input}:4381: Error: bad instruction `movb $0,(r3)'
{standard input}:4837: Error: bad instruction `btsl $0,[fp]'
{standard input}:4838: Error: bad instruction `adcl $0,r3'
{standard input}:4951: Error: bad instruction `movb $0,(r3)'
{standard input}:5312: Error: bad instruction `btsl $0,[r6]'
{standard input}:5313: Error: bad instruction `adcl $0,r9'
{standard input}:5383: Error: bad instruction `btsl $0,[r8]'
{standard input}:5384: Error: bad instruction `adcl $0,r5'
{standard input}:5471: Error: bad instruction `movb $0,(r3)'
{standard input}:5510: Error: bad instruction `btsl $0,[r6]'
{standard input}:5511: Error: bad instruction `adcl $0,r3'
{standard input}:5557: Error: bad instruction `movb $0,(r3)'
{standard input}:5596: Error: bad instruction `btsl $0,[r9]'
{standard input}:5597: Error: bad instruction `adcl $0,r3'
{standard input}:5628: Error: bad instruction `movb $0,(r3)'
{standard input}:5889: Error: bad instruction `movb $0,(r3)'
{standard input}:5928: Error: bad instruction `btsl $0,[r8]'
{standard input}:5929: Error: bad instruction `adcl $0,r3'
{standard input}:5975: Error: bad instruction `movb $0,(r3)'
{standard input}:6014: Error: bad instruction `btsl $0,[r9]'
{standard input}:6015: Error: bad instruction `adcl $0,r3'
{standard input}:6045: Error: bad instruction `movb $0,(r3)'
{standard input}:6103: Error: bad instruction `btsl $0,[r10]'
{standard input}:6104: Error: bad instruction `adcl $0,r3'
{standard input}:6203: Error: bad instruction `movb $0,(r3)'
{standard input}:6323: Error: bad instruction `btsl $0,[r6]'
{standard input}:6324: Error: bad instruction `adcl $0,r3'
{standard input}:6421: Error: bad instruction `movb $0,(r3)'
{standard input}:6481: Error: bad instruction `btsl $0,[r9]'
{standard input}:6482: Error: bad instruction `adcl $0,r3'
{standard input}:6582: Error: bad instruction `movb $0,(r3)'
{standard input}:7101: Error: bad instruction `btsl $0,[r1]'
{standard input}:7102: Error: bad instruction `adcl $0,r3'
{standard input}:7232: Error: bad instruction `movb $0,(r3)'
{standard input}:7394: Error: bad instruction `btsl $0,[r2]'
{standard input}:7395: Error: bad instruction `adcl $0,r1'
{standard input}:7527: Error: bad instruction `movb $0,(r3)'
{standard input}:7803: Error: bad instruction `btsl $0,[r6]'
{standard input}:7804: Error: bad instruction `adcl $0,r3'
{standard input}:7912: Error: bad instruction `movb $0,(r3)'
{standard input}:8809: Error: bad instruction `btsl $0,[r4]'
{standard input}:8810: Error: bad instruction `adcl $0,r3'
{standard input}:8852: Error: bad instruction `movb $0,(r1)'
{standard input}:8883: Error: bad instruction `btsl $0,[r5]'
{standard input}:8884: Error: bad instruction `adcl $0,r3'
{standard input}:8930: Error: bad instruction `movb $0,(r3)'
{standard input}:8980: Error: bad instruction `btsl $0,[r10]'
{standard input}:8981: Error: bad instruction `adcl $0,r3'
{standard input}:9020: Error: bad instruction `movb $0,(r0)'
make: *** [blacklists.o] Error 1





Thank you.

Best Regards,

Caio Pereira


2015-10-20 18:28 GMT-02:00 Caio <caiortp at gmail.com>:

> Ovidiu Sas,
>
>
> In the Makefile.defs there a code to get the ARCH
>
>   90 ARCH := $(shell $(GETARCH) |sed -e s/i.86/i386/ -e s/sun4u/sparc64/  \
>   91                         -e s/armv4l/arm/ -e "s/Power Macintosh/ppc/" \
>   92                         -e s/sun4v/sparc64/ -e "s/cobalt/mips2/" \
>   93                         -e s/amd64/x86_64/ )
>
>
> I tried export ARCH=armv7 but because of the code, the ARCH will be always
> x86-64 (host machine) .
>
> I added the CFLAGS to the armv7 arch in the Makefile.defs
>
>  918 ifeq    ($(ARCH), armv7)
>  919                 # if gcc
>  920 ifeq            ($(CC_NAME), gcc)
>  921                                 #common stuff
>  922                                  CFLAGS+=-O0 -mfloat-abi=hard
> -march=armv7-a -mthumb-interwork -Wcast-align $(PROFILE) \
>  923                                 -mfloat-abi=hard -mfpu=neon
> -mtune=cortex-a9 -Wall
>  924 endif
>  925 endif
>
>
> Which is the best way to pass the arch parameter to the Makefile?
>
> (sorry for the typo in the last email).
>
> Thank you very much.
>
> Best Regards,
>
> Caio Pereira
>
> 2015-10-20 17:17 GMT-02:00 Ovidiu Sas <osas at voipembedded.com>:
>
>> The optimizations are done via the compiler flags: CFLAGS.
>> You need to replace -09 with -00.
>> You need to check if you are using a native compiler or a cross one
>> and adjust the proper flags inside Makefile.defs.
>>
>> Regards,
>> Ovidiu Sas
>>
>> On Tue, Oct 20, 2015 at 1:53 PM, Caio <caiortp at gmail.com> wrote:
>> > Hello, Oividiu!
>> >
>> > Sorry for the delay, I was on vacation.
>> >
>> > I'm writing a recipe to Yocto.
>> > This ARM cpu is new (armv7-a), but I see that is not compatible with
>> > opensips's optimization.
>> > I'm new with opensips, I have only  tested in my host machine x86-64.
>> >
>> >
>> > Do you know with parameters I need to comment in the Makefile.conf to
>> have a
>> > basic compilation without any optimization in the opensips?
>> >
>> >
>> > #DEFS+= -DPKG_MALLOC #Uses a faster malloc (exclusive w/ USE_SHM_MEM)
>> > #DEFS+= -DSHM_MMAP #Use mmap instead of SYSV shared memory
>> > DEFS+= -DUSE_MCAST #Compile in support for IP Multicast
>> > DEFS+= -DDISABLE_NAGLE #Disabled the TCP NAgle Algorithm ( lower delay )
>> > DEFS+= -DSTATISTICS #Enables the statistics manager
>> > DEFS+= -DHAVE_RESOLV_RES #Support for changing some of the resolver
>> > parameters
>> > #DEFS+= -DHP_MALLOC #High performance allocator with fine-grained
>> locking
>> > DEFS+= -DF_MALLOC #An even faster allocator. Not recommended for
>> debugging
>> > #DEFS+= -DF_MALLOC_OPTIMIZATIONS #Remove all internal checks in F_MALLOC
>> > #DEFS+= -DDBG_QM_MALLOC #Allocator used for debugging information
>> > #DEFS+= -DUSE_SHM_MEM #All PKG allocations are mapped to SHM (
>> exclusive w/
>> > PKG_MALLOC )
>> > #DEFS+= -DDBG_F_MALLOC #TODO ?
>> > #DEFS+= -DNO_DEBUG #Turns off all debug messages
>> > #DEFS+= -DNO_LOG #Completely turns off all the logging
>> > #DEFS+= -DVQ_MALLOC #TODO ?
>> > #DEFS+= -DFAST_LOCK #Uses fast architecture specific locking
>> > #DEFS+= -DUSE_FUTEX #Uses linux futexs with fast architecture specific
>> > locking
>> > #DEFS+= -DUSE_SYSV_SEM #Uses SYSV sems for locking ( slower & limited
>> number
>> > of locks
>> > #DEFS+= -DUSE_PTHREAD_MUTEX #Uses pthread mutexes
>> > #DEFS+= -DBUSY_WAIT #Uses busy waiting on the lock
>> > #DEFS+= -DDBG_LOCK #TODO ?
>> >
>> >
>> >
>> > Thank you!
>> >
>> > Best Regards,
>> >
>> > Caio Pereira
>> >
>> >
>> > 2015-09-23 21:48 GMT-03:00 Ovidiu Sas <osas at voipembedded.com>:
>> >>
>> >> Hello Caio,
>> >>
>> >> Have you managed to cross compile opensips?
>> >> The optimizations do not work for older type of arm CPUs.
>> >> Did you experienced any issues running opensips on arm?
>> >>
>> >> Regards,
>> >> Ovidiu Sas
>> >>
>> >> On Thu, Sep 17, 2015 at 2:51 PM, Caio <caiortp at gmail.com> wrote:
>> >> > Hello,
>> >> >
>> >> > I would like to cross compile the opensips to ARMv7 architecture
>> >> > (Freescale
>> >> > IMX6).
>> >> > I saw that there's some optimization in assembly to lock functions.
>> >> > There's some configuration in the Makeconfig.conf options that I need
>> >> > disable or enable to able the opensips run in my target architecutre?
>> >> >
>> >> > Thank you very much.
>> >> >
>> >> > Best Regards
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > ----------------------------------------------
>> >> > Caio Pereira
>> >> >
>> >> > _______________________________________________
>> >> > Users mailing list
>> >> > Users at lists.opensips.org
>> >> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> VoIP Embedded, Inc.
>> >> http://www.voipembedded.com
>> >>
>> >> _______________________________________________
>> >> Users mailing list
>> >> Users at lists.opensips.org
>> >> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>> >
>> >
>> >
>> >
>> > --
>> > ----------------------------------------------
>> > Caio Pereira
>> >
>> > _______________________________________________
>> > Users mailing list
>> > Users at lists.opensips.org
>> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>> >
>>
>>
>>
>> --
>> VoIP Embedded, Inc.
>> http://www.voipembedded.com
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>
>
>
> --
> ----------------------------------------------
> Caio Pereira
>



-- 
----------------------------------------------
Caio Pereira
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20151020/7d381a74/attachment-0001.htm>


More information about the Users mailing list