Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing Emscripten and Em-Dosbox on Ubuntu 14.04 x64

Install Em-Dosbox on Ubuntu 14.04

Part 1: Install emscripten & clang

Install preprequisites

	#Update the package lists
	sudo apt-get update

	# Install **gcc** (and related dependencies)
	sudo apt-get install build-essential

	# Install cmake
	sudo apt-get install cmake

	# Install Python (by default is bundled with Ubuntu)
	sudo apt-get install python2.7

	# Install node.js
	sudo apt-get install nodejs

	# Install Java
	sudo apt-get install default-jre

	# Install git (optional)
	sudo apt-get install git-core

Install sdl 1.2 library

  • Only install ~1.2+, NOT SDL 2+. Otherwise it won't work :s

I think you can install it from a package, but maybe you will need to compile it.

If installing from package

I think this should do it:

  • sudo apt-get install libsdl-image1.2-dev OR
  • sudo apt-get install libsdl1.2-dev libsdl1.2debian

If compiling manually

  • Download source code from sdl website here.
  • Extract to folder of your liking
  • cd into it
  • sudo ./configure

If you use Ubuntu x32 you can probably proceed at running make and make install at this point. If you use Ubuntu x64 you would probably need to fix x11 video reference at this point. Somehow it does not work, so the steps are the following:

  • cd /src/video/x11
  • nano +166 SDL_x11sym.h (because it is around line 166)
  • add #if 0 and #endif wrapper around this part:
	#if 0 <- add this!
	#ifdef LONG64
	SDL_X11_MODULE(IO_32BIT)
	SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
	SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),)
	#endif
	#endif <- add this!

This should do the trick. Let's continue.

  • sudo make
  • sudo make install

Install emsdk

  • Grab source file from here
  • Extract to folder of your liking
  • cd into it
	# Fetch the latest registry of available tools.
	./emsdk update

	# Download and install the latest SDK tools.
	./emsdk install latest

	# Set up the compiler configuration to point to the "latest" SDK.
	./emsdk activate latest

	# Linux/Mac OS X only: Set the current Emscripten path
	source ./emsdk_env.sh

Now it is time to see if you have any prerequisites missing, lol. If prerequisites are missing (like Java, or node), then the path will be missing essential binaries.

Check if emconfigure works

Check if you have command emconfigure. If not, you need to manually add emscripten to the PATH

Add this to ~/.bashrc :

  • nano ~/.bashrc
export EMSCRIPTEN=/PATH/TO/emsdk/emscripten/master
export EMSCRIPTEN_ROOT=$EMSCRIPTEN:
export PATH=$PATH:$EMSCRIPTEN:
  • source ~/.bashrc

Check that emcc does not return any error. Ideally you should see the following:

INFO     root: (Emscripten: Running sanity checks)
WARNING  root: no input files
## Point node to nodejs
- Error ex. "Node is missing, blah blah blah".
- Make sure you have node installed. Test it with "nodejs"
- If it works, modify ~/.emscripten and Change NODE_... with "nodejs"

Part 2: Install em-dosbox

After you are sure that emcc shows no errors or warnings, let's clone em-dosbox. You will need automake & autoconf packages installed

  • sudo apt-get install autoconf
  • git clone https://github.com/dreamlayers/em-dosbox.git
  • cd into em-dosbox
  • following commands are better run in bash as root (do exactly as it is listed below)
  • sudo -s
  • ./autogen.sh
  • emconfigure ./configure
  • make

If you are lucky, the horror of installation is almost over. In /src/ you should see dosbox.html and dosbox.js files

Now you can try opening dosbox.html in your browser. Better start it as a server: "Remember that the same origin policy prevent access to data files in some browsers when using file:// URLs."

  • cd to /src folder
  • python -m SimpleHTTPServer
  • in browser go to localhost:8000/dropbox.html

Firefox is probably going to lag, but it's better than Chrome which doesn't even load for some reason :s. You can also follow the patches at em-dosbox project's readme.

Packaging games

Next is to change the PYTHON to 'python' inside of src/packager.py. This file tries to use emscripten's file_packager and uses the mysterious PYTHON variable. Since script is going to fail, it's time to open it up and change it

  • nano /src/packager.py
  • change PYTHON to 'python'

Now we are ready to try running some games!

  • As a test I recommend to download "Blocks from Hell" from here. (Do it from under Linux, otherwise it downloads some weird installer)
  • place blocks into the /src/ folder so it becomes /src/blocks.
  • cd to /src
  • Now switch to root in bash: sudo -s
  • Run ./packager.py blocks blocks.exe
  • It should create blocks.html file
  • Go to localhost:8000/blocks.html

If you are lucky, you will be able to play Blocks from Hell! w00t!

@Pozharnik

This comment has been minimized.

Copy link

commented Jan 10, 2015

Hello!
Stopped in step "Part 2: Install em-dosbox", specifically on "make" command. The "terminal" spits out the following log: http://pastebin.com/GwudhAy5 .
Before command "make" is performed "emconfigure ./configure", then the system alerted "emconfigure is missing, try to install emscripten by apt-get", then I did this. After this manipulation, "emconfigure ./configure" was executed, that it log http://pastebin.com/9sa8X0Pu .
Any idea how to fix a bug with "make"?
PS. Sorry for my eng :)

@gogromat

This comment has been minimized.

Copy link
Owner Author

commented Jan 12, 2015

Hey @Pozharnik, hope you fixed your problem. But if not, here is a suggestion. I also had that nasty "emconfigure is missing". First is to edit your ~/.bashrc (mentioned above in Part 1).

export EMSCRIPTEN=/PATH/TO/emsdk/emscripten/master
export EMSCRIPTEN_ROOT=$EMSCRIPTEN:
export PATH=$PATH:$EMSCRIPTEN:

And then source ~/.bashrc. Reboot, and do sudo -s so you switch to bash. Try emconfigure ./configure from there. Somehow plain sudo emconfigure ./configure just doesn't work (as I remember correctly)

@felixcatx

This comment has been minimized.

Copy link

commented Apr 24, 2015

Dear, I have a little experience in programming in Linux, but I have a great experience in MSDOS system platform and legacy systems. I'm amazed by the emdosbox and would love to build my old programs and games to run on it. It is more promising than the Chrome NACL.

I already tried several times to install emscripten + in-dosbox and I always get errors when compiling in-dosbox. I tested it on a virtual machine VMware Workstation 10, Ubuntu 14.04 -64bits, 4 Gb ram.
Also tested it on my Macbook Pro running Yosemite, but also had problems and I think I could not install all needed components.

I installed vmware tools and follow the tutorial, but it still fails... Some error appear..

I have some questions:
1 - Is there a version of Ubuntu that shows best for emdosbox? Which is better platform for emdosbox; Ubuntu 32 or 64 bit? what is the best for compiling it?

2 - Is there any virtual machine with Ubuntu running emdosbox compiling successfully where I can download? (Any format virtual VMware, Bochs, Qemu Virtualbox)

3 - other Linux distros, the Debian7 can run and compile the emdosbox or is it better to continue with Ubuntu?

If any "holy soul" provide a VM with emscripten 100% working and compiling emdosbox I will make the party!

But keep trying, if anyone can help in making a tutorial to create a VM and include everything needed to install the emscripten, maybe I can compile emdosbox.

Thanks in advanced and Live long and prosper //

@felixcatx

This comment has been minimized.

Copy link

commented Apr 24, 2015

Folks! I got it! Two problems I detected to solve the problem!
1- The version of emscripten was in 1.10, so I removed and installed "emcc -v" the latest version!
2- the node error to compile the "~ / .emscripten" I changed:

"NODE_JS = 'node'" to "NODE_JS = 'nodejs'"

And then I could compile dosbox.js !!!!! 😃 😄

There is an error on this page that guides the open page loaded in webserver as:

localhost: 8000 / dropbox.html (dropbox.html ?????? is a joke?)

The correct is: localhost: 8000 / dosbox.html (dosbox.html) <--- this run like a dream... 😄

That did it! I'll save this VM (backup) and begin my testing! Thanks for all the tips and the tutorial!

I install all using a root user!

Thanks in advanced and Live long and prosper //

Felix

@IonicaBizau

This comment has been minimized.

Copy link

commented Feb 15, 2016

On Ubuntu 15.10 I had to do # apt-get install automake to get alocal working (for the autogen.sh script). 💡

@lollypop777

This comment has been minimized.

Copy link

commented Jan 28, 2018

3 scripts resulting from this
one to install dependecies
one to install emsdk
one to install em-dosbox
but on the last im still having trouble sleep with yield kinda errors in em-dosbox on 14.04 17.10 is fine tho
first scripts is em-dependecies.sh
#Update the package lists
sudo apt-get update
# Install gcc (and related dependencies)
sudo apt-get install build-essential
# Install cmake
sudo apt-get install cmake
# Install Python (by default is bundled with Ubuntu)
sudo apt-get install python2.7 python-minimal
# Install node.js
sudo apt-get install nodejs
# Install Java
sudo apt-get install default-jre
# Install git (optional)
sudo apt-get install git-core
sudo apt-get install libsdl1.2-dev libsdl1.2debian libsdl-image1.2-dev
second scripts is emsdk.sh
wget https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz
tar -xvf emsdk-portable.tar.gz
cd emsdk-portable
# Fetch the latest registry of available tools.
./emsdk update
# Download and install the latest SDK tools.
./emsdk install latest
# Set up the compiler configuration to point to the "latest" SDK.
./emsdk activate latest
# Linux/Mac OS X only: Set the current Emscripten path
source ./emsdk_env.sh
then set these paths in .bashrc
export PATH=$PATH:/home/verhoeve/skd-pro/emsdk-portable
export PATH=$PATH:/home/verhoeve/skd-pro/emsdk-portable/clang/tag-e1.37.29/build_tag-e1.37.29_32/bin
export PATH=$PATH:/home/verhoeve/skd-pro/emsdk-portable/node/4.1.1_32bit/bin
export PATH=$PATH:/home/verhoeve/skd-pro/emsdk-portable/emscripten/tag-1.37.29
#Setting environment variables:
export EMSDK=/home/verhoeve/skd-pro/emsdk-portable
export EM_CONFIG=/home/verhoeve/.emscripten
export EMSCRIPTEN=/home/verhoeve/skd-pro/emsdk-portable/emscripten/tag-1.37.29
export PS4SDK=/home/verhoeve/ps4code/ps4sdk
export PATH=$PATH:$PS4SDK
third script is em-dosbox.sh
GNU nano 2.2.6 Bestand: em-dosbox.sh Gewijzigd
sudo apt-get install autoconf
git clone https://github.com/dreamlayers/em-dosbox.git
cd em-dosbox

following commands are better run in bash as root (do exactly as it is listed below)

sudo -s

./autogen.sh
emconfigure ./configure
make
make install

#If you are lucky, the horror of installation is almost over. In /src/ you should see dosbox.html and dosbox.js files
#Now you can try opening dosbox.html in your browser. Better start it as a server:
#Remember that the same origin policy prevent access to data files in some browsers when using file:// URLs.
echo "in browser go to localhost:8000/dropbox.html"
cd src
python -m SimpleHTTPServer

there is still the error im still having on 14.04 ubuntu with em-dosbox
mv -f .deps/dos_misc.Tpo .deps/dos_misc.Po
/usr/share/emscripten/em++ -DHAVE_CONFIG_H -I. -I../.. -I../../include -O3 -s USE_SDL=2 -MT dos_classes.o -MD -MP -MF .deps/dos_classes.Tpo -c -o dos_classes.o dos_classes.cpp
mv -f .deps/dos_classes.Tpo .deps/dos_classes.Po
/usr/share/emscripten/em++ -DHAVE_CONFIG_H -I. -I../.. -I../../include -O3 -s USE_SDL=2 -MT dos_programs.o -MD -MP -MF .deps/dos_programs.Tpo -c -o dos_programs.o dos_programs.cpp
dos_programs.cpp:1601:22: error: use of undeclared identifier 'emscripten_sleep_with_yield'
while (!fetchdone) emscripten_sleep_with_yield(10);
^
1 error generated.
ERROR root: compiler frontend failed to generate LLVM bitcode, halting
make[4]: *** [dos_programs.o] Fout 1
make[4]: Map '/home/verhoeve/skd-pro/em-dosbox/src/dos' wordt verlaten
make[3]: *** [all-recursive] Fout 1
make[3]: Map '/home/verhoeve/skd-pro/em-dosbox/src' wordt verlaten
make[2]: *** [all] Fout 2
make[2]: Map '/home/verhoeve/skd-pro/em-dosbox/src' wordt verlaten
make[1]: *** [all-recursive] Fout 1
make[1]: Map '/home/verhoeve/skd-pro/em-dosbox' wordt verlaten
make: *** [all] Fout 2
Making install in src
make[1]: Map '/home/verhoeve/skd-pro/em-dosbox/src' wordt binnengegaan
python version.py ../include/version.h .. /usr/share/emscripten/em++
make install-recursive
make[2]: Map '/home/verhoeve/skd-pro/em-dosbox/src' wordt binnengegaan
Making install in cpu
make[3]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu' wordt binnengegaan
make install-recursive
make[4]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu' wordt binnengegaan
Making install in core_full
make[5]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_full' wordt binnengegaan
make[6]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_full' wordt binnengegaan
make[6]: Er hoeft niets gedaan te worden voor 'install-exec-am'.
make[6]: Er hoeft niets gedaan te worden voor 'install-data-am'.
make[6]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_full' wordt verlaten
make[5]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_full' wordt verlaten
Making install in core_normal
make[5]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_normal' wordt binnengegaan
make[6]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_normal' wordt binnengegaan
make[6]: Er hoeft niets gedaan te worden voor 'install-exec-am'.
make[6]: Er hoeft niets gedaan te worden voor 'install-data-am'.
make[6]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_normal' wordt verlaten
make[5]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_normal' wordt verlaten
Making install in core_dyn_x86
make[5]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_dyn_x86' wordt binnengegaan
make[6]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_dyn_x86' wordt binnengegaan
make[6]: Er hoeft niets gedaan te worden voor 'install-exec-am'.
make[6]: Er hoeft niets gedaan te worden voor 'install-data-am'.
make[6]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_dyn_x86' wordt verlaten
make[5]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_dyn_x86' wordt verlaten
Making install in core_dynrec
make[5]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_dynrec' wordt binnengegaan
make[6]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_dynrec' wordt binnengegaan
make[6]: Er hoeft niets gedaan te worden voor 'install-exec-am'.
make[6]: Er hoeft niets gedaan te worden voor 'install-data-am'.
make[6]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_dynrec' wordt verlaten
make[5]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu/core_dynrec' wordt verlaten
make[5]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu' wordt binnengegaan
make[6]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu' wordt binnengegaan
make[6]: Er hoeft niets gedaan te worden voor 'install-exec-am'.
make[6]: Er hoeft niets gedaan te worden voor 'install-data-am'.
make[6]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu' wordt verlaten
make[5]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu' wordt verlaten
make[4]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu' wordt verlaten
make[3]: Map '/home/verhoeve/skd-pro/em-dosbox/src/cpu' wordt verlaten
Making install in debug
make[3]: Map '/home/verhoeve/skd-pro/em-dosbox/src/debug' wordt binnengegaan
make[4]: Map '/home/verhoeve/skd-pro/em-dosbox/src/debug' wordt binnengegaan
make[4]: Er hoeft niets gedaan te worden voor 'install-exec-am'.
make[4]: Er hoeft niets gedaan te worden voor 'install-data-am'.
make[4]: Map '/home/verhoeve/skd-pro/em-dosbox/src/debug' wordt verlaten
make[3]: Map '/home/verhoeve/skd-pro/em-dosbox/src/debug' wordt verlaten
Making install in dos
make[3]: Map '/home/verhoeve/skd-pro/em-dosbox/src/dos' wordt binnengegaan
/usr/share/emscripten/em++ -DHAVE_CONFIG_H -I. -I../.. -I../../include -O3 -s USE_SDL=2 -MT dos_programs.o -MD -MP -MF .deps/dos_programs.Tpo -c -o dos_programs.o dos_programs.cpp
dos_programs.cpp:1601:22: error: use of undeclared identifier 'emscripten_sleep_with_yield'
while (!fetchdone) emscripten_sleep_with_yield(10);
^
1 error generated.
ERROR root: compiler frontend failed to generate LLVM bitcode, halting
make[3]: *** [dos_programs.o] Fout 1
make[3]: Map '/home/verhoeve/skd-pro/em-dosbox/src/dos' wordt verlaten
make[2]: *** [install-recursive] Fout 1
make[2]: Map '/home/verhoeve/skd-pro/em-dosbox/src' wordt verlaten
make[1]: *** [install] Fout 2
make[1]: Map '/home/verhoeve/skd-pro/em-dosbox/src' wordt verlaten
make: *** [install-recursive] Fout 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.