I want to run a simple Haskell program from a jailed environment that I construct myself. The following Haskell program I want to run:
import System.IO
main = do
hPutStrLn stderr "test standard error!"
hPutStrLn stdout "test standard out!"
It just outputs a string to stderr and stdout, works perfectly fine outside of the jail. The code is compiled as follows:
ghc -O2 --make -static -optc-static -optl-static $MAINHS -optl-pthread -o bin/run_ai
I get a run_ai executable that runs the program, as I said, this works fine outside of the jail. Below is the stuff that's put inside of the jailed environment and I think there's something missing here, because when I run the program in the jail it does absolutely nothing, it doesn't even exit and no error/output dumps are given at all.
mkdir -p lib64 lib bin
cp /bin/sh bin/
# Binaries
cp /lib64/ld-linux-x86-64.so.2 lib64/
cp /lib/x86_64-linux-gnu/libpthread.so.0 lib/
cp /lib/x86_64-linux-gnu/libc.so.6 lib/
cp /lib/x86_64-linux-gnu/libdl.so.2 lib/
cp /lib/x86_64-linux-gnu/librt.so.1 lib/
cp /lib/x86_64-linux-gnu/libm.so.6 lib/
cp /lib/x86_64-linux-gnu/libtinfo.so.5 lib/
cp /lib/x86_64-linux-gnu/libutil.so.1 lib/
cp /usr/lib/x86_64-linux-gnu/libffi.so.6 lib/
cp /usr/lib/x86_64-linux-gnu/libgmp.so.10 lib/
cp /usr/lib/libgmp.so.3 lib/
I know the jail itself works great, because I've successfully used it for a dozen other programming languages, but Haskell is giving me a headache because I get absolutely nothing on what might be going wrong. Sadly, I'm not an expert on Haskell, but I just need it to compile, and run inside of the jail. Am I missing something that is actually needed to run the executable Haskell file?
So my question is: What am I missing/doing wrong?