TelegramMessenger / MTProxy

5.01k stars 831 forks source link

Run on ARM #18

Open SergeyAnuchin opened 6 years ago

SergeyAnuchin commented 6 years ago

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....

stek29 commented 6 years ago

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

Kirya2k commented 6 years ago

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...

khaliullov commented 6 years ago

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.

D13410N3 commented 5 years ago

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

Compiled on ARMv7 successfully

khaliullov commented 5 years ago

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

SergeyAnuchin commented 5 years ago

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

daro-ilovetea commented 5 years ago

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`

kogeler commented 5 years ago

Almost a year has passed. : ((

pokono commented 4 years ago

Any plans on porting it?

Meysam- commented 4 years ago

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

dllz commented 4 years ago

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

John-Lin commented 4 years ago

Compiled failed on ARMv8 on Raspberry Pi 4

Screen Shot 2020-07-12 at 10 56 20 PM
nuBacuk commented 2 years ago
Screenshot 2021-12-01 at 01 31 42

I tried to compile for arm ampere for Oracle, it did not work.

argent-tower commented 2 years ago

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

kingofnull commented 1 year ago

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 .

posti85 commented 7 months ago

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 :(

ShuhaibNC commented 2 months ago

Architecture: ARMv8

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