Milek7 / openttd-emscripten-dockerfile

2 stars 2 forks source link

Dockerfile is not compiled #1

Closed atalbayrak closed 4 years ago

atalbayrak commented 4 years ago

I tried your dockerfile but I couldn't create docker image

Sending build context to Docker daemon 109.6kB Step 1/25 : FROM trzeci/emscripten-slim ---> 54ab68c238ce Step 2/25 : ENV DEBIAN_FRONTEND=noninteractive ---> Using cache ---> da7a1ee070da Step 3/25 : RUN apt-get update -y && apt-get install -y build-essential git autopoint automake libtool pkg-config wget unzip xz-utils ---> Using cache ---> f9d8c461e275 Step 4/25 : WORKDIR / ---> Using cache ---> 0bac879c4d8d Step 5/25 : RUN mkdir extralibs ---> Using cache ---> 0e7ae65b89f0 Step 6/25 : WORKDIR / ---> Using cache ---> 24a2dda1a5fe Step 7/25 : RUN git clone https://git.tukaani.org/xz.git && cd xz && ./autogen.sh && emconfigure ./configure --prefix=/extralibs --disable-threads --enable-assume-ram=32 && emmake make -j2 && emmake make install ---> Using cache ---> 9b79794e9110 Step 8/25 : WORKDIR / ---> Using cache ---> 619dcdc2071c Step 9/25 : RUN git clone https://git.code.sf.net/p/libtimidity/libtimidity && cd libtimidity && autoreconf -fi && emconfigure ./configure --prefix=/extralibs --with-timidity-cfg="freepats/freepats.cfg" && emmake make -j2 && emmake make install ---> Using cache ---> e9044a6024f1 Step 10/25 : WORKDIR / ---> Using cache ---> ba78f691ce60 Step 11/25 : COPY sdl2.pc /extralibs/lib/pkgconfig/ ---> Using cache ---> deec1af12997 Step 12/25 : RUN touch empty.c && emcc -s USE_SDL=2 empty.c -o /dev/null && cp -r /emsdk_portable/data/.cache/asmjs/ports-builds/sdl2/include/ /extralibs/include/ ---> Running in b81111d0328a shared:WARNING: Assuming object file output in the absence of -c, based on output filename. Please add with -c or -r to avoid this warning system_libs:INFO: retrieving port: sdl2 from https://github.com/emscripten-ports/SDL2/archive/version_18.zip system_libs:INFO: unpacking port: sdl2 cache:INFO: generating port: libSDL2.bc... (this will be cached in "/emsdk_portable/.data/cache/asmjs/libSDL2.bc" for subsequent builds) cache:INFO: - ok cp: cannot stat '/emsdk_portable/data/.cache/asmjs/ports-builds/sdl2/include/': No such file or directory The command '/bin/sh -c touch empty.c && emcc -s USE_SDL=2 empty.c -o /dev/null && cp -r /emsdk_portable/data/.cache/asmjs/ports-builds/sdl2/include/* /extralibs/include/' returned a non-zero code: 1

Milek7 commented 4 years ago

try with

-       cp -r /emsdk_portable/data/.cache/asmjs/ports-builds/sdl2/include/* /extralibs/include/
+       cp -r /emsdk_portable/.data/cache/asmjs/ports-builds/sdl2/include/* /extralibs/include/
-       cp -r /emsdk_portable/data/.cache/asmjs/ports-builds/zlib/z*.h /extralibs/include/
+       cp -r /emsdk_portable/.data/cache/asmjs/ports-builds/zlib/z*.h /extralibs/include/
atalbayrak commented 4 years ago

Thank you! It worked but I still get some error The OpenTTD repository is the your forked repository I used this command below to compile

sudo docker run -v /home/js/OpenTTD/:/workdir/source -v /home/js/openttd-emscripten-dockerfile/:/workdir/output openttd

but I got this error

make[1]: Leaving directory '/workdir/source/objs/release'
Unknown option --with-libtimidity
Milek7 commented 4 years ago

Repository should be on ems_both branch. It might also require increasing starting memory size in final emcc command.

atalbayrak commented 4 years ago

Now I got this error

[SRC] Linking openttd
shared:ERROR: emcc: cannot find library "SDL2"
Makefile:267: recipe for target 'openttd' failed
make[1]: *** [openttd] Error 1
make[1]: Leaving directory '/workdir/source/objs/release'
Makefile:54: recipe for target 'all' failed
make: *** [all] Error 1
atalbayrak commented 4 years ago

It might also require increasing starting memory size in final emcc command.

I couldn't get it. I have 2 gb ram and 2 gb swap area. Do I need to create more swap area?

Milek7 commented 4 years ago
diff --git a/sdl2.pc b/sdl2.pc
index 0438e34..e2e27c8 100644
--- a/sdl2.pc
+++ b/sdl2.pc
@@ -8,5 +8,5 @@ Description: SDL2
 URL: http://libsdl.org/
 Version: 2.0.0
 Cflags: -I${includedir}
-Libs: -L${libdir} -lSDL2
+Libs: -s USE_SDL=2
 Libs.private:  

I meant default memory size in final emcc command: e.g. -s TOTAL_MEMORY=33554432 Also I don't know why but on current emscripten it cannot find IDBFS. You can temporarily remove persistent save storage from pre.js (that Module.preRun.push.. function).

atalbayrak commented 4 years ago

You are awesome. Thank you for your help.