Skip to content

Commit 09e4b6c

Browse files
committed
Update the readme with emcc instructions
1 parent 404e59a commit 09e4b6c

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Diff for: README.md

+44
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,50 @@ You can always test the tools using the "App Store" at:
130130
This allows you to do test launches as the instructor and student in a test environment using the
131131
key '12345'.
132132

133+
Setting up EmScripten
134+
---------------------
135+
136+
To compile, run, and autograde code, this site uses Emscripten which compiles C to Web Assembly:
137+
138+
https://emscripten.org/
139+
140+
You need to install the Emscriptem compiler. On Ubuntu:
141+
142+
apt install emscripten
143+
144+
On Macintosh:
145+
146+
brew install emscripten
147+
148+
You also need to make a folder `/var/www/compile` where the student code will be stored
149+
and compiled and chown it to www-root:
150+
151+
mkdir /var/www/compile
152+
chown -R www-data.www-data /var/www/compile
153+
154+
This folder will accumulate student programs and results. You probably want to make a
155+
`cron` job to clear out this folder for data more than a week old so it does not grow.
156+
157+
Here are the configuration options to setup the compiler for Ubuntu:
158+
159+
$CFG->setExtension('emcc_path', '/var/www/emsdk/upstream/emscripten/emcc');
160+
$CFG->setExtension('emcc_folder', '/var/www/compile');
161+
$CFG->setExtension('emcc_secret', 'changeme');
162+
163+
On Macintosh:
164+
165+
$CFG->setExtension('emcc_path', '/opt/homebrew/bin/emcc');
166+
$CFG->setExtension('emcc_folder', '/tmp/zap');
167+
$CFG->setExtension('emcc_secret', 'zap');
168+
169+
If you want to debug the Emscripten process, you can add this configuration option:
170+
171+
$CFG->setExtension('emcc_pause', 'true');
172+
173+
Instead of the spinner and flash, the process wqill pause sou you can look at
174+
the in-browser code to load and run the WASM and then send the output back to
175+
be graded or shown.
176+
133177
Using the Application
134178
---------------------
135179

0 commit comments

Comments
 (0)