TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

compilation of tintin-beta fails on mac 10.9

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
lilmike



Joined: 08 Feb 2015
Posts: 9
Location: Baton Rouge, Louisiana

PostPosted: Fri Mar 06, 2015 11:05 pm    Post subject: compilation of tintin-beta fails on mac 10.9 Reply with quote

Hi,
I am trying to get the latest tintin-beta installed on my mac running 10.9 mavriks, and math.c seems to have an error in the functions. Make errors below:

Code:

gcc -Wall  -I/opt/local/include    -c math.c
math.c:72:12: warning: implicit declaration of function 'get_number' is invalid in C99 [-Wimplicit-function-declaration]
                result = get_number(ses, right);
                         ^
math.c:83:8: error: conflicting types for 'get_number'
double get_number(struct session *ses, char *str)
       ^
math.c:72:12: note: previous implicit declaration is here
                result = get_number(ses, right);
                         ^
math.c:88:2: warning: implicit declaration of function 'mathexp' is invalid in C99 [-Wimplicit-function-declaration]
        mathexp(ses, str, result, 0);
        ^
math.c:90:8: warning: implicit declaration of function 'tintoi' is invalid in C99 [-Wimplicit-function-declaration]
        val = tintoi(result);
              ^
math.c:109:37: warning: format specifies type 'double' but the argument has type 'int' [-Wformat]
        sprintf(result, "%.*f", precision, get_number(ses, str));
                         ~~~~              ^~~~~~~~~~~~~~~~~~~~
                         %.*d
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
                                                       ^
math.c:125:6: error: conflicting types for 'mathexp'
void mathexp(struct session *ses, char *str, char *result, int seed)
     ^
math.c:88:2: note: previous implicit declaration is here
        mathexp(ses, str, result, 0);
        ^
math.c:131:6: warning: implicit declaration of function 'mathexp_tokenize' is invalid in C99 [-Wimplicit-function-declaration]
        if (mathexp_tokenize(ses, result, seed) == FALSE)
            ^
math.c:142:4: warning: implicit declaration of function 'mathexp_level' is invalid in C99 [-Wimplicit-function-declaration]
                        mathexp_level(ses, node);
                        ^
math.c:532:6: error: conflicting types for 'mathexp_level'
void mathexp_level(struct session *ses, struct link_data *node)
     ^
math.c:142:4: note: previous implicit declaration is here
                        mathexp_level(ses, node);
                        ^
math.c:555:5: warning: implicit declaration of function 'mathexp_compute' is invalid in C99 [-Wimplicit-function-declaration]
                                mathexp_compute(ses, node);
                                ^
math.c:584:6: error: conflicting types for 'mathexp_compute'
void mathexp_compute(struct session *ses, struct link_data *node)
     ^
math.c:555:5: note: previous implicit declaration is here
                                mathexp_compute(ses, node);
                                ^
math.c:599:13: warning: implicit declaration of function 'tindice' is invalid in C99 [-Wimplicit-function-declaration]
                                value = tindice(node->prev->str3, node->next->str3);
                                        ^
math.c:669:14: warning: implicit declaration of function 'tincmp' is invalid in C99 [-Wimplicit-function-declaration]
                                        value = tincmp(node->prev->str3, node->next->str3) <= 0;
                                                ^
math.c:730:13: warning: implicit declaration of function 'tineval' is invalid in C99 [-Wimplicit-function-declaration]
                        value = (tineval(ses, node->prev->str3, node->next->str3) != 0);
                                 ^
math.c:767:8: error: conflicting types for 'tintoi'
double tintoi(char *str)
       ^
math.c:90:8: note: previous implicit declaration is here
        val = tintoi(result);
              ^
math.c:946:8: error: conflicting types for 'tincmp'
double tincmp(char *left, char *right)
       ^
math.c:669:14: note: previous implicit declaration is here
                                        value = tincmp(node->prev->str3, node->next->str3) <= 0;
                                                ^
math.c:958:8: error: conflicting types for 'tineval'
double tineval(struct session *ses, char *left, char *right)
       ^
math.c:730:13: note: previous implicit declaration is here
                        value = (tineval(ses, node->prev->str3, node->next->str3) != 0);
                                 ^
math.c:970:8: error: conflicting types for 'tindice'
double tindice(char *left, char *right)
       ^
math.c:599:13: note: previous implicit declaration is here
                                value = tindice(node->prev->str3, node->next->str3);
                                        ^
10 warnings and 8 errors generated.
make: *** [math.o] Error 1

XCode is close to the latest.
Just figured I'd let you know, as it doesn't appear that many people use tintin on mac haha. Also I tried installing from macports, but that was really old (2.00.71).
Thanks,
-Michael.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sun Mar 08, 2015 3:22 pm    Post subject: Reply with quote

I'm not certain what the problem is. Don't have access to a mac to see for myself.

Could edit tintin.h and remove extern before the get_number definition (line 1271) and see if that makes a difference.
Back to top
View user's profile Send private message Send e-mail
lilmike



Joined: 08 Feb 2015
Posts: 9
Location: Baton Rouge, Louisiana

PostPosted: Sun Mar 08, 2015 4:40 pm    Post subject: Reply with quote

Hi,
According to what I've read online, in c99 if you don't declare a function (int func1(int a, bool b)Wink before when it's used, it tends to give those errors. Could that have something to do with it? I'll try your suggestion and post back.
-Michael.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
lilmike



Joined: 08 Feb 2015
Posts: 9
Location: Baton Rouge, Louisiana

PostPosted: Sun Mar 08, 2015 4:47 pm    Post subject: Reply with quote

Hi,
Just tried removing the extern before the get_number line and no difference.
-Michael.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Slysven



Joined: 10 Apr 2011
Posts: 365
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Thu Mar 12, 2015 9:18 am    Post subject: Reply with quote

lilmike wrote:
Hi,
According to what I've read online, in c99 if you don't declare a function:
Code:
int func1(int a, bool b);
Edit: rewritten to take out smiley equivalent code!
before when it's used, it tends to give those errors. Could that have something to do with it? I'll try your suggestion and post back.
-Michael.
Yes, any function not previously declared is automagically understood to be something that returns an (int) value and any that then don't will flag these sort of errors - the ones that do are equally not previously defined but they will not throw this error. This is one purpose of #include-ing header files - they contain those definitions!

IIRC this lack of a previous definition will also impact on checking of arguments that are fed into a function as well as what it returns (or not in the case of void ones).

The bottom line is that somehow the compiler is NOT seeing or reading the header file where those functions (and the silently overlooked (int) returning ones) are declared. Given that yours is a MacOS set-up I'd guess the location for such a header is not the same as some of the other more commonly used (for TinTin++) platforms. Coffee

Edit: Or the instructions to tell the XCode compiler to b****y well go and look for the headers or the assumptions that are made automagically about such locations are not the same as the ones that GCC uses... Nope
Back to top
View user's profile Send private message
lilmike



Joined: 08 Feb 2015
Posts: 9
Location: Baton Rouge, Louisiana

PostPosted: Thu Mar 12, 2015 9:55 pm    Post subject: Reply with quote

Hi,
The problem I see here is that all the functions that it thinks aren't defined are defined in tintin.h. So either it's not finding the tintin.h file (in which case I'm pretty sure it would give an error/warning), or for some reason tintin.h is being included in such a way that the functions aren't seen or are seen after their use.
-Michael.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Garuk



Joined: 25 Mar 2015
Posts: 5

PostPosted: Wed Mar 25, 2015 7:33 am    Post subject: Reply with quote

Same problem with macosx 10.8.5.

Version 2.01.0 of tt is working.

Any ideas what's happened with headers or makefile in between 01.0 and 01.1?

Do you need config.log in additon to errors of make?
Back to top
View user's profile Send private message Send e-mail
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Fri Mar 27, 2015 6:39 pm    Post subject: Reply with quote

Could be the gnutls addition.

I assume things compile alright until it gets to math.c ?

What does the Makefile file look like?
Back to top
View user's profile Send private message Send e-mail
Garuk



Joined: 25 Mar 2015
Posts: 5

PostPosted: Sat Mar 28, 2015 12:38 am    Post subject: Reply with quote

2.01.00
Code:

CFLAGS += $(DEFINES)

LDFLAGS =

INCS =

LIBS = -lpcre -lutil -lpthread -lz

# If you prefer to be able to enter ISO latin-1 characters instead
# of being able to use the meta key for special emacs-like commands
# uncomment the following line.
#F1 = -DUSE_ISO_LATIN_ONE

# If you need to make connections through a SOCKS server, uncomment
# these 2 lines.  You also need to modify LIBSOCKS to point to the location
# of your SOCKS library.
#F6 = -DSOCKS
#LIBSOCKS = -lsocks5


# DEFAULT_FILE_DIR is the path to tintin files.
# DEFAULT_FILE_DIR = @HOME@
DEFAULT_FILE_DIR = $(HOME)

FFLAGS= $(F1) $(F6)


OFILES = action.o alias.o files.o help.o highlight.o strhash.o input.o log.o \
         main.o misc.o net.o parse.o path.o update.o history.o tab.o vt102.o \
         terminal.o session.o function.o text.o substitute.o tick.o telopt.o \
         math.o split.o debug.o tinexp.o mapper.o tables.o buffer.o prompt.o \
         class.o  event.o utils.o chat.o macro.o  config.o gag.o variable.o \
         list.o forkpty.o cursor.o memory.o system.o line.o tokenize.o \
         data.o nest.o advertise.o


default: all


2.01.1
Code:

CFLAGS += $(DEFINES)

LDFLAGS =

INCS =

LIBS = -lm -lgnutls -lpcre -lutil -lpthread -lz

# If you prefer to be able to enter ISO latin-1 characters instead
# of being able to use the meta key for special emacs-like commands
# uncomment the following line.
#F1 = -DUSE_ISO_LATIN_ONE

# If you need to make connections through a SOCKS server, uncomment
# these 2 lines.  You also need to modify LIBSOCKS to point to the location
# of your SOCKS library.
#F6 = -DSOCKS
#LIBSOCKS = -lsocks5


# DEFAULT_FILE_DIR is the path to tintin files.
# DEFAULT_FILE_DIR = @HOME@
DEFAULT_FILE_DIR = $(HOME)

FFLAGS= $(F1) $(F6)


OFILES = action.o alias.o files.o help.o highlight.o strhash.o input.o log.o \
         main.o misc.o net.o parse.o path.o update.o history.o tab.o vt102.o \
         terminal.o session.o function.o text.o substitute.o tick.o telopt.o \
         math.o split.o debug.o tinexp.o mapper.o tables.o buffer.o prompt.o \
         class.o  event.o utils.o chat.o macro.o  config.o gag.o variable.o \
         list.o forkpty.o cursor.o memory.o system.o line.o tokenize.o \
         data.o nest.o advertise.o ssl.o


default: all


Can you make gnutls optional(disableable) ?
gnutls make makes brazilion warnings "implicit declaration of function" and "wrong pointer type" but install works.

with tintin as op posted:
Code:

math.c:83:8: error: conflicting types for 'get_number'
double get_number(struct session *ses, char *str)
       ^


P.S. God damn linux, all hail BSD! Ecstatic
Back to top
View user's profile Send private message Send e-mail
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sun Mar 29, 2015 9:10 am    Post subject: Reply with quote

./configure is supposed to detect gnutls.

-lm and -gnutls might be the problem, don't think it should add -gnutls unless the gnutls library is found. Is gnutls installed?

Not sure if -lm is required, might be because of certain math functions 1.01 uses.
Back to top
View user's profile Send private message Send e-mail
Garuk



Joined: 25 Mar 2015
Posts: 5

PostPosted: Sun Mar 29, 2015 2:20 pm    Post subject: Reply with quote

Well, it's the same error with and without gnutls.
Back to top
View user's profile Send private message Send e-mail
Slysven



Joined: 10 Apr 2011
Posts: 365
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Mon Mar 30, 2015 7:17 pm    Post subject: Reply with quote

Well, -lm for the c maths library is very unlikely in my amateur view to be the problem...

The absence of ssl.o in the older version strikes me as odd given that according to the versions on display at the unofficial repository at https://github.com/tintinplusplus/tintin the only change to that file is the commenting out of a debug feature in the later version so I'd expect it to have been included in both makefiles. However if the older version was compiled without SSL it would also exclude the GnuTLS Transport Layer Security Library!

Forgive me for asking what might be an obvious question (it's been ages since I've delved in TinTin++) but is SSL an optional compile time element that was not used in your old 2.01.00 version?
Back to top
View user's profile Send private message
xzhang



Joined: 19 Jun 2015
Posts: 1

PostPosted: Fri Jun 19, 2015 4:26 pm    Post subject: Reply with quote

I think this problem is cause by __MATH_H__ in tintin.h
Code:

#ifndef __MATH_H__
#define __MATH_H__

extern DO_COMMAND(do_math);
extern double get_number(struct session *ses, char *str);

...

#endif


__MATH_H__ been defined somewhere else in OS X, so those function never got declared.

I changed __MATH_H__ to __TT_MATH_H__, then everything worked.
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sat Jun 20, 2015 8:45 am    Post subject: Reply with quote

Thanks. Ecstatic
Back to top
View user's profile Send private message Send e-mail
Slysven



Joined: 10 Apr 2011
Posts: 365
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Sat Jun 20, 2015 9:32 pm    Post subject: Reply with quote

Well caught that person! Cool

Is there any chance any other of the include guards might be affected like that in the future - I guess it is only a remote possibility - is it worthwhile putting that "TT_" part in all of them as the improbability of guard #DEFINEs with that additional combination of letters is much larger?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Tue Jun 23, 2015 4:44 pm    Post subject: Reply with quote

Guess I could switch to using a single guard.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group