Re: Problem compiling

Wow, this was sent from an address that the listserv doesn't like.  
After waiting some period of time, I decided to resend.  The hope would 
be that someone could check this patch with some alternative mysql 
installations and operating systems before I commit it . . .

BTW, thanks to all the folks for the prompt followup replies !

more,
l8r,
v

Vic Bancroft wrote:

> Sam Varshavchik wrote:
>
>> Well, there's your problem right there.  I do not see the "-I 
>> /opt/mysql/include" option anywhere.
>
>
> Yup, without the include directive the compiler will not find the 
> appropriate definitions.  This is odd, since the last time I used the 
> mysql feature with mysql built out in /usr/local everythi9ng worked . . .
>
>> John Coppens writes:
>
>
>>> Please help...
>>
>>
> Okay, I decide to give libwww and mysql a a go on my freshly installed 
> FC6.  Checking my version of mysql using the rpm command, I see that 
> is is hopelessly last week (egads, last quarter even),
>
>  [bancroft@orca ~]$ rpm -qi mysql
>  Name        : mysql                        Relocations: (not 
> relocatable)
>  Version     : 5.0.22                            Vendor: Red Hat, Inc.
>  Release     : 2.1                           Build Date: Fri 14 Jul 
> 2006 10:15:32 AM EDT
>  Install Date: Thu 09 Nov 2006 10:34:46 AM EST      Build Host: 
> hs20-bc2-2.build.redhat.com
>  Group       : Applications/Databases        Source RPM: 
> mysql-5.0.22-2.1.src.rpm
>  Size        : 5749284                          License: GPL
>  Signature   : DSA/SHA1, Tue 03 Oct 2006 10:53:06 PM EDT, Key ID 
> b44269d04f2a6fd2
>  Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
>  URL         : http://www.mysql.com
>  Summary     : MySQL client programs and shared libraries.
>
> For the most recent binary and source code bundles one might check,
>
>  http://dev.mysql.com/downloads/mysql/5.0.html#downloads
>
> Since perhaps my customized x86_64 platform does not quite fit the 
> pattern of any precompiled version, I will select the source code 
> distribution in a nice retro tar.gz format . . .
>
>  Source downloads
>
>  For maximum stability and performance, we recommend that you use the 
> binaries we provide.
>  Tarball (in 5.1 both Unix & Windows, tar.gz)        5.0.27    
> 24.7M    Pick a mirror
>  MD5: 584d423440a9d9c859678e3d4f2690b3 | Signature
>
> Consider that I would _really_ like to try a particular set of 
> features for my development environment, (including a refix location 
> someone posted on a listserv I monitor;),
>
>  ./configure --prefix=/opt/mysql    \
>    --enable-dependency-tracking     \
>    --enable-thread-safe-client      \
>    --enable-assembler               \
>    --with-comment                   \
>    --with-mysqlmanager              \
>    --without-bench                  \
>    --with-yassl                     \
>    --with-big-tables                \
>    --with-example-storage-engine    \
>    --with-archive-storage-engine    \
>    --with-csv-storage-engine        \
>    --with-blackhole-storage-engine  \
>    --with-ndbcluster                \
>    --with-ndb-docs                  \
>    --with-ndb-port                  \
>    --with-ndb-port-base             \
>    --with-federated-storage-engine
> After the obligatory
>
>  $ make; sudo make install
>  ...
>  make[1]: Leaving directory `/usr/local/src/mysql-5.0.27'
>
>  real    12m33.322s
>  user    10m3.674s
>  sys     2m13.588s
>
>  $ sudo make install
>  ...
>
> After what seems like an eternity, I can get down to what I really 
> enjoy, which is to bootstrap a copy of libwww from the libwww site,
>
>  http://www.w3.org/Library/cvs.html
>
> Since the libwww maintainers can't get together long enough to make a 
> release, I always have to check out the HEAD from cvs (I use the ssh 
> method, but the pserver one should work for anyone), and do the 
> bootstrap steps,
>
>  $ cd libwww
>  $ perl config/winConfigure.pl
>  assuming global: PUBLIC FILE *WWWTrace = NULL;
>  assuming global: PUBLIC unsigned int WWW_TraceFlag = 0;         /* 
> Global trace flag for ALL W3 code */
>  assuming global: PUBLIC int ParseDebug = 0;     /* For use with 
> LablPars and RatPars */
>  $ aclocal; autoheader; automake; autoconf
>
> For some reason I do not recall seeing the global assumption, however, 
> I continue on with the
>  ./configure               \
>    --prefix=/opt/mysql     \
>    --with-x                \
>    --with-regex            \
>    --with-mysql=/opt/mysql \
>    --with-expat            \
>    --with-md5              \
>    --with-dav           
> The make runs for some time and then we have,
>
>   gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I/usr/local/include 
> -I../../modules/md5 -I../../modules/expat/lib 
> -DW3C_ICONS=\"/usr/local/share/w3c-libwww\" -g -O2 -Wall -MT HTSQL.lo 
> -MD -MP -MF .deps/HTSQL.Tpo -c HTSQL.c -o HTSQL.o
>  In file included from HTSQL.c:19:
>  HTSQL.h:34:25: error: mysql/mysql.h: No such file or directory
>  In file included from HTSQL.c:19:
>  HTSQL.h:101: error: expected '=', ',', ';', 'asm' or '__attribute__' 
> before '*' token
>  HTSQL.h:171: error: expected '=', ',', ';', 'asm' or '__attribute__' 
> before '*' token
>  HTSQL.h:178: error: expected ')' before '*' token
>
> Bingo !  I have replicated your error !
>
> It turns out that the mysql installation is assumed by configure.ac to 
> be in /usr/local !
>
> What we really need it to use more current methods like,
>
>  $ /opt/mysql/bin/mysql_config --cflags
>  -I/opt/mysql/include/mysql
>  $ /opt/mysql/bin/mysql_config --libs_r
>  -L/opt/mysql/lib/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl 
> -lm -lpthread
>
> Since this is done in configure.ac, I decided to try,
>
>      AC_MSG_CHECKING("$withval")
>      mysql_dir="$withval/bin"
>      # Try to find the mysql_config program
>      AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no, $mysql_dir $PATH )
>      if test "$MYSQL_CONFIG" = no ; then
>         AC_MSG_ERROR([cannot find mysql_config])
>      fi
>      MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
>      AC_SUBST(MYSQL_CFLAGS)
>      MYSQL_LIBS=$($MYSQL_CONFIG --libs_r)
>      AC_SUBST(MYSQL_LIBS)
>
> This seemed to produce the appropriate macros which could be put into 
> play by a slight modification to the Library/src/Makefile.am by adding 
> the produced values as,
>
>  libwwwsql_la_LDFLAGS = -rpath $(libdir) $(MYSQL_LIBS)
>
>  INCLUDES =  \
>      -I/usr/local/include \
>      -I${top_srcdir}/modules/md5 \
>      -I${top_srcdir}/modules/expat/lib \
>      $(MYSQL_CFLAGS)
>
> However, this does change the assumption about where the include file 
> is relative to the directive, so the header files and source files 
> need the simplified definition,
>
>  #include <mysql.h>
>
> This same sort of modification is required for all the directories 
> that make use of the library.  However, that is so tedious and boring 
> as to be left to any one that would rather read the cvs diffs . . .
>
> Of course now folks who followed Sam's advise and just used the 
> packages, or that happen to have installed mysql in /usr/local as 
> folks often do when the package is not available require that those 
> locations be fixed up as well.  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.
>
> more,
> l8r,
> v
>
> BTW, Upon inspection, it appears that openssl has the same issue . . . 
> anyone want to replicate this kind of patch ?
>
>
>
>
>------------------------------------------------------------------------
>
>diff -Naur libwww/configure.ac libwww-mysql/configure.ac
>--- libwww/configure.ac	2006-03-13 23:44:46.000000000 -0500
>+++ libwww-mysql/configure.ac	2006-11-14 00:43:29.000000000 -0500
>@@ -504,14 +504,45 @@
>     AC_MSG_RESULT(yes)
>     if test "x$withval" = "xyes"; then
>       if test -f '/usr/local/lib/mysql/libmysqlclient.a'; then
>-         AC_ADDLIB("/usr/local/lib/mysql/libmysqlclient.a")
>+         # AC_ADDLIB("/usr/local/lib/mysql/libmysqlclient.a")
>+         mysql_dir="/usr/local/bin"
>+         # Try to find the mysql_config program
>+         AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no, $mysql_dir $PATH )
>+         if test "$MYSQL_CONFIG" = no ; then
>+            AC_MSG_ERROR([cannot find mysql_config])
>+         fi
>+         MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
>+         AC_SUBST(MYSQL_CFLAGS)
>+         MYSQL_LIBS=$($MYSQL_CONFIG --libs_r)
>+         AC_SUBST(MYSQL_LIBS)
>       elif test -f '/usr/lib/mysql/libmysqlclient.a'; then
>-         AC_ADDLIB("/usr/lib/mysql/libmysqlclient.a")
>+         # AC_ADDLIB("/usr/lib/mysql/libmysqlclient.a")
>+         mysql_dir="/usr/bin"
>+         # Try to find the mysql_config program
>+         AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no, $mysql_dir $PATH )
>+         if test "$MYSQL_CONFIG" = no ; then
>+            AC_MSG_ERROR([cannot find mysql_config])
>+         fi
>+         MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
>+         AC_SUBST(MYSQL_CFLAGS)
>+         MYSQL_LIBS=$($MYSQL_CONFIG --libs_r)
>+         AC_SUBST(MYSQL_LIBS)
>       else
>          AC_MSG_ERROR(Could not find the mysql client library.)
>       fi
>     else
>-      AC_ADDLIB($withval)
>+      # AC_ADDLIB($withval)
>+      AC_MSG_CHECKING("$withval")
>+      mysql_dir="$withval/bin"
>+      # Try to find the mysql_config program
>+      AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no, $mysql_dir $PATH )
>+      if test "$MYSQL_CONFIG" = no ; then
>+         AC_MSG_ERROR([cannot find mysql_config])
>+      fi
>+      MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
>+      AC_SUBST(MYSQL_CFLAGS)
>+      MYSQL_LIBS=$($MYSQL_CONFIG --libs_r)
>+      AC_SUBST(MYSQL_LIBS)
>     fi
>     AC_DEFINE(HT_MYSQL, 1, [Define to enable mysql access.])
>     HTSQL="HTSQL.lo"
>diff -Naur libwww/Library/cvs2sql/Makefile.am libwww-mysql/Library/cvs2sql/Makefile.am
>--- libwww/Library/cvs2sql/Makefile.am	1999-04-12 19:57:10.000000000 -0500
>+++ libwww-mysql/Library/cvs2sql/Makefile.am	2006-11-14 00:33:35.000000000 -0500
>@@ -21,7 +21,9 @@
> 	../src/libwwwtrans.la \
> 	../src/libwwwcore.la \
> 	../src/libwwwutils.la \
>-	-lm @LIBWWWZIP@ @LIBWWWWAIS@ @LIBWWWSQL@ @LIBWWWMD5@
>+	-lm @LIBWWWZIP@ @LIBWWWWAIS@ @LIBWWWSQL@ @LIBWWWMD5@ \
>+	$(MYSQL_LIBS)
> 
> INCLUDES = \
>-	-I$(srcdir)/../../Library/src
>+	-I$(srcdir)/../../Library/src \
>+	$(MYSQL_CFLAGS)
>diff -Naur libwww/Library/src/HTSQL.c libwww-mysql/Library/src/HTSQL.c
>--- libwww/Library/src/HTSQL.c	2005-07-25 18:05:36.000000000 -0400
>+++ libwww-mysql/Library/src/HTSQL.c	2006-11-14 00:20:27.000000000 -0500
>@@ -18,8 +18,8 @@
> #include "WWWLib.h"
> #include "HTSQL.h"					 /* Implemented here */
> 
>-#include <mysql/mysql.h>
>-#include <mysql/errmsg.h>
>+#include <mysql.h>
>+#include <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) 
>diff -Naur libwww/Library/src/HTSQL.html libwww-mysql/Library/src/HTSQL.html
>--- libwww/Library/src/HTSQL.html	2005-11-11 09:03:16.000000000 -0500
>+++ libwww-mysql/Library/src/HTSQL.html	2006-11-14 00:18:58.000000000 -0500
>@@ -28,7 +28,7 @@
> #ifndef HTSQL_H
> #define HTSQL_H
> 
>-#include &lt;mysql/mysql.h&gt;
>+#include &lt;mysql.h&gt;
> 
> #ifdef __cplusplus
> extern "C" { 
>diff -Naur libwww/Library/src/HTSQLLog.c libwww-mysql/Library/src/HTSQLLog.c
>--- libwww/Library/src/HTSQLLog.c	1999-02-22 16:10:12.000000000 -0600
>+++ libwww-mysql/Library/src/HTSQLLog.c	2006-11-14 00:20:47.000000000 -0500
>@@ -17,7 +17,7 @@
> #include "HTSQL.h"
> #include "HTSQLLog.h"					 /* Implemented here */
> 
>-#include <mysql/mysql.h>
>+#include <mysql.h>
> 
> struct _HTSQLLog {
>     HTSQL *		sql;
>diff -Naur libwww/Library/src/Makefile.am libwww-mysql/Library/src/Makefile.am
>--- libwww/Library/src/Makefile.am	2003-03-21 05:15:44.000000000 -0500
>+++ libwww-mysql/Library/src/Makefile.am	2006-11-14 00:15:24.000000000 -0500
>@@ -383,12 +383,13 @@
> 	HTSQLLog.h \
> 	HTSQLLog.c
> 
>-libwwwsql_la_LDFLAGS = -rpath $(libdir)
>+libwwwsql_la_LDFLAGS = -rpath $(libdir) $(MYSQL_LIBS)
> 
>-INCLUDES = \
>+INCLUDES =  \
> 	-I/usr/local/include \
> 	-I${top_srcdir}/modules/md5 \
>-	-I${top_srcdir}/modules/expat/lib
>+	-I${top_srcdir}/modules/expat/lib \
>+	$(MYSQL_CFLAGS)
> 
> BUILT_SOURCES = \
> 	wwwsys.h \
>diff -Naur libwww/Robot/src/Makefile.am libwww-mysql/Robot/src/Makefile.am
>--- libwww/Robot/src/Makefile.am	2005-02-27 17:52:38.000000000 -0500
>+++ libwww-mysql/Robot/src/Makefile.am	2006-11-14 00:35:21.000000000 -0500
>@@ -21,14 +21,16 @@
> 	$(top_builddir)/Library/src/libwwwcore.la \
> 	$(top_builddir)/Library/src/libwwwutils.la \
> 	-lm @LIBWWWXML@ @LIBWWWZIP@ @LIBWWWWAIS@ \
>-	@LIBWWWSQL@ @LIBWWWMD5@ @LIBWWWSSL@
>+	@LIBWWWSQL@ @LIBWWWMD5@ @LIBWWWSSL@ \
>+	$(MYSQL_LIBS)
> 
> SUBDIRS = windows
> 
> INCLUDES = \
>-	-I$(srcdir)/../../Library/src \
>+	-I$(srcdir)/../../Library/src     \
> 	-I$(srcdir)/../../Library/src/SSL \
>-	-I$(top_srcdir)/modules/expat/lib
>+	-I$(top_srcdir)/modules/expat/lib \
>+	$(MYSQL_CFLAGS)
> 
> #	.h files are distributed but originally are made from the
> #	self-documenting hypertext files.
>  
>


-- 
"The future is here. It's just not evenly distributed yet."
 -- William Gibson, quoted by Whitfield Diffie

Received on Saturday, 18 November 2006 13:03:08 UTC