I\'m very new to Yesod and I\'m having trouble building Yesod statically so I can deploy to Heroku.
I have changed the default .cabal file to reflect static compilat
I have no idea what Yesod is, but I know exactly what each of your other errors means.
First, you should not try to link statically. The warning you get is exactly right: if you link statically, and use one of the routines for which you are getting the warning, then you must arrange to run on a system with exactly the same version of libc.so.6 as the one you used at build time.
Contrary to popular belief, static linking produces less, not more, portable executables on Linux.
Your other (static) link errors are caused by missing libopenssl.a
at link time.
But let's assume that you are going to go the "sane" route, and use dynamic linking.
For dynamic linking, Linux (and most other UNIXes) support backward compatibility: an old binary continues to work on newer systems. But they don't support forward compatibility (a binary built on a newer system will generally not run on an older one).
But that's what you are trying to do: you built on a system with glibc-2.14 (or newer), and you are running on a system with glibc-2.13 (or older).
The other thing you need to know is that glibc is composed of some 200+ binaries that must all match exactly. Two key binaries are /lib/ld-linux.so
and /lib/libc.so.6
(but there are many more: libpthread.so.0
, libnsl.so.1
, etc. etc). If some of these binaries came from different versions of glibc, you usually get a crash. And that is exactly what you got, when you tried to place your glibc-2.14 libc.so.6
on the LD_LIBRARY_PATH
-- it no longer matches the system /lib/ld-linux
.
So what are the solutions? There are several possibilities (in increasing difficulty):
You could copy ld-2.14.so
(the target of /lib/ld-linux
symlink) to the target system, and invoke it explicitly:
/path/to/ld-2.14.so --library-path /path/to/your/executable
This generally works, but can confuse an application that looks at argv[0]
, and breaks for applications that re-exec themselves.
You could build on an older system.
You could use appgcc
(this option has disappeared, see this for description of what it used to be).
You could set up a chroot environment matching the target system, and build inside that chroot.
You could build yourself a Linux-to-olderLinux crosscompiler