|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Problem compilingHello people. I've tried to compile libwww with mysql support and had a few problems. (without mysql support installation went fine) Configure was done with --with-mysql=/opt/mysql (lib and include are below /opt/mysql) the configure process gave a first indication of problems: checking for /opt/mysql/... -L/opt -lmysql Which isn't correct, I think. I believe it should be -L/opt/mysql/lib -lmysql Compilation stopped: /bin/sh ../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I/usr/local/include -I../../modules/md5 -I../../modules/expat/xmlparse -DW3C_ICONS=\"/usr/local/share/w3c-libwww\" -g -O2 -Wall -c HTSQL.c .../../libtool: line 732: test: =: unary operator expected rm -f .libs/HTSQL.lo gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I/usr/local/include -I../../modules/md5 -I../../modules/expat/xmlparse -DW3C_ICONS=\"/usr/local/share/w3c-libwww\" -g -O2 -Wall -c HTSQL.c -fPIC -DPIC -o .libs/HTSQL.lo In file included from HTSQL.c:19: HTSQL.h:34:25: mysql/mysql.h: No such file or directory In file included from HTSQL.c:19: HTSQL.h:97: error: syntax error before '*' token HTSQL.h:97: warning: type defaults to `int' in declaration of `HTSQL_getMysql' mysql/mysql.h does exist, under /opt/mysql/include I'm no expert programmer, but I did compile a few apps (including some of my own) with mysql without problems... Please help... John |
|
|
Re: Problem compilingJohn Coppens writes:
> gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I/usr/local/include -I../../modules/md5 -I../../modules/expat/xmlparse -DW3C_ICONS=\"/usr/local/share/w3c-libwww\" -g -O2 -Wall -c HTSQL.c -fPIC -DPIC -o .libs/HTSQL.lo > In file included from HTSQL.c:19: > HTSQL.h:34:25: mysql/mysql.h: No such file or directory > In file included from HTSQL.c:19: > HTSQL.h:97: error: syntax error before '*' token > HTSQL.h:97: warning: type defaults to `int' in declaration of `HTSQL_getMysql' > > mysql/mysql.h does exist, under /opt/mysql/include Well, there's your problem right there. I do not see the "-I /opt/mysql/include" option anywhere. > I'm no expert programmer, but I did compile a few apps (including some of my own) > with mysql without problems... > > Please help... Fixing the configuration option should solve your immediate problem. However the best help you can have is some advice NOT to do what you've been doing: manually compiling large software packages and installing them in various random locations, by hand. You did not mention what platform you're running. All major Linux distributions, various BSD flavors, and other platforms -- they all have their own tools for managing software package deployment, and maintenance -- rpm and apt on Linux, ports on BSD, etc… They're there for a reason, to make sure that all software gets properly integrated into the system, so you don't end up in the situation you just ended up in, right now. Rather than building MySQL by hand, and installing it into some nonstandard directory, it would've been better for you to simply install a pre-configured mysql build, that your platform's software package manager is likely to be able to install, just by asking it to. |
|
|
Re: Problem compilinghello, John Coppens wrote: > > Hello people. > > I've tried to compile libwww with mysql support and had a few problems. (without > mysql support installation went fine) > > Configure was done with --with-mysql=/opt/mysql > (lib and include are below /opt/mysql) > > the configure process gave a first indication of problems: > > checking for /opt/mysql/... -L/opt -lmysql > > Which isn't correct, I think. I believe it should be -L/opt/mysql/lib -lmysql > > Compilation stopped: > > /bin/sh ../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I/usr/local/include -I../../modules/md5 -I../../modules/expat/xmlparse -DW3C_ICONS=\"/usr/local/share/w3c-libwww\" -g -O2 -Wall -c HTSQL.c > .../../libtool: line 732: test: =: unary operator expected > rm -f .libs/HTSQL.lo > gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I/usr/local/include -I../../modules/md5 -I../../modules/expat/xmlparse -DW3C_ICONS=\"/usr/local/share/w3c-libwww\" -g -O2 -Wall -c HTSQL.c -fPIC -DPIC -o .libs/HTSQL.lo > In file included from HTSQL.c:19: > HTSQL.h:34:25: mysql/mysql.h: No such file or directory > In file included from HTSQL.c:19: > HTSQL.h:97: error: syntax error before '*' token > HTSQL.h:97: warning: type defaults to `int' in declaration of `HTSQL_getMysql' > > mysql/mysql.h does exist, under /opt/mysql/include > > I'm no expert programmer, but I did compile a few apps (including some of my own) > with mysql without problems... i am using w3c-libwww-5.4.0, what are you using? in w3c-libwww-5.4.0, HTSQL.c, HTSQL.h, and HTSQLLog.c are incorrect. they need to be hacked! if you look in Library/src off the base directory of your distribution of w3c-libwww, you will find HTSQL.c, HTSQL.h, and HTSQLLog.c check to see if HTSQL.c uses mysql_connect or mysql_real_connect, if 'mysql_connect', then you need to hack the code because 'mysql_connect' has been eliminated from mysql. they use 'mysql_real_connect' now, and the syntax is different. if you need help, write me directly (otrcomm@...), and i will guide you through how to get w3c-libwww compiled with mysql support. i use redhat 7.3, fedora core 4, and fedora core 5 systems and DO NOT install mysql at system build or with rpms or yum or apt-get. i always install the mysql tarball. i use mysql-4.1.15. i build mysql with: ../configure --prefix=/usr/local/mysql --with-mysqld-user=mysql --with-unix-socket-path=/tmp/mysql.sock so mysql gets installed in /usr/local/mysql. NOTE: adduser mysql before so the '--with-mysqld-user=mysql' switch makes sense :) then to get libww installed with mysql support, i use: ../configure --with-gnu-ld --with-mysql=/usr/local/mysql/lib/mysql/libmysqlclient.a works like a charm on several systems after i hacked the code mentioned above! regards, murrah boswell |
|
|
Re: Problem compilinghi,
it's true, i used webbot with mysql and i needed to do the same that you explained. I'm sending you the correct file. I use ubuntu 6.10 and webbot works fine. As "configure", I used: ./configure ?with-mysql=/usr/lib/libmysqlclient.a Good luck! Quoting OTR Comm <otrcomm@...>: > > hello, > > John Coppens wrote: >> >> Hello people. >> >> I've tried to compile libwww with mysql support and had a few >> problems. (without >> mysql support installation went fine) >> >> Configure was done with --with-mysql=/opt/mysql >> (lib and include are below /opt/mysql) >> >> the configure process gave a first indication of problems: >> >> checking for /opt/mysql/... -L/opt -lmysql >> >> Which isn't correct, I think. I believe it should be >> -L/opt/mysql/lib -lmysql >> >> Compilation stopped: >> >> /bin/sh ../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. >> -I../.. -I/usr/local/include -I../../modules/md5 >> -I../../modules/expat/xmlparse >> -DW3C_ICONS=\"/usr/local/share/w3c-libwww\" -g -O2 -Wall -c HTSQL.c >> .../../libtool: line 732: test: =: unary operator expected >> rm -f .libs/HTSQL.lo >> gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I/usr/local/include >> -I../../modules/md5 -I../../modules/expat/xmlparse >> -DW3C_ICONS=\"/usr/local/share/w3c-libwww\" -g -O2 -Wall -c HTSQL.c >> -fPIC -DPIC -o .libs/HTSQL.lo >> In file included from HTSQL.c:19: >> HTSQL.h:34:25: mysql/mysql.h: No such file or directory >> In file included from HTSQL.c:19: >> HTSQL.h:97: error: syntax error before '*' token >> HTSQL.h:97: warning: type defaults to `int' in declaration of >> `HTSQL_getMysql' >> >> mysql/mysql.h does exist, under /opt/mysql/include >> >> I'm no expert programmer, but I did compile a few apps (including >> some of my own) >> with mysql without problems... > > i am using w3c-libwww-5.4.0, what are you using? > > in w3c-libwww-5.4.0, HTSQL.c, HTSQL.h, and HTSQLLog.c are incorrect. > they need to be hacked! > > if you look in Library/src off the base directory of your distribution > of w3c-libwww, you will find HTSQL.c, HTSQL.h, and HTSQLLog.c > > check to see if HTSQL.c uses mysql_connect or mysql_real_connect, if > 'mysql_connect', then you need to hack the code because 'mysql_connect' > has been eliminated from mysql. they use 'mysql_real_connect' now, and > the syntax is different. if you need help, write me directly > (otrcomm@...), and i will guide you through how to get > w3c-libwww compiled with mysql support. > > i use redhat 7.3, fedora core 4, and fedora core 5 systems and DO NOT > install mysql at system build or with rpms or yum or apt-get. i always > install the mysql tarball. i use mysql-4.1.15. > > i build mysql with: > > ../configure --prefix=/usr/local/mysql --with-mysqld-user=mysql > --with-unix-socket-path=/tmp/mysql.sock > > so mysql gets installed in /usr/local/mysql. NOTE: adduser mysql before > so the '--with-mysqld-user=mysql' switch makes sense :) > > then to get libww installed with mysql support, i use: > > ../configure --with-gnu-ld > --with-mysql=/usr/local/mysql/lib/mysql/libmysqlclient.a > > works like a charm on several systems after i hacked the code mentioned > above! > > > regards, > murrah boswell > > > [HTSQL.c] /* HTSQL.c ** MYSQL INTERFACE MODULE ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. ** @(#) $Id: HTSQL.c,v 2.3 2005/07/25 22:05:36 vbancrof Exp $ ** ** This module interacts with the MYSQL C client library to perform ** SQL operations. It is not intended as a complete SQL API but handles ** most of the typical error situations talking to an SQL server so that ** the caller doesn't have to think about it. ** ** History: ** 23 Apr 98 Henrik Frystyk, frystyk@... */ /* Library include files */ #include "WWWLib.h" #include "HTSQL.h" /* Implemented here */ #include <mysql/mysql.h> #include <mysql/errmsg.h> /* updates for to remove deprecated mysql functions */ #define mysql_connect(m,h,u,p) mysql_real_connect((m),(h),(u),(p),NULL,0,NULL,0) /* mysql documentation indicates that database names have a maximun of 65 characters */ #define CREATE_DB_BUFFER_SIZE 128 #define CREATE_DB_QUERY_FORMAT "create database %s" struct _HTSQL { MYSQL server; MYSQL * psvr; const char * host; const char * user; const char * password; /* @@@ Should be scambled! @@@ */ const char * db; }; /* ------------------------------------------------------------------------- */ PRIVATE int sql_datetimestr (char ** ptr, time_t t) { int length = -1; if (t > 0 && *ptr) { #if defined(HT_REENTRANT) || defined(SOLARIS) struct tm gmt; struct * pgmt = gmtime_r(&t, &gmt); #else struct tm *pgmt = gmtime(&t); #endif /* SOLARIS || HT_REENTRANT */ #ifdef HAVE_STRFTIME length = strftime(*ptr, 40, "\'%Y-%m-%d %H:%M:%S\'", pgmt); #else length = sprintf(*ptr, "\'%04d-%02d-%02d %02d:%02d:%02d\'", pgmt->tm_year + 1900, pgmt->tm_mon + 1, pgmt->tm_wday + 1, pgmt->tm_hour, pgmt->tm_min, pgmt->tm_sec); #endif /* HAVE_STRFTIME */ /* Remove the trailing zero */ *ptr = *ptr + strlen(*ptr); **ptr++ = ' '; } return length; } PUBLIC char * HTSQL_printf (char * buf, int length, char * fmt, ...) { va_list pArgs; char * p=fmt; char * q=buf; char * cpar; unsigned upar; long lpar; time_t tpar; va_start(pArgs, fmt); while (*p && length>0) { if (*p == '%') { switch (*++p) { case 's': if ((cpar = va_arg(pArgs, char *)) != NULL) { char * cp = cpar; while ((*q++ = *cp++) && length-->0); q--; } else { *q++='n'; *q++='u'; *q++='l'; *q++='l'; length -= 4; } break; case 'S': if ((cpar = va_arg(pArgs, char *)) != NULL) { char * cp = cpar; *q++='\''; mysql_escape_string(q, cp, strlen(cp)); while (*q) q++, length--; *q++='\''; } else { *q++='n'; *q++='u'; *q++='l'; *q++='l'; length -= 4; } break; case 'T': if ((tpar = va_arg(pArgs, time_t)) > 0) { length -= sql_datetimestr(&q, tpar); } else { *q++='n'; *q++='u'; *q++='l'; *q++='l'; length -= 4; } break; case 'u': if ((upar = va_arg(pArgs, unsigned int)) >= 0) { char num[32]; char * nptr = num; int i; do { i = upar % 10; *nptr++ = i+'0'; upar /= 10; } while (upar > 0); while (nptr > num && length>0) *q++=*--nptr, length--; } else { *q++='0'; length--; } break; case 'l': if ((lpar = va_arg(pArgs, unsigned long)) >= 0) { char num[32]; char * nptr = num; int i; do { i = lpar % 10; *nptr++ = i+'0'; lpar /= 10; } while (lpar > 0); while (nptr > num && length>0) *q++=*--nptr, length--; } else { *q++='0'; length--; } break; default: *q++=*p++; length--; } p++; } else { *q++=*p++; length--; } } *q = '\0'; va_end(pArgs); return buf; } PUBLIC HTSQL * HTSQL_new (const char * host, const char * user, const char * pw, int flags) { HTSQL * me = NULL; if (!host || !user || !pw) { HTTRACE(SQL_TRACE, "SQL new..... Missing host, user, or password\n"); return NULL; } if ((me = (HTSQL *) HT_CALLOC(1, sizeof(HTSQL))) == NULL) HT_OUTOFMEM("HTSQL_new"); me->host = host; me->user = user; me->password = pw; /* @@@ scramble!!! @@@ */ return me; } PUBLIC BOOL HTSQL_delete (HTSQL * me) { if (me) { if (me->psvr) HTSQL_close(me); HT_FREE(me); return YES; } return NO; } PUBLIC BOOL HTSQL_connect (HTSQL * me) { if (me && me->host) { HTTRACE(SQL_TRACE, "SQL connect. Open a link to server `%s\'\n" _ me->host); if(mysql_init(&me->server)==NULL) { printf("\neiiii"); return 1; } // char* as = malloc(sizeof(mysql_get_client_info())); // as = mysql_get_client_info(); // printf(as); me->psvr = mysql_real_connect(&(me->server), me->host,me->user, me->password,NULL,0,NULL,0); // me->user ? me->user : "", //me->password ? me->password : ""); /* if(!mysql_real_connect(&(me->server), me->host,me->user, me->password,NULL,0,NULL,0)){ fprintf(stderr, "Failed to connect to database: Error: %s\n", mysql_error(&(me->server))); }*/ if (me->psvr == NULL) { // printf("ha fallat"); HTTRACE(SQL_TRACE, "SQL connect. `%s\' errno %d\n" _ mysql_error(&me->server) _ mysql_errno(&me->server)); return NO; } printf("ei"); return YES; } return NO; } PUBLIC MYSQL * HTSQL_getMysql (HTSQL * me) { return me ? me->psvr : NULL; } PUBLIC BOOL HTSQL_close (HTSQL * me) { if (me && me->psvr) { HTTRACE(SQL_TRACE, "SQL close... Link to host `%s\'\n" _ me->host); mysql_close(me->psvr); me->psvr = NULL; me->db = NULL; return YES; } return NO; } PUBLIC BOOL HTSQL_version (HTSQL * me, char ** server, unsigned int * protocol_version, char ** server_version, char ** client_version) { if (me && me->psvr) { if (*server) *server = mysql_get_server_info(me->psvr); if (protocol_version) *protocol_version = mysql_get_proto_info(me->psvr); if (*server_version) *server_version = mysql_get_server_info(me->psvr); if (*client_version) *client_version = mysql_get_client_info(); return YES; } return NO; } PUBLIC BOOL HTSQL_selectDB (HTSQL * me, const char * db) { BOOL created = NO; if (me && me->psvr && db) { HTTRACE(SQL_TRACE, "SQL select.. Database `%s\'\n" _ db); me->db = NULL; if (mysql_select_db(me->psvr, db) < 0) { int err = mysql_errno(me->psvr); HTTRACE(SQL_TRACE, "SQL select.. `%s\', errno %d\n" _ mysql_error(me->psvr) _ err); /* If the database couldn't be found then create a new one */ if (err == 1049) { char CREATE_DB_BUFFER[CREATE_DB_BUFFER_SIZE]; snprintf( CREATE_DB_BUFFER, (size_t)CREATE_DB_BUFFER_SIZE, CREATE_DB_QUERY_FORMAT, db ); if (mysql_query(me->psvr, CREATE_DB_BUFFER) < 0) { HTTRACE(SQL_TRACE, "SQL error... `%s\', errno %d\n" _ mysql_error(me->psvr) _ err); return NO; } created = YES; } else return NO; } if (created) { if (mysql_select_db(me->psvr, db) < 0) { int err = mysql_errno(me->psvr); HTTRACE(SQL_TRACE, "SQL select.. `%s\', errno %d\n" _ mysql_error(me->psvr) _ err); return NO; } } /* The database is now up and running */ me->db = db; return YES; } return NO; } PUBLIC BOOL HTSQL_query (HTSQL * me, const char * query) { HTTRACE(SQL_TRACE, "SQL query... `%s\'\n" _ query ? query : "<null>"); if (me && me->psvr && query) { if (mysql_query(me->psvr, query) < 0) { int status = mysql_errno(me->psvr); HTTRACE(SQL_TRACE, "SQL query... `%s\' on query `%s\' with errno %d\n" _ mysql_error(me->psvr) _ query _ status); /* Check to see if we should try and reconnect */ if (status==CR_SERVER_GONE_ERROR || status==CR_SERVER_LOST) { if (HTSQL_connect(me)==NO || HTSQL_selectDB(me, me->db)==NO) return NO; return (mysql_query(me->psvr, query) == 0); } return NO; } return YES; } return NO; } PUBLIC int HTSQL_getLastInsertId (HTSQL * me) { return (me && me->psvr) ? mysql_insert_id(me->psvr) : -1; } PUBLIC int HTSQL_GetAffectedRows (HTSQL * me) { return (me && me->psvr) ? mysql_affected_rows(me->psvr) : -1; } PUBLIC MYSQL_RES * HTSQL_storeResult (HTSQL * me) { MYSQL_RES * result = NULL; if (me && me->psvr) { if ((result = mysql_store_result(me->psvr)) == NULL) { int status = mysql_errno(me->psvr); HTTRACE(SQL_TRACE, "SQL store... `%s\' with errno %d\n" _ mysql_error(me->psvr) _ status); } } return result; } PUBLIC BOOL HTSQL_freeResult (MYSQL_RES * me) { if (me) { mysql_free_result(me); return YES; } return NO; } |
|
|
|
|
|
Re: Problem compilingVic Bancroft wrote: >> Rather than set up appropriate test environments or further break an >> already fragile config script, I will just attach a diff to this >> already painfully long email. > Well, I have since tested several configs with the diff and we now have, configure.ac new revision: 1.8 Makefile.am new revision: 1.5 HTSQL.c new revision: 2.4 HTSQL.html new revision: 2.3 HTSQLLog.c new revision: 2.4 Makefile.am new revision: 2.60 Makefile.am new revision: 1.34 The following options roughly match the original question as posted on the list by John Coppens, ./configure \ --prefix=/opt \ --with-x \ --with-regex \ --with-mysql=/opt/mysql \ --with-expat \ --with-md5 \ --with-dav This config works on a standard linux distribution, like Sam suggests, ./configure \ --prefix=/usr \ --with-x \ --with-regex \ --with-mysql \ --with-expat \ --with-md5 \ --with-dav This worked on one of my hybrid (i686/x86_64) machines and forces the use of 64 bit libraries, ./configure \ --prefix=/usr/local/mysql64 \ --with-x \ --with-regex \ --with-mysql=/usr/lib64 \ --with-expat \ --with-md5 \ --with-dav I supposed it would be nice to test a Solaris build and along those lines, I have just burned some a few iso images from, sol-10-u2-ga-x86-v1.iso sol-10-u2-ga-x86-v2.iso sol-10-u2-ga-x86-v3.iso sol-10-u2-ga-x86-v4.iso sol-10-u2-ga-x86-v5.iso Does anyone have access to some older Solaris to verify the build ? more, l8r, v -- "The future is here. It's just not evenly distributed yet." -- William Gibson, quoted by Whitfield Diffie |
| Free embeddable forum powered by Nabble | Forum Help |