Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure on Linux #2519

Closed
par6n opened this issue Oct 11, 2016 · 22 comments
Closed

Build failure on Linux #2519

par6n opened this issue Oct 11, 2016 · 22 comments
Labels

Comments

@par6n
Copy link

par6n commented Oct 11, 2016

Build using GYP/CMake will be failed on Linux.

[ 76%] Linking CXX executable Telegram
/usr/local/tdesktop/Qt-5.6.0/lib/libQt5Network.a(qsslsocket_openssl_symbols.o): In function `q_EC_curve_nist2nid(char const*)':
/home/ehsaan/TBuild/Libraries/qt5_6_0/qtbase/src/network/ssl/qsslsocket_openssl_symbols.cpp:426: undefined reference to `EC_curve_nist2nid'
collect2: error: ld returned 1 exit status
CMakeFiles/Telegram.dir/build.make:12336: recipe for target 'Telegram' failed
make[2]: *** [Telegram] Error 1
CMakeFiles/Makefile2:238: recipe for target 'CMakeFiles/Telegram.dir/all' failed
make[1]: *** [CMakeFiles/Telegram.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Needed a fast fix.

@john-preston
Copy link
Member

It is not failing in travis (most of the times, there is some bug with dependencies, but that has nothing to do with openssl linking problems), see for example:

https://travis-ci.org/telegramdesktop/tdesktop/jobs/166813384

I don't know why it fails in your system specifically :( Are you using custom built openssl or your system openssl (libssl / libcrypto) for linking? Some guys from stackoverflow have the same problem:

http://stackoverflow.com/questions/35627998/linking-error-libqt5network-so-undefined-reference-to-ec-curve-nist2nid

@par6n
Copy link
Author

par6n commented Oct 11, 2016

@john-preston I followed your instructions step by step, didn't improvise or skipped something. I'm gonna build OpenSSL again and try again.
P.S.: Why make on Telegram/out/debug|release takes sooooooooooooooooooooo long? :(

@john-preston
Copy link
Member

@EhsaanF on Debug it should not take long, about 5-10 seconds. On release it is very long because of link time optimizations. They can be disabled in .gyp files if you don't want to wait so much - just remove all "-flto" flags from tdesktop/Telegram/gyp/telegram_linux.gypi.

I didn't try that instructions step by step myself :) should test them I guess.

@par6n
Copy link
Author

par6n commented Oct 11, 2016

@john-preston Test the instructions, please :) I think it has a few mistakes.
I rebuilt OpenSSL, removed -flto flag, and again, I get the same error 😢

[ 37%] Linking CXX executable Telegram
/usr/local/tdesktop/Qt-5.6.0/lib/libQt5Network.a(qsslsocket_openssl_symbols.o): In function `q_EC_curve_nist2nid(char const*)':
/home/ehsaan/TBuild/Libraries/qt5_6_0/qtbase/src/network/ssl/qsslsocket_openssl_symbols.cpp:426: undefined reference to `EC_curve_nist2nid'
collect2: error: ld returned 1 exit status
CMakeFiles/Telegram.dir/build.make:12336: recipe for target 'Telegram' failed
make[2]: *** [Telegram] Error 1
CMakeFiles/Makefile2:238: recipe for target 'CMakeFiles/Telegram.dir/all' failed
make[1]: *** [CMakeFiles/Telegram.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

@john-preston
Copy link
Member

This function is part of openssl 1.0.2, not 1.0.1 that is used for tdesktop. Somehow you build Qt with support of the newer headers. What OS do you use?

@par6n
Copy link
Author

par6n commented Oct 11, 2016

@john-preston Xubuntu 16.04.1 running on AMD64 on kernel v4.8.1

@john-preston
Copy link
Member

As I see in the openssl sources the headers for building Qt are used from the new version while the library is used of an older version. Try "git checkout OpenSSL_1_0_2-stable" when building openssl - it has that function. Will it work?

But I didn't test tdesktop build with openssl of that branch, only with 1_0_1.

@par6n
Copy link
Author

par6n commented Oct 12, 2016

Finally a healthy build !!
Nice job, John. Please change the docs, too. :)

@par6n par6n closed this as completed Oct 12, 2016
@john-preston
Copy link
Member

@EhsaanF Well, the docs are for Ubuntu 12.04, it works there I suppose.

@par6n
Copy link
Author

par6n commented Oct 12, 2016

After a successful build in debug mode, now I'm facing another error for build (I didn't change anything but OpenSans ttf files)

[ 37%] Building CXX object CMakeFiles/Telegram.dir/home/ehsaan/TBuild/tdesktop/Telegram/SourceFiles/mtproto/auth_key.o
/home/ehsaan/TBuild/tdesktop/Telegram/SourceFiles/mtproto/auth_key.cpp: In function ‘void MTP::aesCtrEncrypt(void*, uint32, const void*, MTP::CTRState*)’:
/home/ehsaan/TBuild/tdesktop/Telegram/SourceFiles/mtproto/auth_key.cpp:56:131: error: ‘AES_ctr128_encrypt’ was not declared in this scope
  AES_ctr128_encrypt(static_cast<const uchar*>(data), static_cast<uchar*>(data), len, &aes, state->ivec, state->ecount, &state->num);
                                                                                                                                   ^
CMakeFiles/Telegram.dir/build.make:3739: recipe for target 'CMakeFiles/Telegram.dir/home/ehsaan/TBuild/tdesktop/Telegram/SourceFiles/mtproto/auth_key.o' failed
make[2]: *** [CMakeFiles/Telegram.dir/home/ehsaan/TBuild/tdesktop/Telegram/SourceFiles/mtproto/auth_key.o] Error 1
CMakeFiles/Makefile2:238: recipe for target 'CMakeFiles/Telegram.dir/all' failed
make[1]: *** [CMakeFiles/Telegram.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

@par6n par6n reopened this Oct 12, 2016
@john-preston
Copy link
Member

john-preston commented Oct 12, 2016

And if you check out openssl to the OpenSSL_1_0_1-stable branch this error goes away, but the old one returns in linking? (check out, make and sudo make install)

@par6n
Copy link
Author

par6n commented Oct 12, 2016

Tested against OpenSSL_1_0_1-stable, same error I got last time.

[ 37%] Building CXX object CMakeFiles/Telegram.dir/home/ehsaan/TBuild/tdesktop/Telegram/SourceFiles/mtproto/auth_key.o
/home/ehsaan/TBuild/tdesktop/Telegram/SourceFiles/mtproto/auth_key.cpp: In function ‘void MTP::aesCtrEncrypt(void*, uint32, const void*, MTP::CTRState*)’:
/home/ehsaan/TBuild/tdesktop/Telegram/SourceFiles/mtproto/auth_key.cpp:56:131: error: ‘AES_ctr128_encrypt’ was not declared in this scope
  AES_ctr128_encrypt(static_cast<const uchar*>(data), static_cast<uchar*>(data), len, &aes, state->ivec, state->ecount, &state->num);
                                                                                                                                   ^
CMakeFiles/Telegram.dir/build.make:3739: recipe for target 'CMakeFiles/Telegram.dir/home/ehsaan/TBuild/tdesktop/Telegram/SourceFiles/mtproto/auth_key.o' failed
make[2]: *** [CMakeFiles/Telegram.dir/home/ehsaan/TBuild/tdesktop/Telegram/SourceFiles/mtproto/auth_key.o] Error 1
CMakeFiles/Makefile2:238: recipe for target 'CMakeFiles/Telegram.dir/all' failed
make[1]: *** [CMakeFiles/Telegram.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

😠

@john-preston
Copy link
Member

@EhsaanF I have no idea ¯_(ツ)_/¯ The "aes.h" header is included and "AES_ctr128_encrypt" should be there.

@par6n
Copy link
Author

par6n commented Oct 12, 2016

All these problems motivates me to create my very own client, but implementing MTProto is so hard that almost makes me leave it 🤕
If you could just complete half of requested features in Issues page, Tdesktop would be the greatest IM client ever.
Thanks anyway.

@par6n par6n closed this as completed Oct 12, 2016
@auchri auchri added the build label Oct 12, 2016
@john-preston
Copy link
Member

@EhsaanF If a feature implementation would take twice more time than creating an issue.. :)

@vladursu
Copy link

Hi. I'm trying to compile the source code on Linux as well and I'm getting the exact same errors. I see the issue is closed, but is there any solution for this?

@Lonami
Copy link
Contributor

Lonami commented Mar 22, 2017

Try "git checkout OpenSSL_1_0_2-stable" when building openssl

Okay I'm just trying to build this and it finally worked. Man, thanks a lot for your hard work, this is a great client! You're a nice guy @john-preston ^^

Also I've summarized the build process on this script and also added the missing dependencies which aren't mentioned. Anyway, thanks!

@vdmit
Copy link

vdmit commented Jun 17, 2017

Encountered the same issue with OpenSSL functions on 16.04. Perhaps it's time to update main build manual?

@AndydeCleyre
Copy link
Contributor

I'm having this trouble on Arch:

/.../telegram-desktop-dev/src/tdesktop/Telegram/ThirdParty/libtgvoip/VoIPController.cpp: In function ‘void tgvoip_op
enssl_aes_ctr_encrypt(uint8_t*, size_t, uint8_t*, uint8_t*, uint8_t*, uint32_t*)’:                                             
/.../telegram-desktop-dev/src/tdesktop/Telegram/ThirdParty/libtgvoip/VoIPController.cpp:134:2: error: ‘AES_ctr128_en
crypt’ was not declared in this scope                                                                                          
  AES_ctr128_encrypt(inout, inout, length, &akey, iv, ecount, num);                                                            
  ^~~~~~~~~~~~~~~~~~                                                                                                           
/.../telegram-desktop-dev/src/tdesktop/Telegram/ThirdParty/libtgvoip/VoIPController.cpp:134:2: note: suggested alternative: ‘AES_cfb128_encrypt’                                                                                                   
  AES_ctr128_encrypt(inout, inout, length, &akey, iv, ecount, num);                                                            
  ^~~~~~~~~~~~~~~~~~                                                                                                           
  AES_cfb128_encrypt                                                                                                           
make[2]: *** [CMakeFiles/libtgvoip.dir/build.make:1359: CMakeFiles/libtgvoip.dir/.../telegram-desktop-dev/src/tdeskt
op/Telegram/ThirdParty/libtgvoip/VoIPController.o] Error 1                                                                     
make[1]: *** [CMakeFiles/Makefile2:552: CMakeFiles/libtgvoip.dir/all] Error 2                                                  
make: *** [Makefile:84: all] Error 2 

with

openssl 1.1.0.f
and
openssl-1.0 1.0.2.l

This stands out:

suggested alternative: ‘AES_cfb128_encrypt’

@angelskieglazki
Copy link

Try "git checkout OpenSSL_1_0_2-stable"

@john-preston Your solution works well.

max@den: ~$ uname -a
Linux den 4.4.0-83-generic #106-Ubuntu SMP Mon Jun 26 17:54:43 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

@vdmit
Copy link

vdmit commented Aug 6, 2017

@angelskieglazki, this fix (and some others) already done in my all-in-one TD build script: https://github.com/vdmit/autogram
It'd be nice to check it in another build environments, so you may try it.

pentix added a commit to pentix/tdesktop that referenced this issue Feb 18, 2018
Added the solution to the issues telegramdesktop#2519 and telegramdesktop#4418 that was found in respective thread discussion.
@github-actions
Copy link

github-actions bot commented Mar 8, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants