[Haskell-cafe] Need help with ghc static compile for cgi using mysql

Austin King shout at ozten.com
Mon Oct 12 17:23:21 EDT 2009


I'm trying to host a cgi I've written. It uses Database.HDBC,
Database.HDBC.MySQL, Network.CGI,  and Text.XHtml.Transitional

Here is the command I'm using to compile
ghc --make -optl-static -optl-pthread -static -o test.cgi
-package cgi -package xhtml -package HDBC-mysql -package HDBC -optl
-lz  Main.hs
and I get "(.text+0x120): undefined reference to `compress'"
Searching around I found that mysql recommended passing "lz" to the
linker... so I added -optl -lz

Complete command and output:
ghc --make -optl-static -optl-pthread -static -o test.cgi
-package cgi -package xhtml -package HDBC-mysql -package HDBC -optl
-lz  Main.hs
[1 of 5] Compiling Config           ( Config.hs, Config.o )
[2 of 5] Compiling Model            ( Model.hs, Model.o )
[3 of 5] Compiling View             ( View.hs, View.o )
[4 of 5] Compiling Controller       ( Controller.hs, Controller.o )
[5 of 5] Compiling Main             ( Main.hs, Main.o )
Linking test.cgi ...
/opt/ghc-6.10.4/lib/ghc-6.10.4/network-2.2.1.2/libHSnetwork-2.2.1.2.a(HsNet.o):
In function `my_inet_ntoa':
HsNet.c:(.text+0x20): multiple definition of `my_inet_ntoa'
/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/libmysqlclient.a(my_net.o):(.text+0x0):
first defined here
/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/libmysqlclient.a(mf_pack.o):
In function `unpack_dirname':
(.text+0x75b): warning: Using 'getpwnam' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/libmysqlclient.a(libmysql.o):
In function `read_user_name':
(.text+0x6081): warning: Using 'getpwuid' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/libmysqlclient.a(mf_pack.o):
In function `unpack_dirname':
(.text+0x76a): warning: Using 'endpwent' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/opt/ghc-6.10.4/lib/ghc-6.10.4/network-2.2.1.2/libHSnetwork-2.2.1.2.a(HsNet.o):
In function `hsnet_getaddrinfo':
HsNet.c:(.text+0x15): warning: Using 'getaddrinfo' in statically
linked applications requires at runtime the shared libraries from the
glibc version used for linking
/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/libmysqlclient.a(ssl.o):
In function `yaSSL::read_file(yaSSL::SSL_CTX*, char const*, int,
yaSSL::CertType)':
(.text+0x29f3): warning: memset used with constant zero length
parameter; this could be due to transposed parameters
/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/libmysqlclient.a(my_gethostbyname.o):
In function `my_gethostbyname_r':
(.text+0x3c): warning: Using 'gethostbyname_r' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/opt/ghc-6.10.4/lib/ghc-6.10.4/network-2.2.1.2/libHSnetwork-2.2.1.2.a(BSD__213.o):
In function `s9bc_info':
(.text+0x55): warning: Using 'getprotobyname' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/libmysqlclient.a(libmysql.o):
In function `mysql_server_init':
(.text+0x6b22): warning: Using 'getservbyname' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/libmysqlclient.a(my_compress.o):
In function `my_uncompress':
(.text+0x6b): undefined reference to `uncompress'
/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/libmysqlclient.a(my_compress.o):
In function `my_compress_alloc':
(.text+0x120): undefined reference to `compress'
collect2: ld returned 1 exit status

I'm using ghc 6.10.4 on Ubuntu 9.04 i386
I have libmysqlclient15-dev installed....

Thanks,
Austin


More information about the Haskell-Cafe mailing list