MySQL / HSQL Won't Build

Bjorn Bringert bringert at cs.chalmers.se
Sun Jul 31 06:37:10 EDT 2005


Dominic Steinitz wrote:
> I've just downloaded and tried to build HSQL for MySQL but I'm getting the 
> errors below. mysql.h does exist. Any help would be appreciated.
> 
> Thanks, Dominic.
> 
> [dom at tility MySQL]$ ls /usr/include/mysql/mysql.h
> /usr/include/mysql/mysql.h
> 
> [dom at tility MySQL]$ ghc Setup.lhs -o Setup -package Cabal-1.0.1
> 
> [dom at tility MySQL]$ ./Setup configure
> Warning: No license-file field.
> Configuring hsql-mysql-1.6...
> configure: Using install prefix: /usr/local
> configure: Using compiler: /usr//bin/ghc
> configure: Compiler flavor: GHC
> configure: Compiler version: 6.4
> configure: Using package tool: /usr//bin/ghc-pkg
> configure: Using haddock: /usr//bin/haddock
> configure: No happy found
> configure: No alex found
> configure: Using hsc2hs: /usr//bin/hsc2hs
> configure: Using c2hs: /usr//bin/c2hs
> configure: No cpphs found
> configure: Dependency base-any: using base-1.0
> configure: Dependency hsql-any: using hsql-1.6
> configure: Using mysql_config: /usr//bin/mysql_config
> configure: configuring mysqlclient library
> 
> [dom at tility MySQL]$ more MySQL.buildinfo
> buildable: True
> cc-options:
> ld-options:
> frameworks:
> c-sources:
> extensions:
> extra-libraries: mysqlclient z crypt nsl m
> extra-lib-dirs: '/usr//lib/mysql'
> includes:
> include-dirs: '/usr//include/mysql'
> hs-source-dirs: .
> other-modules:
> ghc-options:
> hugs-options:
> nhc-options:
> 
> [dom at tility MySQL]$ ./Setup build
> Preprocessing library hsql-mysql-1.6...
> In file included from MySQL.hsc:14:
> /usr/lib/ghc-6.4/include/config.h:4:2: warning: #warning config.h is 
> deprecated; please use ghcconfig.h instead
> In file included from MySQL.hsc:33:
> Database/HSQL/HsMySQL.h:8:19: mysql.h: No such file or directory
> MySQL.hsc: In function `main':
> MySQL.hsc:90: error: `CLIENT_MULTI_STATEMENTS' undeclared (first use in this 
> function)
> MySQL.hsc:90: error: (Each undeclared identifier is reported only once
> MySQL.hsc:90: error: for each function it appears in.)
> MySQL.hsc:147: error: `MYSQL_FIELD' undeclared (first use in this function)
> MySQL.hsc:147: error: syntax error before ')' token
> MySQL.hsc:148: error: syntax error before ')' token
> MySQL.hsc:149: error: syntax error before ')' token
> MySQL.hsc:150: error: syntax error before ')' token
> MySQL.hsc:151: error: syntax error before ')' token
> MySQL.hsc:154: error: `NOT_NULL_FLAG' undeclared (first use in this function)
> MySQL.hsc:157: error: `FIELD_TYPE_STRING' undeclared (first use in this 
> function)
> MySQL.hsc:158: error: `FIELD_TYPE_VAR_STRING' undeclared (first use in this 
> function)
> MySQL.hsc:159: error: `FIELD_TYPE_DECIMAL' undeclared (first use in this 
> function)
> MySQL.hsc:160: error: `FIELD_TYPE_SHORT' undeclared (first use in this 
> function)
> MySQL.hsc:161: error: `FIELD_TYPE_INT24' undeclared (first use in this 
> function)
> MySQL.hsc:162: error: `FIELD_TYPE_LONG' undeclared (first use in this 
> function)
> MySQL.hsc:163: error: `FIELD_TYPE_FLOAT' undeclared (first use in this 
> function)
> MySQL.hsc:164: error: `FIELD_TYPE_DOUBLE' undeclared (first use in this 
> function)
> MySQL.hsc:165: error: `FIELD_TYPE_TINY' undeclared (first use in this 
> function)
> MySQL.hsc:166: error: `FIELD_TYPE_LONGLONG' undeclared (first use in this 
> function)
> MySQL.hsc:167: error: `FIELD_TYPE_DATE' undeclared (first use in this 
> function)
> MySQL.hsc:168: error: `FIELD_TYPE_TIME' undeclared (first use in this 
> function)
> MySQL.hsc:169: error: `FIELD_TYPE_TIMESTAMP' undeclared (first use in this 
> function)
> MySQL.hsc:170: error: `FIELD_TYPE_DATETIME' undeclared (first use in this 
> function)
> MySQL.hsc:171: error: `FIELD_TYPE_YEAR' undeclared (first use in this 
> function)
> MySQL.hsc:172: error: `FIELD_TYPE_BLOB' undeclared (first use in this 
> function)
> MySQL.hsc:173: error: `FIELD_TYPE_SET' undeclared (first use in this function)
> MySQL.hsc:174: error: `FIELD_TYPE_ENUM' undeclared (first use in this 
> function)
> Setup: got error code while preprocessing: Database.HSQL.MySQL
> [dom at tility MySQL]$

Upgrading to MySQL 4.1 fixed this problem for me, but introduced another 
one:

[bjorn at burns MySQL]$ ./Setup.lhs build -v
Reading parameters from /home/bjorn/projects/HSQL/MySQL/MySQL.buildinfo
Preprocessing library hsql-mysql-1.6...
/usr/bin/hsc2hs -I/usr/include/mysql -mcpu=i486 -fno-strength-reduce 
-IDatabase/HSQL -oDatabase/HSQL/MySQL.hs Database/HSQL/MySQL.hsc
unrecognized option `-m'
unrecognized option `-f'
unrecognized option `-n'
Usage: hsc2hs [OPTIONS] INPUT.hsc [...]

   -o FILE          --output=FILE          name of main output file
   -t FILE          --template=FILE        template file
   -c PROG          --cc=PROG              C compiler to use
   -l PROG          --ld=PROG              linker to use
   -C FLAG          --cflag=FLAG           flag to pass to the C compiler
   -I DIR                                  passed to the C compiler
   -L FLAG          --lflag=FLAG           flag to pass to the linker
   -i FILE          --include=FILE         as if placed in the source
   -D NAME[=VALUE]  --define=NAME[=VALUE]  as if placed in the source
                    --no-compile           stop after writing *_hsc_make.c
   -v               --verbose              dump commands to stderr
   -?               --help                 display this help and exit
   -V               --version              output version information 
and exit
*** Exception: got error code while preprocessing: Database.HSQL.MySQL


The problem is that GHC doesn't support all the flags output by 
mysql_config:

[bjorn at burns MySQL]$ mysql_config --cflags
-I/usr/include/mysql -mcpu=i486 -fno-strength-reduce

I have fixed the CVS version of HSQL to use "mysql_config --include" 
instead. So the solution for you is to upgrade MySQL, and either change 
"--cflags" on line 76 in HSQL/MySQL/Setup.lhs to "--include" or get HSQL 
from CVS.

/Björn


More information about the Libraries mailing list