Attempting to build wasm-web version of engine

I’m struggling right now to build the wasm-web version of the engine. I was able to build the PC version without issues (although I hadn’t tried swapping it out as I don’t have issues in my game with the PC version yet and hopefully won’t :blush:) I am now trying to build the wasm-web version as I am trying to fix a crash which sprung up in my game recently while the PC version is still functional. When I run the command to install_ems I am receiving however the following printout/error:

	$ ./scripts/build.py install_ems -–package-path=./packages/
[exec] git remote get-url origin
https://github.com/defold/defold.git
Usage: build.py [options] command(s)

Commands:
distclean        - Removes the DYNAMO_HOME folder
install_ext      - Install external packages
... (bunch of other commands listed)

Multiple commands can be specified

To pass on arbitrary options to waf: build.py OPTIONS COMMANDS -- WAF_OPTIONS


build.py: error: no such option: -û

I did have to workaround the package_emscripten.sh script because my platform was being discarded from the download link. However, I was able to create a emsdk-1.39.16-win32.tar.gz after manually doing the steps in the script in bash and then adding the win32 text to the filename (I know this is probably a bad idea, but the folder contains lots of exes so I assume it should be fine…) This file is 693,465 KB.

You’re using two different hyphens in -–package-path

2 Likes

Thanks I did NOT notice that :stuck_out_tongue:

I ran it with the same hyphens and now I am seeing:

$ ./scripts/build.py install_ems --package-path=./packages/
[exec] git remote get-url origin
https://github.com/defold/defold.git
Running 'install_ems'
Extracting S:\defold_github\packages\emsdk-1.39.16-win32.tar.gz to S:\defold_github\tmp\dynamo_home\ext\SDKs
[exec] S:\defold_github\tmp\dynamo_home\ext\SDKs\emsdk-1.39.16\emsdk activate 1.39.16 --embedded
Traceback (most recent call last):
  File "./scripts/build.py", line 2142, in <module>
	f()
  File "./scripts/build.py", line 655, in install_ems
	self.activate_ems()
  File "./scripts/build.py", line 661, in activate_ems
	run.env_command(self._form_env(), [join(self.get_ems_dir(), 'emsdk'), 'activate', version, '--embedded'])
  File "S:\defold_github\build_tools\run.py", line 63, in env_command
	return _exec_command(args, shell = False, stdout = None, env = env, **kwargs)
  File "S:\defold_github\build_tools\run.py", line 29, in _exec_command
	process = subprocess.Popen(arg_list, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, **kwargs)
  File "S:\Python27\lib\subprocess.py", line 394, in __init__
	errread, errwrite)
  File "S:\Python27\lib\subprocess.py", line 644, in _execute_child
	startupinfo)
WindowsError: [Error 193] %1 is not a valid Win32 application

I’m guessing it’s because my platform isn’t supported. I’ll try to downloading Cygwin and building it in there instead. I tried to download msys previously but the Sourceforge servers were down. Do you have a recommendation for a build environment?

I switched over to building with Cygwin. I am now able to get through all the WindowsKits/emscripten packaging steps. However, when I attempt to build the engine I get another issue:

Build failed
 -> task failed (err #-1):
		{task: cxx array.cpp -> array_1.o}
None
Traceback (most recent call last):
  File "./scripts/build.py", line 2142, in <module>
	f()
  File "./scripts/build.py", line 1037, in build_engine
	self._build_engine_lib(args, lib, target_platform)
  File "./scripts/build.py", line 988, in _build_engine_lib
	run.env_command(self._form_env(), args + plf_args + self.waf_options + skip_
build_tests, cwd = cwd)
  File "S:\defold_github\build_tools\run.py", line 63, in env_command
	return _exec_command(args, shell = False, stdout = None, env = env, **kwargs
)
  File "S:\defold_github\build_tools\run.py", line 41, in _exec_command
	raise ExecException(process.returncode, output)
run.ExecException

This is when I skip the tests.

When I run the tests I get a different error:

Embedding 'data/defold_64.jpg' ...
Embedding 'data/defold_64_progressive.jpg' ...
[  1/600] cxx: src\test\test_memory.cpp -> build\default\src\test\test_memory_2.
o
Waf: Leaving directory `S:\defold_github\engine\dlib\build'
Build failed
 -> task failed (err #-1):
		{task: cxx test_memory.cpp -> test_memory_2.o}
None
Traceback (most recent call last):
  File "./scripts/build.py", line 2142, in <module>
	f()
  File "./scripts/build.py", line 1037, in build_engine
	self._build_engine_lib(args, lib, target_platform)
  File "./scripts/build.py", line 988, in _build_engine_lib
	run.env_command(self._form_env(), args + plf_args + self.waf_options + skip_
build_tests, cwd = cwd)
  File "S:\defold_github\build_tools\run.py", line 63, in env_command
	return _exec_command(args, shell = False, stdout = None, env = env, **kwargs
)
  File "S:\defold_github\build_tools\run.py", line 41, in _exec_command
	raise ExecException(process.returncode, output)
run.ExecException

Could anyone please help me figure this out? I’d like to eventually contribute back to the project and I’m wanting to build a wasm-web version of the engine with -s ASSERTS=1 so I can debug my current project.

As with most compiling, the errors are listed as they appear. And that means that the following errors or logging might be due to previous errors. So the trick is to list the first errors that appear, and address those first.