
Hello, I wrote a small installer program which configures and installs some software packages. In order to be able to let it run on a different machine, where I possibly don't have the needed shared libraries, I tried to link it statically, following this advice: http://www.haskell.org/haskellwiki/Practical_web_programming_in_Haskell#Depl... g_statically_linked_applications However I get some linking errors: ghc --make Installer.hs -static -optl-static /usr/lib/ghc-6.10.3/unix-2.3.2.0/libHSunix-2.3.2.0.a(User__143.o)(.text+0xf1): In function `s7Tu_info': : warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../../libedit.a(readline.o)(.text+0x7b 2): In function `username_completion_function': /home/oswald/build/libedit-20090610-3.0/src/readline.c:1467:0: warning: Using 'getpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking src/dlmalloc.c:2486:0: undefined reference to `pthread_mutex_lock' /usr/lib/ghc-6.10.3/libffi.a(closures.o)(.text+0x132):src/dlmalloc.c:2493: undefined reference to `pthread_mutex_unlock' /usr/lib/ghc-6.10.3/libffi.a(closures.o)(.text+0x184):src/dlmalloc.c:2490: undefined reference to `pthread_mutex_init' /usr/lib/ghc-6.10.3/libffi.a(closures.o)(.text+0x227): In function `ffi_closure_free': Because of the undefined references to pthread_mutex_lock I then tried various versions of ghc --make Installer.hs -static -optl-static -lpthread -lrt and reordered the -l switches, but neither combination helped. I always get the same error. Does somebody know how to correctly specify the pthread library for this? lg, Michael

On Friday 24 July 2009, Michael Oswald wrote:
Hello,
I wrote a small installer program which configures and installs some software packages. In order to be able to let it run on a different machine, where I possibly don't have the needed shared libraries, I tried to link it statically, following this advice:
http://www.haskell.org/haskellwiki/Practical_web_programming_in_Haskell#Dep loyin g_statically_linked_applications
However I get some linking errors:
ghc --make Installer.hs -static -optl-static
/usr/lib/ghc-6.10.3/unix-2.3.2.0/libHSunix-2.3.2.0.a(User__143.o)(.text+0xf 1):
In function `s7Tu_info': : warning: Using 'getgrnam_r' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking /usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../../libedit.a(readline.o)(.text +0x7b 2):
In function `username_completion_function': /home/oswald/build/libedit-20090610-3.0/src/readline.c:1467:0: warning: Using 'getpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
src/dlmalloc.c:2486:0: undefined reference to `pthread_mutex_lock' /usr/lib/ghc-6.10.3/libffi.a(closures.o)(.text+0x132):src/dlmalloc.c:2493: undefined reference to `pthread_mutex_unlock' /usr/lib/ghc-6.10.3/libffi.a(closures.o)(.text+0x184):src/dlmalloc.c:2490: undefined reference to `pthread_mutex_init' /usr/lib/ghc-6.10.3/libffi.a(closures.o)(.text+0x227): In function `ffi_closure_free':
Because of the undefined references to pthread_mutex_lock I then tried various versions of
ghc --make Installer.hs -static -optl-static -lpthread -lrt
and reordered the -l switches, but neither combination helped. I always get the same error.
Does somebody know how to correctly specify the pthread library for this?
Hi, Try: ghc --make Installer.hs -static -optl-static -optl-pthread If that doesn't work, you can always do a ghc -v, find the command it uses for linking, modify it and run it manually. Thanks! Marcin Kosiba

Marcin Kosiba
Try: ghc --make Installer.hs -static -optl-static -optl-pthread
Ah, that fixed it. Thanks a lot!
If that doesn't work, you can always do a ghc -v, find the command it uses for linking, modify it and run it manually.
Peter suggested this, but I ran into other problems. But since it works now, I'm happy with it! Thanks again! lg, Michael
participants (2)
-
Marcin Kosiba
-
Michael Oswald