Skip to Content.
Sympa Menu

freetds - Re: [freetds] Problems compiling PHP with support for mssql (freetds) and firebird

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Problems compiling PHP with support for mssql (freetds) and firebird
  • Date: Thu, 9 Jun 2005 23:58:40 -0400

melim wrote:
>
> Hello folks,
>
> I´ve got a strange problem with an uncommon situation,
> Trying to compile php 4.3.11 using this line
>
> './configure' \
> '--with-mssql=/usr/local/freetds/' \
> '--with-interbase=/opt/firebird/' \
>
> Until here everything goes fine, but when I run make I got this problem:
>
> In file included from /usr/local/freetds/include/sybfront.h:23,
> from /usr/local/freetds/include/sqlfront.h:23,
> from
> /root/install/teste/php-4.3.11/ext/mssql/php_mssql.h:36,
> from main/internal_functions.c:34:
> /usr/local/freetds/include/sybdb.h:113: error: redefinition of `USHORT'
> /opt/firebird/include/ibase.h:101: error: `USHORT' previously declared
> here /usr/local/freetds/include/sybdb.h:265: error: redefinition of
> `BYTE' /opt/firebird/include/ibase.h:156: error: `BYTE' previously
> declared here make: *** [main/internal_functions.lo] Error 1
>
> I´ve posted this to php bugs list, but they told me to ask for this
> correction for Freetds or Firebird developers, so here I am.

$ grep -E 'BYTE;|USHORT;' firebird2/gen/firebird/include/ibase.h | grep
def
typedef unsigned short USHORT;
typedef unsigned char BYTE; /* Unsigned byte - common */

$ grep -E 'BYTE|USHORT' sybdb.h |grep def
typedef unsigned short USHORT;
typedef unsigned char BYTE;

Identical definitions. That's nice.

This really is a PHP problem, because they're including two unrelated
headers in the same compilation unit (internal_functions.c). They really
should organize their code to avoid that.

Your tailor-made workaround would be to hack your copy of sybdb.h, using
the preprocessor to avoid the redefinition. Lucky for you -- if this can
be called luck -- Firebird's file defines a symbol you can test for:
INCLUDE_FB_TYPES_H. In my copy, it's defined on line 38 of ibase.h.

The solution that suggests itself is to wrap the sybdb.h typedef thusly:

#ifndef INCLUDE_FB_TYPES_H
typedef unsigned short USHORT;
#endif

[then, later]

#ifndef INCLUDE_FB_TYPES_H
typedef unsigned char BYTE;
#endif

Aren't namespaces wonderful?

HTH.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page