Re: Compile Error

From: Robert Collins <robertc@dont-contact.us>
Date: Sat, 27 Sep 2003 12:40:07 +1000

On Sat, 2003-09-27 at 07:10, WA Support wrote:
> Hello,
>
> I realize that this may be off topic a bit, but I can't figure this one
> out.
>
> I am trying to add MySQL (mysql-4.0.15) query capability in the
> redirect.cc module for squid-3.0-PRE3-20030924.
>
> I am running Redhat 7.3 with kernel 2.4.20-19.7,
> glibc-2.2.5-43.i686 (from Redhat rpm), and gcc/g++ 3.2.3 from GNU
> tarball.
>
> When I include mysql.h to the redirect.cc module and try to compile
> Squid, I get:
>
> <snip>
> if g++ -DHAVE_CONFIG_H
> -DDEFAULT_CONFIG_FILE=\"/usr/local/squid/etc/squid.conf\" -I. -I.
> -I../include -I. -I. -I../include -I../include
> -I../lib/libTrie/include -Werror -Wall -Wpointer-arith -Wwrite-strings
> -Wmissing-prototypes -Wcomments -g -O2 -MT redirect.o -MD -MP -MF
> ".deps/redirect.Tpo" \
> -c -o redirect.o `test -f 'redirect.cc' || echo './'`redirect.cc; \
> then mv -f ".deps/redirect.Tpo" ".deps/redirect.Po"; \
> else rm -f ".deps/redirect.Tpo"; exit 1; \
> fi
> In file included from mysql.h:107,
> from redirect.cc:46:
> ../include/my_alloc.h:37: syntax error before `+' token
> cc1plus: warnings being treated as errors
>
>
> i.e.,
> <snip from my_alloc.h>
> 00035 typedef struct st_mem_root
> 00036 {
> 00037 USED_MEM *free; /* blocks with free memory in
> it */
> 00038 USED_MEM *used; /* blocks almost without free
> memory */
> <snip>
>
>
> I don't understand what the g++ compiler is complaining about with the
> syntax error before`+' token, I don't see a "+" token.

code in squid cannot use alloc, malloc, calloc, or free. They must use
xalloc, xcalloc, xfree, or mempools, or cbdata.
These wrappers help prevent common allocation bugs, as well as
introducing refcounting, slab allocation and the like (depending on
which specific thing is used).

> I added my_alloc.h (and other header files) from the MySQL distribution
> to the Squid 'include' directory.
>
> Also, I am not sure how to link in -lmysqlclient when I do finally get
> redirect.cc to compile. Any help on this one would also be appreciated.

edit src/Makefile.am as a cheap-hack. To get something suitable for
inclusion in CVS< you'll need a ./configure based solution.

> Any help with this would be greatly appreciated.

Rob

-- 
GPG key available at: <http://members.aardvark.net.au/lifeless/keys.txt>.

Received on Fri Sep 26 2003 - 20:40:20 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:20:42 MST