MTProxy icon indicating copy to clipboard operation
MTProxy copied to clipboard

Run on ARM

Open SergeyAnuchin opened this issue 7 years ago • 17 comments

Can't build on Ubuntu 16.04 ARMv71 (scaleway hosting)

cc: error: unrecognized argument in option ‘-march=core2’ cc: note: valid arguments to ‘-march=’ are: armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6 armv6-m armv6j armv6k armv6kz armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m armv7-r armv7e-m armv7ve armv8-a armv8-a+crc armv8.1-a armv8.1-a+crc iwmmxt iwmmxt2 native cc: error: unrecognized command line option ‘-m64’ cc: error: unrecognized command line option ‘-mpclmul’ cc: error: unrecognized command line option ‘-mfpmath=sse’ cc: error: unrecognized command line option ‘-mssse3’

Docker image not working same way....

SergeyAnuchin avatar May 31 '18 05:05 SergeyAnuchin

It's not compatible with arm at all -- there are some hacks and/or inline assembly

stek29 avatar May 31 '18 06:05 stek29

If you are going to port sourcecode for arm, please do not use arm-specific instructions as you would like to have crosscode for mips/mipscel too. Plz...

Kirya2k avatar Jun 01 '18 20:06 Kirya2k

It seems that ARMv7 does not have CRC32x assembler directives (possible SSE4 extensions). I have tried to compile using following flags:

+CFLAGS = $(ARCH) -O3 -std=gnu11 -Wall -mtune=cortex-a9 -march=armv7-a -mfpu=vfp -mfloat-abi=softfp -fno-strict-aliasing -fno-strict-overflow -fwrapv -DAES=1 -DCOMMIT=\"${COMMIT}\" -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64

but without success:

/opt/tmp/ccB39ZkK.s:34: Error: selected processor does not support `crc32b (r3),r2' in ARM mode
/opt/tmp/ccB39ZkK.s:52: Error: bad instruction `crc32l (ip),r2'
/opt/tmp/ccB39ZkK.s:73: Error: selected processor does not support `crc32b (r3),r0' in ARM mode
/opt/tmp/ccB39ZkK.s:83: Error: selected processor does not support `crc32b (r2),r0' in ARM mode
/opt/tmp/ccB39ZkK.s:93: Error: selected processor does not support `crc32b (r3),r0' in ARM mode
make: *** [Makefile:89: objs/common/crc32c.o] Error 1

So, the only way is to implement them (CRC32 instuctions) on C by modification of crc32c.c.

khaliullov avatar Jun 08 '18 21:06 khaliullov

A little patch (maybe it even works on MIPS, idk) https://github.com/ICQFan4ever/MTProxyARMPatch

Compiled on ARMv7 successfully

D13410N3 avatar Feb 18 '19 21:02 D13410N3

@ICQFan4ever thank you! Just checked - and it works on my Raspberry Pi 3+

khaliullov avatar Feb 19 '19 22:02 khaliullov

A little patch (maybe it even works on MIPS, idk) https://github.com/ICQFan4ever/MTProxyARMPatch

Compiled on ARMv7 successfully

Thank you! Compiled successfully on

lscpu Architecture: armv7l Byte Order: Little Endian Model name: ARMv7 Processor rev 2 (v7l)

./mtproto-proxy --help [25630][2019-02-20 17:38:47.421699 local] Invoking engine mtproxy-0.01 compiled at Feb 20 2019 17:34:49 by gcc 5.4.0 20160609 32-bit after commit 2c942119c4ee340c80922ba11d14fb3b10d5e654 usage: ./mtproto-proxy [-v] [-6] [-p] [-H{,}] [-M] [-u] [-b] [-c] [-l] [-W] mtproxy-0.01 compiled at Feb 20 2019 17:34:49 by gcc 5.4.0 20160609 32-bit after commit 2c942119c4ee340c80922ba11d14fb3b10d5e654

SergeyAnuchin avatar Feb 20 '19 17:02 SergeyAnuchin

A little patch (maybe it even works on MIPS, idk) https://github.com/ICQFan4ever/MTProxyARMPatch

Not working (any more?) on ARM:

`common/crc32c.c: In function ‘crc32c_partial_sse42_clmul’: common/crc32c.c:406:14: warning: implicit declaration of function ‘__builtin_ia32_pclmulqdq128’ [-Wimplicit-function-declaration] v2di F = __builtin_ia32_pclmulqdq128 (D, K, 0x00) ^ __builtin_ia32_pclmulqd

common/crc32c.c:406:14: error: incompatible types when initializing type ‘v2di {aka __vector(2) long long int}’ using type ‘int’ common/crc32c.c:471:14: error: incompatible types when initializing type ‘v2di {aka __vector(2) long long int}’ using type ‘int’ v2di F = __builtin_ia32_pclmulqdq128 (D, K, 0x00) ^ __builtin_ia32_pclmulqd`

daro-ilovetea avatar Mar 21 '19 11:03 daro-ilovetea

Almost a year has passed. : ((

kogeler avatar Apr 13 '19 19:04 kogeler

Any plans on porting it?

pokono avatar Jan 02 '20 23:01 pokono

A little patch (maybe it even works on MIPS, idk) https://github.com/ICQFan4ever/MTProxyARMPatch

Compiled on ARMv7 successfully

Thank you! It compiles successfully on my Raspberry pi 4b :D

Meysam- avatar May 20 '20 22:05 Meysam-

A little patch (maybe it even works on MIPS, idk) https://github.com/ICQFan4ever/MTProxyARMPatch

Compiled on ARMv7 successfully

Can add that the patch works on Raspberry Pi 3 in 2020

dllz avatar Jul 07 '20 13:07 dllz

Compiled failed on ARMv8 on Raspberry Pi 4 Screen Shot 2020-07-12 at 10 56 20 PM

John-Lin avatar Jul 12 '20 14:07 John-Lin

Screenshot 2021-12-01 at 01 31 42 I tried to compile for arm ampere for Oracle, it did not work.

nuBacuk avatar Nov 30 '21 22:11 nuBacuk

I tried to compile for arm ampere for Oracle, it did not work. lscpu listing is on the screenshot image

argent-tower avatar Oct 30 '22 11:10 argent-tower

A little patch (maybe it even works on MIPS, idk) https://github.com/ICQFan4ever/MTProxyARMPatch

Compiled on ARMv7 successfully

Thanks a lot it worked for Orange PI PC. I think it at least works at most of the armhf platforms .

kingofnull avatar Dec 01 '22 06:12 kingofnull

The patch output was:

$ patch -p1 < arm.patch
patching file Makefile
Hunk #2 FAILED at 13.
1 out of 2 hunks FAILED -- saving rejects to file Makefile.rej
patching file common/cpuid.c
patching file common/crc32.c
patching file common/crc32c.c
patching file common/precise-time.h
patching file common/server-functions.h

and then the make command execution didn't work :(

posti85 avatar Mar 24 '24 09:03 posti85

Architecture: ARMv8

Screenshot_2024-08-30-10-14-58-03_84d3000e3f4017145260f7618db1d683

ShuhaibNC avatar Aug 30 '24 04:08 ShuhaibNC