vysheng / tg

telegram-cli
GNU General Public License v2.0
6.48k stars 1.53k forks source link

Build fails on OSX using macports #624

Open rabimba opened 9 years ago

rabimba commented 9 years ago

I am trying the macports way. And after I am done with the following steps

sudo port install libconfig-hr sudo port install readline sudo port install lua51 sudo port install python34 sudo port install libevent export CFLAGS="-I/usr/local/include -I/opt/local/include -I/opt/local/include/lua-5.1" export LDFLAGS="-L/usr/local/lib -L/opt/local/lib -L/opt/local/lib/lua-5.1" ./configure && make

This is what I get

gcc -I. -I. -I./tgl -I/usr/local/include -I/opt/local/include -I/opt/local/include/lua-5.1 -I/usr/local/include -I/usr/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -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:932:5: error: 'builtin_snprintf_chk' will always overflow destination buffer [-Werror,-Wbuiltin-memcpy-chk-size] snprintf (serv_addr.sun_path, 108, "%s", unix_socket); ^~~~~~~~~~~~~ /usr/include/secure/_stdio.h:57:3: note: expanded from macro 'snprintf' builtin_snprintf_chk (str, len, 0, darwin_obsz(str), __VA_ARGS) ^~~~~~~~~~~~~~~ 1 error generated. make: *\ [objs/main.o] Error 1

Surye commented 9 years ago

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man4/unix.4.html#//apple_ref/doc/man/4/unix

On OSX, sun_path is 104 bytes, but on Linux, it's 108 bytes.

tsangiotis commented 9 years ago

Same problem here with Homebrew.

tsangiotis commented 9 years ago

Changing the sun path in line 936 in main.c from 108 to 104 works.

vhdmsm commented 9 years ago

Same problem here and fixed by @tsagi fix.