vysheng / tg

telegram-cli
GNU General Public License v2.0
6.49k stars 1.54k forks source link

tg cli does not compile with LibreSSL 2.8.3 #1639

Open iigmir opened 4 years ago

iigmir commented 4 years ago
$ system_profiler SPSoftwareDataType

Software:

    System Software Overview:

      System Version: macOS 10.15.2 (19C57)
      Kernel Version: Darwin 19.2.0

$  openssl version -a
LibreSSL 2.8.3
built on: date not available
platform: information not available
options:  bn(64,64) rc4(16x,int) des(idx,cisc,16,int) blowfish(idx) 
compiler: information not available
OPENSSLDIR: "/private/etc/ssl"

$ whereis openssl
/usr/bin/openssl

$ ./configure --with-openssl=/usr/bin/openssl && make
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for library containing clock_gettime... none required
checking for library containing backtrace... none required
checking for event_base_new in -levent... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking event2/event.h usability... yes
checking event2/event.h presence... yes
checking for event2/event.h... yes
checking for openssl/ssl.h in /usr/bin/openssl... no
checking whether compiling and linking against OpenSSL works... no
configure: error: No openssl found. With --disable-openssl, libtgl will use libgcrypt instead.

Some parts of config.log:

$ ./configure --with-openssl=/usr/bin/openssl

configure:4384: checking for openssl/ssl.h in /usr/bin/openssl
configure:4395: result: no
configure:4407: checking whether compiling and linking against OpenSSL works
Trying link with OPENSSL_LDFLAGS=; OPENSSL_LIBS=; OPENSSL_INCLUDES=
configure:4429: gcc -o conftest -g -O2   -I/usr/local/include  -L/usr/local/lib  conftest.c  -levent  >&5
conftest.c:21:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
         ^~~~~~~~~~~~~~~
1 error generated.
configure:4429: $? = 1
configure: failed program was:

| #define EVENT_V2 1
| /* end confdefs.h.  */
| #include <openssl/ssl.h>
| int
| main ()
| {
| SSL_new(NULL)
|   ;
|   return 0;
| }
configure:4437: result: no
configure:4439: error: No openssl found. With --disable-openssl, libtgl will use libgcrypt instead.

OPENSSL_INCLUDES=''
OPENSSL_LDFLAGS=''
OPENSSL_LIBS=''

Looks like Tg-cli doesn't support LibreSSL. I can't find any other useful information even searching 'openssl/ssl.h' file not found.

Any ideas?

Reference: #1488

Paulchen232 commented 4 years ago

You need libssl-dev.

Perhaps this help you: "How to install libssl-dev ,libffi-dev on Mac os?"

iigmir commented 4 years ago

brew link openssl --force does not work since it's macOS build-in software:

Warning: Refusing to link macOS-provided software: openssl@1.1
If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

Therefore, you need to do following steps:

$ export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
$ export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
$ export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

The compilers can detect libssl now.


Unfortunately, dyld cannot find newer libssl library:

dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /***/***/tg/bin/tl-parser
  Reason: image not found
make: *** [auto/scheme.tlo] Abort trap: 6

$ ls /usr/local/opt/openssl/lib
engines-1.1         libcrypto.a         libssl.1.1.dylib    libssl.dylib
libcrypto.1.1.dylib libcrypto.dylib     libssl.a            pkgconfig
Paulchen232 commented 4 years ago

Perhaps this help: "dyld: Library not loaded error on macOS (OpenSSL missing)"