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 exits immediately with error on OSX #199

Closed
NotAFile opened this issue May 3, 2014 · 10 comments
Closed

Build exits immediately with error on OSX #199

NotAFile opened this issue May 3, 2014 · 10 comments

Comments

@NotAFile
Copy link

NotAFile commented May 3, 2014

I thought I'd just leave this here:

gcc -g -O2 -I/usr/local/include  -DHAVE_CONFIG_H -Wall -Wextra -Werror  -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c loop.c -o loop.o
cc1: warnings being treated as errors
loop.c: In function ‘net_loop’:
loop.c:97: warning: implicit declaration of function ‘getline’
make: *** [loop.o] Error 1
@sdelquin
Copy link

Same problem here. Has anybody found a solution for this? thx

@koter84
Copy link
Contributor

koter84 commented May 29, 2014

i have been working on creating binaries for mac and making packages for various linux flavours.
checkout my fork at https://github.com/koter84/tg
binaries are build on travis-ci for ubuntu and mac, and for now i "release" them through a openshift-app.
https://tg-koter84.rhcloud.com/
please let me know if these work on a mac, since i don't have a mac to test on

you can check .travis-ci.yml for the commands i use to build telegram
i believe you are missing readline and should install it with brew install readline you need to have homebrew installed from https://brew.sh for this to work though

@sdelquin
Copy link

Even with your fork i cannot compile it. I have readline (and other libs) fine installed..

$ brew install libconfig readline lua
Warning: libconfig-1.4.9 already installed
Warning: readline-6.3.5 already installed
Warning: lua-5.1.5 already installed
$ make
gcc -I/opt/local/include -I/usr/local/include  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c main.c -o main.o
gcc -I/opt/local/include -I/usr/local/include  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c loop.c -o loop.o
cc1: warnings being treated as errors
loop.c: In function ‘net_loop’:
loop.c:97: warning: implicit declaration of function ‘getline’
make: *** [loop.o] Error 1

@NotAFile
Copy link
Author

NotAFile commented Jun 4, 2014

Exactly the same thing here

@koter84
Copy link
Contributor

koter84 commented Jun 4, 2014

Please download and test the binaries at https://tg-koter84.rhcloud.com/
They are build on a travis OSX host, the build log is at https://travis-ci.org/koter84/tg/jobs/26343020
the commands used are in https://github.com/koter84/tg/blob/master/.travis.yml

for more details please do a clean git clone and post the output of the ./configure command

i found the following commands to not be necessary on the travis build host, but maybe they are needed on your system. Be sure to check the version of readline (6.3.5 like in your brew install output) and make sure the directory really exists.

export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.3.5/include"
export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.3.5/lib"
./configure

also please post the version of OS X which you are using.

@sdelquin
Copy link

sdelquin commented Jun 4, 2014

I've downloaded Build 159 osx_amd64_gcc:

$ telegram
Illegal instruction

Trying to compile from your sources:

$ git clone https://github.com/koter84/tg.git && cd tg
Cloning into 'tg'...
remote: Counting objects: 1894, done.
remote: Compressing objects: 100% (652/652), done.
remote: Total 1894 (delta 1220), reused 1894 (delta 1220)
Receiving objects: 100% (1894/1894), 2.21 MiB | 329.00 KiB/s, done.
Resolving deltas: 100% (1220/1220), done.
Checking connectivity... done

$ ls -ld /usr/local/include/
drwxrwxr-x  26 24561  admin  884 21 may 15:38 /usr/local/include/
$ ls -ld /usr/local/Cellar/readline/6.3.5/include/
drwxr-xr-x  3 sergio  admin  102 21 may 16:56 /usr/local/Cellar/readline/6.3.5/include/
$ ls -ld /usr/local/lib
drwxrwxr-x  59 root  admin  2006 21 may 15:38 /usr/local/lib
$ ls -ld /usr/local/Cellar/readline/6.3.5/lib/
drwxr-xr-x  12 sergio  admin  408 21 may 16:56 /usr/local/Cellar/readline/6.3.5/lib/
$ export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.3.5/include"
$ export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.3.5/lib"

$ ./configure
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 sqrt in -lm... yes
checking for library containing clock_gettime... no
checking for library containing backtrace... none required
checking for inflate in -lz... yes
checking for AES_set_encrypt_key in -lcrypto... yes
checking for rl_save_prompt in -lreadline... yes
checking for libconfig... enabled
checking for config_init in -lconfig... yes
checking for liblua... 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
enabled
checking for lua... /usr/local/bin/lua
checking if /usr/local/bin/lua is a Lua interpreter... yes
checking for lua version... 5.1
checking for lua platform... unknown
checking for lua script directory... ${prefix}/share/lua/5.1
checking for lua module directory... ${exec_prefix}/lib/lua/5.1
checking if LUA_VERSION is defined... yes
checking lua.h usability... yes
checking lua.h presence... yes
checking for lua.h... yes
checking lualib.h usability... yes
checking lualib.h presence... yes
checking for lualib.h... yes
checking lauxlib.h usability... yes
checking lauxlib.h presence... yes
checking for lauxlib.h... yes
checking luaconf.h usability... yes
checking luaconf.h presence... yes
checking for luaconf.h... yes
checking for Lua header version... 5.1
checking if Lua header version matches 5.1... yes
checking if LUA_VERSION is defined... yes
checking for library containing exp... none required
checking for library containing dlopen... none required
checking for library containing lua_load... -llua
default
checking execinfo.h usability... yes
checking execinfo.h presence... yes
checking for execinfo.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking malloc.h usability... no
checking malloc.h presence... no
checking for malloc.h... no
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking mach/mach.h usability... yes
checking mach/mach.h presence... yes
checking for mach/mach.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking for size_t... yes
checking for uid_t in sys/types.h... yes
checking for inline... inline
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... yes
checking for alarm... yes
checking for endpwent... yes
checking for memset... yes
checking for memmove... yes
checking for mkdir... yes
checking for select... yes
checking for socket... yes
checking for strdup... yes
checking for strndup... no
checking for uname... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h

$ make
gcc -I/usr/local/include -I/usr/local/Cellar/readline/6.3.5/include -I/usr/local/include  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c main.c -o main.o
gcc -I/usr/local/include -I/usr/local/Cellar/readline/6.3.5/include -I/usr/local/include  -DHAVE_CONFIG_H -Wall -Wextra -Werror -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -I. -I. -c loop.c -o loop.o
cc1: warnings being treated as errors
loop.c: In function ‘net_loop’:
loop.c:97: warning: implicit declaration of function ‘getline’
make: *** [loop.o] Error 1

@NotAFile
Copy link
Author

exactly the same messages here on 10.6.8

@vysheng
Copy link
Owner

vysheng commented Sep 10, 2014

@luckydonald
Copy link

Not quite sure how to work with that...

@luckydonald
Copy link

Okey, I figured something out:

to install readline, which it the reason it is failing:

curl -O git.savannah.gnu.org/cgit/readline.git/snapshot/readline-master.tar.gz
tar zxvf readline-master.tar.gz
cd readline-master
./configure
make
sudo make install
cd ..

That should be all needed!
For reference, and to check for new versions of readline, here used is 6.3
Found at http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html, the link in the text part

A downloadable tar file of the current version with all official patches applied is available from savannah.

now go ahead and use ./configure and make to build the cli as usual.

Note: I tried many things before, so this could depend strangely on some files installed before. But it should work... I have not the time to test this with a fresh install of mac OS X...

Can someone else confirm it working? Working on my Mac OS 10.9.5
Also, maybe there is a better way to link to that readline download?

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

No branches or pull requests

5 participants