[Haskell-cafe] Static linking problem // CentOS 5.5 - GHC 6.12.3

Ketil Malde ketil at malde.org
Wed Mar 16 08:05:31 CET 2011


frode k <mailinglist at klevstul.com> writes:

> However I do of course want to run it through CGI on a webserver. I'm
> running lighttpd. If I try to run the file compiled above I get "500 -
> Internal Server Error", most likely since the enviroment is not correct for
> dynamic linked files:

Why wouldn't the environment (i.e. available dynamic libraries) be
correct for the web server?

> Hence I wanted to use static linking (
> http://www.haskell.org/haskellwiki/Web/Literature/Static_linking ). However
> trying to compile using the "-optl-static" option fails:
> There are two main categories of error messages above:

> 1 : ...requires at runtime the shared libraries from the glibc version used
> for linking

Yes, Linux (or rather, glibc) doesn't really support static linking any
more, and relies on hard-coded paths to libraries for unicode stuff and
name resolution and authentication.  You can override this with
environment variables, though.

Perhaps this is helpful:
  http://blog.malde.org/index.php/2010/05/22/snagged/

> 2a : undefined reference to `pthread_....'
>
> 2b : undefined reference to `pthread_mutex_lock'

  ghc ... -optl-static -optl-pthread
                       ^^^^^^^^^^^^^
Not sure why you have to add this manually, but it's been this way for
years - at least since ghc 6.8, I think.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants



More information about the Haskell-Cafe mailing list