Infactum / tg2sip

Telegram <-> SIP voice gateway
GNU General Public License v2.0
273 stars 104 forks source link

Compiling on AARCH64 #49

Open IchthysMaranathaCopy opened 3 years ago

IchthysMaranathaCopy commented 3 years ago

Big thanks to Infactum for this wonderful bridge

This is for those wishing to use tg2sip on AARCH64 platforms like AWS or Oracle Cloud (where you can get a 4 core 24 GB RAM ARM instance in the always free tier). May also be applicable to other ARM platforms. 1) pjproject will not compile with webrtc and will throw an error that emmintrin.h is not available. This is due to sse2 not being available on ARM. You can use sse2neon.h from https://github.com/DLTcollab/sse2neon and replace #include accordingly in aec_core_sse2.c and aec_rdft_sse2.c 2) During final build there will be an error that target machine, endianess etc is not defined. This is due to lack of 'aarch64' recognition. You could modify final else construct like so in config.h for pj

#else
#   define PJ_HAS_PENTIUM   0
#   define PJ_IS_LITTLE_ENDIAN  1
#   define PJ_IS_BIG_ENDIAN 0
#   define PJ_M_ARM7        1
#   define PJ_M_NAME        "armv7"
#endif

Build will succeed after these changes. Have attached working binaries compiled on Ubuntu 20.04 AARCH64

tg2sipAARCH64Ubuntu20.zip

xhemp commented 2 years ago

@IchthysMaranathaCopy Just wondering if you managed to compile with the new tdlib? I am having no luck with that. Thanks!

IchthysMaranatha commented 2 years ago

I didn't have any problems compiling the latest tg2sip with tdlib 1.7.10 Just make sure you download the correct commit level code for tdlib, apply the patches (I looked at the patch files in buildenv and made the changes manually) and build tdlib followed by the new tg2sip https://github.com/tdlib/td/tree/a53cb30e99f937cfd64e0266fa558785a184a553

xhemp commented 2 years ago

I've tried to compile it and it fails at 97% when compiling sip2tg:


#0 3105.6 In file included from /tg2sip/tg2sip/main.cpp:23:
#0 3105.6 /tg2sip/tg2sip/queue.h:36:18: error: 'std::optional' has not been declared
#0 3105.6    36 |     void emplace(std::optional<T> &&value) {

I have been trying to workaround it but not been able to. If you are able to post your binaries that would be great. Thanks!

IchthysMaranatha commented 2 years ago

No problem, have attached binaries tg2siptdlib1.7.10Ubuntu20AARCH64.zip

xhemp commented 2 years ago

Working perfectly here, @IchthysMaranatha , appreciate the help!