Re: Compiling SqlBox in OSX

Alejandro Guerrieri <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Andreas Fink just found the issue. It was a 32/64 bit issue with the server_type struct not being defined on any headers.

For example on sqlbox_mysql.h:

#ifdef HAVE_MYSQL
#include "gw/msg.h"
#include "sqlbox_sql.h"
struct server_type *sqlbox_init_mysql(Cfg* cfg); <----- Added this line
void sql_save_msg(Msg *msg, Octstr *momt);
...

I'm fixing it on the rest of the db engines and I'll commit a fix soon.

Thanks again Andreas!

--
Alejandro Guerrieri
[email protected]

On 18/02/2011, at 13:25, Alejandro Guerrieri wrote:

> Perhaps someone could help me out with this weird issue.
> 
> I'm trying to run SqlBox on OSX Snow Leopard, and while it compiles fine, I'm getting a segmentation fault when running it. I've fired up gdb and this is what I've got:
> 
> (gdb) run /etc/kannel/sqlbox.conf 
> Starting program: /usr/local/sbin/sqlbox /etc/kannel/sqlbox.conf
> Reading symbols for shared libraries .+++++++++. done
> 2011-02-18 13:15:22 [6572] [0] INFO: Debug_lvl = -1, log_file = <none>, log_lvl = 0
> 2011-02-18 13:15:22 [6572] [0] DEBUG: Kannel sqlbox version `svn-r4879'.
> Build `Feb 18 2011 13:09:32', compiler `4.2.1 (Apple Inc. build 5664)'.
> System Darwin, release 10.6.0, version Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386, machine i386.
> Hostname sleekbook.local, IP 192.168.193.1.
> Libxml version 2.7.3.
> Using OpenSSL 0.9.7l 28 Sep 2006.
> Compiled with MySQL 5.5.0-m2, using MySQL 5.5.0-m2.
> Using native malloc.
> 
> 2011-02-18 13:15:22 [6572] [0] INFO: Starting to log to file /var/log/kannel/sqlbox.log level 0
> 2011-02-18 13:15:22 [6572] [0] INFO: Added logfile `/var/log/kannel/sqlbox.log' with level `0'.
> 2011-02-18 13:15:22 [6572] [0] INFO: MYSQL: Connected to server at localhost.
> 2011-02-18 13:15:22 [6572] [0] INFO: MYSQL: server version 5.5.0-m2, client version 5.5.0-m2.
> 
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> Reason: KERN_INVALID_ADDRESS at address: 0x0000000000512268
> 0x000000010000123d in init_sqlbox [inlined] () at /Users/aleg/ideaProjects/gateway-svn/addons/sqlbox/gw/sqlbox.c:746
> 746         gw_sql_enter(cfg);
> 
> And a backtrace:
> 
> (gdb) bt
> #0  0x000000010000123d in init_sqlbox [inlined] () at /Users/aleg/ideaProjects/gateway-svn/addons/sqlbox/gw/sqlbox.c:746
> #1  0x000000010000123d in main (argc=<value temporarily unavailable, due to optimizations>, argv=0x7fff5fbff7b8) at sqlbox.c:790
> 
> 
> Line 746 is effectively:
> 
> gw_sql_enter(cfg);
> 
> This is mapped on sqlbox_sql.h, line 47:
> 
> #define gw_sql_enter sql_type->sql_enter
> 
> On my particular case, I'm using mysql, so that's defined on sqlbox_mysql.c line 326:
> 
>    res->sql_enter = sqlbox_configure_mysql;
> 
> If I replace gw_sql_enter by sqlbox_configure_mysql it works fine, but if fails on the next indirect pointer (sql_leave, for instance).
> 
> Here's a typical gcc line from the make output:
> 
> gcc -DHAVE_CONFIG_H -I. -I.. -I../gw -I../gw    -arch x86_64 -g -Os -pipe -no-cpp-precomp -DDARWIN=1 -I/usr/local/include/kannel -arch x86_64 -g -Os -pipe -no-cpp-precomp -DDARWIN=1 -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -D_LARGE_FILES= -I/usr/include/libxml2 -I/usr/include/openssl -I/usr/local/mysql/include -MT sqlbox.o -MD -MP -MF .deps/sqlbox.Tpo -c -o sqlbox.o sqlbox.c
> 
> Do any of this rings any bells? The same code runs perfectly fine on Linux.
> 
> Regards,
> --
> Alejandro Guerrieri
> [email protected]
> 
> 
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.