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

OS X support #3

Open
zhukov opened this issue Oct 29, 2013 · 49 comments
Open

OS X support #3

zhukov opened this issue Oct 29, 2013 · 49 comments

Comments

@zhukov
Copy link
Contributor

zhukov commented Oct 29, 2013

Please, add OS X support!

@izqui
Copy link

izqui commented Nov 3, 2013

+1.

When compiling on Mac I get:

[tg] [git:master] $ make
cc -c -Wall -Wextra -Werror -fPIC -ggdb -O2 -fno-omit-frame-pointer -fno-strict-aliasing -rdynamic main.c -o main.o
clang: error: argument unused during compilation: '-rdynamic'
make: *** [main.o] Error 1

I tried removing the '-rdynamic' flag but I'm getting this:

[tg] [git:master] $ nano Makefile
[tg] [git:master] $ make
cc -c -Wall -Wextra -Werror -fPIC -ggdb -O2 -fno-omit-frame-pointer -fno-strict-aliasing main.c -o main.o
cc -c -Wall -Wextra -Werror -fPIC -ggdb -O2 -fno-omit-frame-pointer -fno-strict-aliasing loop.c -o loop.o
loop.c:369:32: error: incompatible pointer types assigning to 'Function *' (aka 'int (*)(const char *, int)')
      from 'char *(const char *, int)' [-Werror,-Wincompatible-pointer-types]
  rl_completion_entry_function = complete_none;
                               ^ ~~~~~~~~~~~~~
1 error generated.
make: *** [loop.o] Error 1

it would be really nice to see this working in the mac.

@jfontan
Copy link

jfontan commented Nov 12, 2013

Right now it compiles in MAC. Just had to pass --disable-libconfig to configure. The readline functionality does not seem to be working fine.

MacOS 10.9
Xcode 5.0.1

@jfontan
Copy link

jfontan commented Nov 12, 2013

To compile with readline and libconfig. Using homebrew:

$ brew install libconfig
$ brew install readline
$ export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.2.4/include"
$ export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.2.4/lib"
$ ./configure && make

Change the path to your readline cellar.

@vysheng
Copy link
Owner

vysheng commented Nov 12, 2013

@jfontan Sorry for that, I don't have any Mac computers, and their readline wrapper doesn't seem to work as expected. So does method with brew work well?

@izqui
Copy link

izqui commented Nov 12, 2013

Yes. I got it to work with that.

Thank you and keep up this awesome job.


Sent from Mailbox for iPhone

On Tue, Nov 12, 2013 at 6:45 PM, vysheng [email protected] wrote:

@jfontan Sorry for that, I don't have any Mac computers, and their readline wrapper doesn't seem to work as expected. So does method with brew work well?

Reply to this email directly or view it on GitHub:
#3 (comment)

@zhukov
Copy link
Contributor Author

zhukov commented Nov 12, 2013

Thanks a lot! That is the missing solution. Finally can use this client on
my mac.

Best regards,
Igor

2013/11/12 Javi Fontan [email protected]

To compile with readline and libconfig. Using homebrew:

$ brew install libconfig
$ brew install readline
$ export CFLAGS="-I/usr/local/include
-I/usr/local/Cellar/readline/6.2.4/include"
$ export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.2.4/lib"
$ ./configure && make

Change the path to your readline cellar.


Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-28293731
.

@jfontan
Copy link

jfontan commented Nov 12, 2013

@vysheng It works. I'll try to make a brew recipe when I get some time.

@jithugopal
Copy link

@jfontan The application compiled successfully with the right CFLAGS and LDFLAGS set. However, readline is still broken for me. I don't get autocomplete and the prompt doesn't show up properly. (the client works though)

Is there anything else I should take care of?
Mac OS 10.9
Xcode 5.0.2
config.log -> http://pastebin.com/mdKvgrnT

@jfontan
Copy link

jfontan commented Nov 27, 2013

Check that readline is installed with brew and its installation path. Here's my output:

$ brew list readline
/usr/local/Cellar/readline/6.2.4/include/readline/ (8 files)
/usr/local/Cellar/readline/6.2.4/lib/libhistory.6.2.dylib
/usr/local/Cellar/readline/6.2.4/lib/libreadline.6.2.dylib
/usr/local/Cellar/readline/6.2.4/lib/ (6 other files)
/usr/local/Cellar/readline/6.2.4/share/man/ (2 files)
/usr/local/Cellar/readline/6.2.4/share/readline/ (11 files)

Make sure that the version in the paths of CFLAGS and LDFLAGS are the same.

@jithugopal
Copy link

Readline 6.2.4 is installed (keg only).

$ brew list readline
/usr/local/Cellar/readline/6.2.4/include/readline/ (8 files)
/usr/local/Cellar/readline/6.2.4/lib/ (2 files)
/usr/local/Cellar/readline/6.2.4/share/man/ (2 files)
/usr/local/Cellar/readline/6.2.4/share/readline/ (11 files)

$ echo $CFLAGS
"-I/usr/local/include -I/usr/local/Cellar/readline/6.2.4/include"

$ echo $LDFLAGS
"-L/usr/local/lib -L/usr/local/Cellar/readline/6.2.4/lib"

My brew list, unlike yours, doesn't show libhistory and libreadline though. Could this be a problem?

@jithugopal
Copy link

Nvm. I did brew update, installed readline and compiled again (I see libhistory and libreadline). Working well now. Probably it might be good to update README.

Thanks @jfontan!

@dannluciano
Copy link
Contributor

The export CFLAGS and LDFLAGS works for me.
This issue can be closed?

@nmistry
Copy link

nmistry commented Dec 16, 2013

On OSX 10.9 xcode 5: Does not execute properly when specifying non standard homebrew install location.

$ brew install libconfig
$ brew install readline
$ export CFLAGS="-I/usr/local/homebrew/include -I/usr/local/homebrew/Cellar/readline/6.2.4/include"
$ export LDFLAGS="-L/usr/local/homebrew/lib -L/usr/local/homebrew/Cellar/readline/6.2.4/lib"
$ ./configure && make
$ ./telegram -k ./tg.pub
dyld: Library not loaded: /usr/local/homebrew/homebrew/opt/readline/lib/libreadline.6.2.dylib
  Referenced from: /Users/nmistry/src/try/tg/./telegram
  Reason: image not found
[1]    15092 trace trap  ./telegram -k ./tg.pub

@dannluciano
Copy link
Contributor

Stranger!
In my osx with this configs just works!
You tried 'echo $LDFLAGS' to confirm if readline path to be in the variable?

@nmistry
Copy link

nmistry commented Dec 28, 2013

@dannluciano, this is what its set to:

$  echo $LDFLAGS 
-L/usr/local/homebrew/lib -L/usr/local/homebrew/Cellar/readline/6.2.4/lib

$ echo $CFLAGS
-I/usr/local/homebrew/include -I/usr/local/homebrew/Cellar/readline/6.2.4/include

@dannluciano
Copy link
Contributor

In default homebrew configuration you readline should in /usr/local/Cellar/readline/ not in /usr/local/homebrew/Cellar/readline/

Try brew list readline.

@PedroLopes
Copy link

Here's what I got:
> after brew installs & brew update
> configure goes all good
> make
falls into: "cc1: warning: command line option "-Wno-deprecated" is valid for C++/Java/ObjC++ but not for C"

So I removed "-Wno-deprecated" from Makefile manually.. and it passes there at least.
> make
and it falls into "net.c:638: warning: ‘RAND_pseudo_bytes’ is deprecated (declared at /usr/include/openssl/rand.h:105)".. and so forth.. seems that most openssl stuff shows as deprecated.

any ideas? perhaps its the same as: https://gist.github.com/fdmanana/1199903 ?

@PedroLopes
Copy link

Forgot to state the obvious, possible solution is: remove -Werror

DrOwl pushed a commit to DrOwl/tg that referenced this issue Aug 7, 2014
fix the help text for -s to show that you need to specify a filename
DrOwl pushed a commit to DrOwl/tg that referenced this issue Aug 7, 2014
@yeojoy
Copy link

yeojoy commented Oct 21, 2014

on Yosemite, readline's version(?) is 6.3.8.

$ brew list readline
/usr/local/Cellar/readline/6.3.8/include/readline/ (8 files)
/usr/local/Cellar/readline/6.3.8/lib/libhistory.6.3.dylib
/usr/local/Cellar/readline/6.3.8/lib/libreadline.6.3.dylib
/usr/local/Cellar/readline/6.3.8/lib/ (8 other files)
/usr/local/Cellar/readline/6.3.8/share/doc/ (3 files)
/usr/local/Cellar/readline/6.3.8/share/info/ (3 files)
/usr/local/Cellar/readline/6.3.8/share/man/ (2 files)
/usr/local/Cellar/readline/6.3.8/share/readline/ (14 files)

and

$ export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.3.8/include"
$ export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.3.8/lib"

@aurbano
Copy link

aurbano commented Nov 18, 2014

Runing on Mac OSX 10.10.1 - After trying everything suggested here, I always get:

ld -r -b binary -o objs/mime-types.o mime.types
ld: warning: option -b is obsolete and being ignored
ld: file not found: binary
make: *** [objs/mime-types.o] Error 1

Any suggestions?

@BillKeenan
Copy link

the man file sais

-b Used with -A option to strip base file's symbols. This option is obsolete. Obsolete option to produce a load map. Use -map option instead.

@aurbano
Copy link

aurbano commented Nov 18, 2014

Thanks,
That led me to find the solution:

  1. After ./configure is done, open Makefile.tgl, and edit line#19, removing -b binary
  2. Run make -stdlib=libstdc++

This worked fine for me, you still need to set the permissions of bin/telegram-cli correctly though.

@vysheng
Copy link
Owner

vysheng commented Nov 19, 2014

What linker do you have?

@aurbano
Copy link

aurbano commented Nov 19, 2014

I suppose the standard Mac OSX linker, I have xcode and command line tools installed and updated to the latest version.

With the solution I posted above it compiles, but it fails to execute:

zsh: exec format error: tg/bin/telegram-cli

@hmbr
Copy link

hmbr commented Jun 6, 2016

I tried ./configure && make bu I had the follow error with openssl

checking whether compiling and linking against OpenSSL works... no
configure: error: No openssl found. With --disable-openssl, libtgl will use libgcrypt instead.

I had to add the directories to fix

export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.3.8/lib -L/usr/local/opt/openssl/lib"
export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.3.8/include -I/usr/local/opt/openssl/include"

@LukeLR
Copy link

LukeLR commented Jun 6, 2016

Thank you very much for reporting! It'll help others, I guess ;)

On 06 Jun 2016, at 23:45, helder maximo botter ribas [email protected] wrote:

I tried ./configure && make bu I had the follow error with openssl

checking whether compiling and linking against OpenSSL works... no
configure: error: No openssl found. With --disable-openssl, libtgl will use libgcrypt instead.
I had to add the directories

export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.3.8/lib -L/usr/local/opt/openssl/lib"
export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.3.8/include -I/usr/local/opt/openssl/include"

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@TheCyberpunker
Copy link

get this error when i run make. any fix?
1Ks-MacBook-Air:tg-master a1K$ make
make: *** No rule to make target tgl/scheme.tl', needed byauto/scheme.tl'. Stop.

@Jamesits
Copy link

Jamesits commented Oct 3, 2016

@luismiguelsec

git submodule init
git submodule update --recursive

then ./configure and make again.

@gHashTag
Copy link

@hmbr Some error. Why don`t work?

 ~/Applications/tg   master  export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.3.8/lib -L/usr/local/opt/openssl/lib"
 ~/Applications/tg   master  export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.3.8/include -I/usr/local/opt/openssl/include"
 ~/Applications/tg   master  ./configure && 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 pkg-config... no
checking for openssl/ssl.h in /usr/local/ssl... no
checking for openssl/ssl.h in /usr/lib/ssl... no
checking for openssl/ssl.h in /usr/ssl... no
checking for openssl/ssl.h in /usr/pkg... no
checking for openssl/ssl.h in /usr/local... no
checking for openssl/ssl.h in /usr... no
checking whether compiling and linking against OpenSSL works... no
configure: error: No openssl found. With --disable-openssl, libtgl will use libgcrypt instead.

I tried ./configure && make bu I had the follow error with openssl

checking whether compiling and linking against OpenSSL works... no
configure: error: No openssl found. With --disable-openssl, libtgl will use libgcrypt instead.
I had to add the directories to fix

export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.3.8/lib -L/usr/local/opt/openssl/lib"
export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.3.8/include -I/usr/local/opt/openssl/include"

@Qualia-Li
Copy link

Make sure you have the correct version number in export:
$ brew install libconfig
$ brew install readline
$ export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline//include"
$ export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/
/lib"

@Qualia-Li
Copy link

Also ./configure --with-openssl=/usr/local/Cellar/openssl/1.0.2l --disable-liblua && make worked for me on my Mac.

@tomasi-o
Copy link

Thank you Qualia, but that produces another error:
configure: error: No openssl found. With --disable-openssl, libtgl will use libgcrypt instead.

@owiofwm2i
Copy link

owiofwm2i commented Nov 2, 2018

brew list readline #to make sure your right version
export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/7.0.3_1/lib -L/usr/local/opt/openssl/lib"
export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/7.0.3_1/include -I/usr/local/opt/openssl/include"

./configure --disable-liblua&& make -stdlib=libstdc++

it works for me

@ekkis
Copy link

ekkis commented Jan 7, 2019

I tried ./configure && make bu I had the follow error with openssl

checking whether compiling and linking against OpenSSL works... no
configure: error: No openssl found. With --disable-openssl, libtgl will use libgcrypt instead.

I had to add the directories to fix

export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.3.8/lib -L/usr/local/opt/openssl/lib"
export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.3.8/include -I/usr/local/opt/openssl/include"

on my install (OSX 10.14 Mojave) the /usr/local/opt/openssl/include directory contains only a subdirectory named openssl, which actually contains the .h files... so redefining the CFLAGS export to include this directory should have worked but I still get the

checking whether compiling and linking against OpenSSL works... no
configure: error: No openssl found. With --disable-openssl, libtgl will use libgcrypt instead.

error. what else can I try?

@ekkis
Copy link

ekkis commented Jan 7, 2019

to force it to build I tried configure --disable-openssl but now I'm faced with another issue:

$ ls /usr/local/opt/readline
lrwxr-xr-x  1 ekkis  admin  24 Jul 17 14:04 /usr/local/opt/readline@ -> ../Cellar/readline/7.0.5

so opt points to Cellar... where I see:

$ ls /usr/local/Cellar/readline
total 0
drwxr-xr-x  11 ekkis  admin  352 Nov  9  2015 6.3.8/
drwxr-xr-x  12 ekkis  admin  384 Mar 14  2017 7.0.3_1/
drwxr-xr-x  12 ekkis  admin  384 Jan  6 17:43 7.0.5/

I've defined CFLAGS and LDFLAGS to point to Cellar/readline/6.3.8 but when I try to make I get:

bin/tl-parser -e auto/scheme.tlo auto/scheme.tl
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib
Referenced from: /Users/ekkis/dev/tg/bin/tl-parser
Reason: image not found
make: *** [auto/scheme.tlo] Abort trap: 6

you'll notice the reference to /usr/local/opt instead of to /usr/local/Cellar... why is that? the problem is that opt is pointing to 7.0.5 so the lib isn't going to be there. how to fix?

@ekkis
Copy link

ekkis commented Jan 7, 2019

I decided to just make a link like this:

ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib

so that gets me a little bit past. now it crashes with:

gcc -I. -I. -I./tgl -I/usr/local/include -I/usr/local/Cellar/readline/6.3.8/include/readline -I/usr/local/opt/openssl/include/openssl -I/usr/local/include -I/include -I/usr/local/include/lua5.3 -I/usr/local/opt/openssl/include -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -c -MP -MD -MF dep/main.d -MQ objs/main.o -o objs/main.o main.c
main.c:904:3: error: use of undeclared identifier 'rl_catch_signals'
rl_catch_signals = 0;
^
1 error generated.
make: *** [objs/main.o] Error 1

what am I missing now?

@alihesari
Copy link

This solution solved my problem. #1488 (comment)

@csarami
Copy link

csarami commented Sep 20, 2019

Any solution for Mojave?

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 pkg-config... no
checking for openssl/ssl.h in /usr/local/ssl... no
checking for openssl/ssl.h in /usr/lib/ssl... no
checking for openssl/ssl.h in /usr/ssl... no
checking for openssl/ssl.h in /usr/pkg... no
checking for openssl/ssl.h in /usr/local... no
checking for openssl/ssl.h in /usr... no
checking whether compiling and linking against OpenSSL works... no
configure: error: No openssl found. With --disable-openssl, libtgl will use libgcrypt instead.

@fitz123
Copy link

fitz123 commented Aug 22, 2021

For Homebrew M1

export CFLAGS="-I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1/include -I/opt/homebrew/opt/openssl/include"
export LDFLAGS="-L/opt/homebrew/lib -L/opt/homebrew/Cellar/readline/8.1/lib -L/opt/homebrew/opt/openssl/lib"
./configure --with-openssl=/opt/homebrew/opt/openssl/

@diminou91
Copy link

diminou91 commented Nov 15, 2021

For Homebrew M1

export CFLAGS="-I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1/include -I/opt/homebrew/opt/openssl/include"
export LDFLAGS="-L/opt/homebrew/lib -L/opt/homebrew/Cellar/readline/8.1/lib -L/opt/homebrew/opt/openssl/lib"
./configure --with-openssl=/opt/homebrew/opt/openssl/

Unfortunately this doesn't work for me on macbook air M1 :

`This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by telegram-cli configure 1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ ./configure --with-openssl=/opt/homebrew/opt/openssl@3/

---------

Platform.

---------

hostname = MBA
uname -m = x86_64
uname -r = 21.1.0
uname -s = Darwin
uname -v = Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:24 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T8101

/usr/bin/uname -p = i386
/bin/uname -X = unknown

/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = Mach kernel version:
Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:24 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T8101
Kernel configured for up to 8 processors.
8 processors are physically available.
8 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3 4 5 6 7
Primary memory available: 8.00 gigabytes
Default processor set: 484 tasks, 2508 threads, 8 processors
Load average: 1.91, Mach factor: 6.08
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown

PATH: /opt/homebrew/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /Library/Apple/usr/bin
PATH: /opt/homebrew/bin
PATH: /opt/homebrew/sbin
PATH: /Applications/Visual Studio Code.app/Contents/Resources/app/bin
PATH: /Applications/Visual Studio Code.app/Contents/Resources/app/bin

-----------

Core tests.

-----------

configure:2755: checking for gcc
configure:2771: found /usr/bin/gcc
configure:2782: result: gcc
configure:3011: checking for C compiler version
configure:3020: gcc --version >&5
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin21.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
configure:3031: $? = 0
configure:3020: gcc -v >&5
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin21.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3031: $? = 0
configure:3020: gcc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3031: $? = 1
configure:3020: gcc -qversion >&5
clang: error: unknown argument '-qversion'; did you mean '--version'?
clang: error: no input files
configure:3031: $? = 1
configure:3051: checking whether the C compiler works
configure:3073: gcc -I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1.1/include -I/opt/homebrew/Cellar/openssl@3/3.0.0_1/include -L/opt/homebrew/lib -L/opt/homebrew/Cellar/readline/8.1.1/lib -L/opt/homebrew/Cellar/openssl@3/3.0.0_1/lib conftest.c >&5
configure:3077: $? = 0
configure:3125: result: yes
configure:3128: checking for C compiler default output file name
configure:3130: result: a.out
configure:3136: checking for suffix of executables
configure:3143: gcc -o conftest -I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1.1/include -I/opt/homebrew/Cellar/openssl@3/3.0.0_1/include -L/opt/homebrew/lib -L/opt/homebrew/Cellar/readline/8.1.1/lib -L/opt/homebrew/Cellar/openssl@3/3.0.0_1/lib conftest.c >&5
configure:3147: $? = 0
configure:3169: result:
configure:3191: checking whether we are cross compiling
configure:3199: gcc -o conftest -I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1.1/include -I/opt/homebrew/Cellar/openssl@3/3.0.0_1/include -L/opt/homebrew/lib -L/opt/homebrew/Cellar/readline/8.1.1/lib -L/opt/homebrew/Cellar/openssl@3/3.0.0_1/lib conftest.c >&5
configure:3203: $? = 0
configure:3210: ./conftest
configure:3214: $? = 0
configure:3229: result: no
configure:3234: checking for suffix of object files
configure:3256: gcc -c -I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1.1/include -I/opt/homebrew/Cellar/openssl@3/3.0.0_1/include conftest.c >&5
configure:3260: $? = 0
configure:3281: result: o
configure:3285: checking whether we are using the GNU C compiler
configure:3304: gcc -c -I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1.1/include -I/opt/homebrew/Cellar/openssl@3/3.0.0_1/include conftest.c >&5
configure:3304: $? = 0
configure:3313: result: yes
configure:3322: checking whether gcc accepts -g
configure:3342: gcc -c -g conftest.c >&5
configure:3342: $? = 0
configure:3383: result: yes
configure:3400: checking for gcc option to accept ISO C89
configure:3463: gcc -c -I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1.1/include -I/opt/homebrew/Cellar/openssl@3/3.0.0_1/include conftest.c >&5
configure:3463: $? = 0
configure:3476: result: none needed
configure:3503: checking for library containing clock_gettime
configure:3534: gcc -o conftest -I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1.1/include -I/opt/homebrew/Cellar/openssl@3/3.0.0_1/include -I/usr/local/include -L/opt/homebrew/lib -L/opt/homebrew/Cellar/readline/8.1.1/lib -L/opt/homebrew/Cellar/openssl@3/3.0.0_1/lib -L/usr/local/lib conftest.c >&5
configure:3534: $? = 0
configure:3551: result: none required
configure:3559: checking for library containing backtrace
configure:3590: gcc -o conftest -I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1.1/include -I/opt/homebrew/Cellar/openssl@3/3.0.0_1/include -I/usr/local/include -L/opt/homebrew/lib -L/opt/homebrew/Cellar/readline/8.1.1/lib -L/opt/homebrew/Cellar/openssl@3/3.0.0_1/lib -L/usr/local/lib conftest.c >&5
configure:3590: $? = 0
configure:3607: result: none required
configure:3615: checking for event_base_new in -levent
configure:3640: gcc -o conftest -I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1.1/include -I/opt/homebrew/Cellar/openssl@3/3.0.0_1/include -I/usr/local/include -L/opt/homebrew/lib -L/opt/homebrew/Cellar/readline/8.1.1/lib -L/opt/homebrew/Cellar/openssl@3/3.0.0_1/lib -L/usr/local/lib conftest.c -levent >&5
ld: warning: ignoring file /opt/homebrew/lib/libevent.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
"_event_base_new", referenced from:
_main in conftest-a340b8.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3640: $? = 1
configure: failed program was:
| /* confdefs.h /
| #define PACKAGE_NAME "telegram-cli"
| #define PACKAGE_TARNAME "telegram-cli"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "telegram-cli 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /
end confdefs.h. /
|
| /
Override any GCC internal prototype to avoid an error.
| Use char because int might match the return type of a GCC
| builtin and then its argument prototype would still apply. */
| #ifdef __cplusplus
| extern "C"
| #endif
| char event_base_new ();
| int
| main ()
| {
| return event_base_new ();
| ;
| return 0;
| }
configure:3649: result: no
configure:3659: error: no libevent found

----------------

Cache variables.

----------------

ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1.1/include -I/opt/homebrew/Cellar/openssl@3/3.0.0_1/include'
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='-L/opt/homebrew/lib -L/opt/homebrew/Cellar/readline/8.1.1/lib -L/opt/homebrew/Cellar/openssl@3/3.0.0_1/lib'
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_LUA_INCLUDE_set=
ac_cv_env_LUA_INCLUDE_value=
ac_cv_env_LUA_LIB_set=
ac_cv_env_LUA_LIB_value=
ac_cv_env_LUA_set=
ac_cv_env_LUA_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_lib_event_event_base_new=no
ac_cv_objext=o
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_cc_c89=
ac_cv_prog_cc_g=yes
ac_cv_search_backtrace='none required'
ac_cv_search_clock_gettime='none required'

-----------------

Output variables.

-----------------

CC='gcc'
CFLAGS='-I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1.1/include -I/opt/homebrew/Cellar/openssl@3/3.0.0_1/include'
CPP=''
CPPFLAGS=' -I/usr/local/include'
DEFS=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
EXEEXT=''
EXTRA_LIBS=''
GREP=''
LDFLAGS='-L/opt/homebrew/lib -L/opt/homebrew/Cellar/readline/8.1.1/lib -L/opt/homebrew/Cellar/openssl@3/3.0.0_1/lib -L/usr/local/lib'
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
LUA=''
LUA_EXEC_PREFIX=''
LUA_INCLUDE=''
LUA_LIB=''
LUA_PLATFORM=''
LUA_PREFIX=''
LUA_SHORT_VERSION=''
LUA_VERSION=''
OBJEXT='o'
OPENSSL_INCLUDES=''
OPENSSL_LDFLAGS=''
OPENSSL_LIBS=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME='telegram-cli'
PACKAGE_STRING='telegram-cli 1.0'
PACKAGE_TARNAME='telegram-cli'
PACKAGE_URL=''
PACKAGE_VERSION='1.0'
PATH_SEPARATOR=':'
PKG_CONFIG=''
PYTHON_BIN=''
PYTHON_CFLAGS=''
PYTHON_FOUND=''
PYTHON_INCLUDE_DIR=''
PYTHON_LIB=''
PYTHON_LIBS=''
SHELL='/bin/sh'
ac_ct_CC='gcc'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
luadir=''
luaexecdir=''
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
pkgluadir=''
pkgluaexecdir=''
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

-----------

confdefs.h.

-----------

/* confdefs.h */
#define PACKAGE_NAME "telegram-cli"
#define PACKAGE_TARNAME "telegram-cli"
#define PACKAGE_VERSION "1.0"
#define PACKAGE_STRING "telegram-cli 1.0"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""

configure: exit 1
`

It says
ld: warning: ignoring file /opt/homebrew/lib/libevent.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 Undefined symbols for architecture x86_64: "_event_base_new", referenced from: _main in conftest-a340b8.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

But everytime I'm tryin gto install libevent from brew with arch -x86_64 i get
➜ tg git:(master) arch -x86_64 brew reinstall libevent Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)! To rerun under ARM use: arch -arm64 brew install ... To install under x86_64, install Homebrew into /usr/local.

How did you install everything ?

EDIT : sorry for the big log file, don't seems to go inside code blocks :(

@romanesko
Copy link

Any solution for Mojave?

just try brew install telegram-cli

@LucasAschenbach
Copy link

For everyone attempting to build for an M1 machine, this script should work:

#!/bin/bash

# In case the build throws an error, remove the -Werror flag from CFLAGS in
# ./Makefile.in

# Setup
export CFLAGS="-I/opt/homebrew/include -I/opt/homebrew/Cellar/readline/8.1.2/include -I/opt/homebrew/Cellar/lua/5.4.4_1/include/lua5.4"
export LDFLAGS="-L/opt/homebrew/lib -L/opt/homebrew/Cellar/readline/8.1.2/lib -L/opt/homebrew/Cellar/lua/5.4.4_1/lib"

brew install libconfig readline lua python libevent jansson
brew install libgcrypt

# Build
./configure --disable-openssl && make

@kiiiiit
Copy link

kiiiiit commented Oct 31, 2023

For everyone attempting to build for an M1 machine, this script should work:

Thank you for your script, unfortunately I have the error:
./tg-cli.sh: line 14: ./configure: No such file or directory
Where can I take/make the configure file?

@Epvre
Copy link

Epvre commented Feb 10, 2024

Epvre commented Feb 10, 2024

Debian. All packages had been installed

Error in make command:

gcc -I. -I. -I./tgl -g -O2 -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/lua5.2 -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -c -MP -MD -MF dep/main.d -MQ objs/main.o -o objs/main.o main.c
main.c: In function ‘termination_signal_handler’:
main.c:824:7: error: ‘write’ reading 18 bytes from a region of size 17 [-Werror=stringop-overread]
824 | if (write (1, "SIGNAL received\n", 18) < 0) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from main.c:29:
/usr/include/unistd.h:378:16: note: in a call to function ‘write’ declared with attribute ‘access (read_only, 2, 3)’
378 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
| ^~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:48: objs/main.o] Error 1

@Epvre
Copy link

Epvre commented Mar 16, 2024

Archlinux help please

gcc -I. -I. -I./tgl -g -O2 -I/usr/local/include -I/usr/include -I/usr/include -DHAVE_CONFIG_H -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -c -MP -MD -MF dep/main.d -MQ objs/main.o -o objs/main.o main.c
main.c: In function ‘termination_signal_handler’:
main.c:824:7: error: ‘write’ reading 18 bytes from a region of size 17 [-Werror=stringop-overread]
824 | if (write (1, "SIGNAL received\n", 18) < 0) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from main.c:29:
/usr/include/unistd.h:378:16: note: in a call to function ‘write’ declared with attribute ‘access (read_only, 2, 3)’
378 | xtern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
| ^~~~~

cc1: all warnings being treated as errors
make: *** [Makefile:48: objs/main.o] Error 1

@Epvre
Copy link

Epvre commented Mar 16, 2024

Archlinux After AUR installing i have error

*** 1710590178.499890 Notification API_64BIT_LOGIN_APP_OUTDATED_78: You are using an outdated app that is no longer supported. To access your messages, please update your app to the latest version. If you don’t know how to update your app, go to https://telegram.org/dl
*** 1710590178.541644 Incorrect phone number

I have last version. Please update for users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests