# Help building the engine

**URL:** <https://forum.defold.com/t/help-building-the-engine/74687>\
**Category:** Source Code\
**Created:** [October 25, 2023, 11:34pm UTC](https://forum.defold.com/t/help-building-the-engine/74687 "2023-10-25T23:34:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![luca.falco](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/l/3bc359/32.png) [@luca.falco](https://forum.defold.com/u/luca.falco)\
**Post date:** [October 25, 2023, 11:34pm UTC](https://forum.defold.com/t/help-building-the-engine/74687/1 "2023-10-25T23:34:55Z")

</div>

I’m trying to build the engine. These are the steps I’ve made

```lua

./scripts/build.py shell

```

To paget the packages into a `local_sdks` folder

```lua

./scripts/package/package_win32_sdk.sh

```

```lua

     ./scripts/build.py --package-path=./local_sdks install_sdk --platform=x86_64-win32

```

install external packages

```lua

./scripts/build.py install_ext --platform=x86_64-win32 --package-path=./local_sdks

```

then executing the build command with

```lua

./scripts/build.py build_engine --platform=x86_64-win32 --skip-tests -- --skip-build-tests

```

I get this error:

```lua

  src\test\jni/Testapi.empty.cpp => Testapi

In file included from src\test\jni/Testapi.empty.cpp:1:

In file included from C:\Users\myuser\_root\src\defold\engine\jni\src\test\testapi.h:19:

C:\Users\myuser\_root\src\defold\tmp\dynamo_home\sdk\include\dmsdk/dlib/array.h:18:10: fatal error: 'assert.h' file not found

   18 | #include <assert.h>

      | ^ ~~~~~~~~~

1 error generated.

Traceback (most recent call last):

  File "C:\Users\myuser\_root\src\defold\tmp\dynamo_home\ext\bin\waf3-2.0.23-7dbdd0b348178777c338c9a31f6218a5\waflib\Scripting.py", line 119, in waf_entry_point

    run_commands()

  File "C:\Users\myuser\_root\src\defold\tmp\dynamo_home\ext\bin\waf3-2.0.23-7dbdd0b348178777c338c9a31f6218a5\waflib\Scripting.py", line 182, in run_commands

    ctx=run_command(cmd_name)

        ^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\myuser\_root\src\defold\tmp\dynamo_home\ext\bin\waf3-2.0.23-7dbdd0b348178777c338c9a31f6218a5\waflib\Scripting.py", line 173, in run_command

    ctx.execute()

  File "C:\Users\myuser\_root\src\defold\tmp\dynamo_home\ext\bin\waf3-2.0.23-7dbdd0b348178777c338c9a31f6218a5\waflib\Configure.py", line 85, in execute

    super(ConfigurationContext,self).execute()

  File "C:\Users\myuser\_root\src\defold\tmp\dynamo_home\ext\bin\waf3-2.0.23-7dbdd0b348178777c338c9a31f6218a5\waflib\Context.py", line 92, in execute

    self.recurse([os.path.dirname(g_module.root_path)])

  File "C:\Users\myuser\_root\src\defold\tmp\dynamo_home\ext\bin\waf3-2.0.23-7dbdd0b348178777c338c9a31f6218a5\waflib\Context.py", line 133, in recurse

    user_function(self)

  File "C:\Users\myuser\_root\src\defold\engine\jni\wscript", line 24, in configure

    conf.recurse('src')

  File "C:\Users\myuser\_root\src\defold\tmp\dynamo_home\ext\bin\waf3-2.0.23-7dbdd0b348178777c338c9a31f6218a5\waflib\Context.py", line 133, in recurse

    user_function(self)

  File "C:\Users\myuser\_root\src\defold\engine\jni\src\wscript", line 11, in configure

    conf.recurse('test')

  File "C:\Users\myuser\_root\src\defold\tmp\dynamo_home\ext\bin\waf3-2.0.23-7dbdd0b348178777c338c9a31f6218a5\waflib\Context.py", line 133, in recurse

    user_function(self)

  File "C:\Users\myuser\_root\src\defold\engine\jni\src\test\wscript", line 31, in configure

    gen_java.generate(header_path = make_path('./testapi.h'),

  File "C:\Users\myuser\_root\src\defold\engine\jni\scripts\gen_java.py", line 1207, in generate

    ir = gen_ir.gen(source_path, includes, module_name, namespace, [])

         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\myuser\_root\src\defold\engine\jni\scripts\external\gen_ir.py", line 223, in gen

    ast = clang_cpp(source_path, includes)

          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\myuser\_root\src\defold\engine\jni\scripts\external\gen_ir.py", line 220, in clang_cpp

    return subprocess.check_output(cmd)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Python312\Lib\subprocess.py", line 466, in check_output

    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Python312\Lib\subprocess.py", line 571, in run

    raise CalledProcessError(retcode, process.args,

subprocess.CalledProcessError: Command '['clang++', '-Xclang', '-ast-dump=json', '-c', '-IC:\\Users\\myuser\\_root\\src\\defold\\engine\\jni', '-IC:\\Users\\myuser\\_root\\src\\defold\\tmp\\dynamo_home\\sdk\\include', 'src\\test\\jni/Testapi.empty.cpp']' returned non-zero exit status 1.

[exec] python C:\Users\myuser\_root\src\defold\tmp\dynamo_home/ext/bin/waf --prefix=C:\Users\myuser\_root\src\defold\tmp\dynamo_home --skip-tests distclean configure build install --platform=x86_64-win32 --skip-build-tests

Error:

Traceback (most recent call last):

  File "C:\Users\myuser\_root\src\defold\scripts\build.py", line 2390, in <module>

    f()

  File "C:\Users\myuser\_root\src\defold\scripts\build.py", line 1118, in build_engine

    self._build_engine_lib(args, lib, host)

  File "C:\Users\myuser\_root\src\defold\scripts\build.py", line 1074, in _build_engine_lib

    run.env_command(self._form_env(), args + plf_args + self.waf_options + skip_build_tests, cwd = cwd)

  File "C:\Users\myuser\_root\src\defold\build_tools\run.py", line 98, in env_command

    return _exec_command(args, shell = False, stdout = None, env = env, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\myuser\_root\src\defold\build_tools\run.py", line 75, in _exec_command

    raise e

run.ExecException: 2

```

seems like the assert.h header is missing, should I download a different version of the win sdk? i’m using the one specified in `scripts\package\package_win32_sdk.sh`

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [October 26, 2023, 7:04am UTC](https://forum.defold.com/t/help-building-the-engine/74687/2 "2023-10-26T07:04:51Z")

</div>

Hi!

I reckon I have to update the notes, since it is no longer needed for Windows and macOS to install the sdk, if they already have Visual Studio or XCode installed.

I’d say, remove the sdk folder /tmp/dynamo\_home/ext/SDKs/Win32 again (no need to run the “install\_sdk” command).

Then you should be able to build.

(side note, I think it _should_ have worked for you, but the recommended approach is faster)

EDIT: It seems we already had documented that the step was optional for Windows/macOS: [documentation](https://github.com/defold/defold/blob/dev/README_BUILD.md#local-sdks)

Edit2: I also added a separate section about ’install\_sdk’, restating the part that it may not be necessary depending on platform.

---

<div class="post-metadata">

**Author:** ![luca.falco](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/l/3bc359/32.png) [@luca.falco](https://forum.defold.com/u/luca.falco)\
**Post date:** [October 26, 2023, 12:32pm UTC](https://forum.defold.com/t/help-building-the-engine/74687/3 "2023-10-26T12:32:16Z")

</div>

Thank you for the heads up and the quick update 🙂 I’m still having the missing assert.h error, am I missing something from the installation of VS? I downloaded everything that is in the Development with c++ workload.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [October 26, 2023, 12:44pm UTC](https://forum.defold.com/t/help-building-the-engine/74687/4 "2023-10-26T12:44:22Z")

</div>

What VS version, Windows version are you on?  
What does the vswhere2 toold report in you build step?

Perhaps best if you upload your build log.

---

<div class="post-metadata">

**Author:** ![luca.falco](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/l/3bc359/32.png) [@luca.falco](https://forum.defold.com/u/luca.falco)\
**Post date:** [October 26, 2023, 12:52pm UTC](https://forum.defold.com/t/help-building-the-engine/74687/5 "2023-10-26T12:52:42Z")

</div>

Sure! This is my build log  
[log.txt](https://forum.defold.com/uploads/short-url/xcuHpmgvnzyoXmiT6cS2nzYzaGD.txt) (71.6 KB)

VS version is 2019 on windows 11. I also have VS2022 installed but the paths seem correct (?)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [October 26, 2023, 1:54pm UTC](https://forum.defold.com/t/help-building-the-engine/74687/6 "2023-10-26T13:54:46Z")

</div>

Thanks!

First check, yes, your SDK is found locally:

```lua
Checking for program 'CL' : C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\CL.exe
Checking for program 'LINK' : C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\LINK.exe
Checking for program 'LIB' : C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\LIB.exe
Checking for program 'RC' : C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\RC.exe
Checking for program 'signtool' : C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\signtool.exe

```

And it build the first library (`dlib`) fine.

Then it fails when building the the (relatively new) library `jni`.  
This library has a dependency of `clang++`, and I’m guessing it finds one, but it’s not the one under the Visual Studio installation.

In your command prompt, what do you get if you run `which clang++´ ?  
I’m guessing you get some other installation, and that the solution may be to make sure that the MSVC clang++ is found first.

---

<div class="post-metadata">

**Author:** ![luca.falco](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/l/3bc359/32.png) [@luca.falco](https://forum.defold.com/u/luca.falco)\
**Post date:** [October 26, 2023, 3:20pm UTC](https://forum.defold.com/t/help-building-the-engine/74687/7 "2023-10-26T15:20:08Z")

</div>

Yep, I had another installation of clang++ on my system, I changed the PATH and installed the MSVC clang tools

```lua
➜ defold git:(dev) which clang++
/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/Llvm/x64/bin/clang++

```

this is the which result now. The build process gives the same error so I’m guessing something is still missing ?

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [October 26, 2023, 3:39pm UTC](https://forum.defold.com/t/help-building-the-engine/74687/8 "2023-10-26T15:39:42Z")

</div>

What if you try the clang command in isolation?  
(The one listed as failing at the ens of the log)

---

<div class="post-metadata">

**Author:** ![luca.falco](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/l/3bc359/32.png) [@luca.falco](https://forum.defold.com/u/luca.falco)\
**Post date:** [October 26, 2023, 3:44pm UTC](https://forum.defold.com/t/help-building-the-engine/74687/9 "2023-10-26T15:44:18Z")

</div>

Tried that too by running this:

```lua
clang++ -Xclang -ast-dump=json -c \
-I/C/Users/34BTUser/_root/src/defold/engine/jni \
-I/C/Users/34BTUser/_root/src/defold/tmp/dynamo_home/sdk/include \
C:/Users/34BTUser/_root/src/defold/engine/jni/src/test/jni/Testapi.empty.cpp

```

Dumped the log to a file →   
[outputLog.txt](https://forum.defold.com/uploads/short-url/5RGoFtm7iMeWIalrvvEh3dtpJoX.txt) (342.3 KB)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [October 26, 2023, 4:15pm UTC](https://forum.defold.com/t/help-building-the-engine/74687/10 "2023-10-26T16:15:13Z")

</div>

Ok, that outpu suggests that the command succeeded, i.e no error on assert.h.

Not sure what to test next to be honest.

---

<div class="post-metadata">

**Author:** ![luca.falco](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/l/3bc359/32.png) [@luca.falco](https://forum.defold.com/u/luca.falco)\
**Post date:** [October 27, 2023, 11:43pm UTC](https://forum.defold.com/t/help-building-the-engine/74687/11 "2023-10-27T23:43:22Z")

</div>

So, problably was some kind of error with PATHS in windows since I had multiple versions of LLVM isntalled. Now I am able to build the engine 🥳, but a new error came up when trying to run the editor 😄

I installed leiningen and ran `lein.bat init`, this is the output:

```lua
Compiling 38 source files to C:\Users\34BTUser\_root\src\defold\editor\target\classes
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
using cached file 'https://github.com/sass/dart-sass/releases/download/1.62.1/dart-sass-1.62.1-windows-x64.zip' -> 'C:\Users\34BTUser\.dcache\github_com-sass-dart-sass-releases-download-1.62.1-dart-sass-1.62.1-windows-x64.zip-22307838444234354535353839304435463822'
sass: styling/stylesheets/ -> resources/
java.io.IOException: Cannot run program "C:\Users\34BTUser\_root\src\defold\editor\target\packages\dart-sass\1.62.1\dart-sass\sass": CreateProcess error=2, The system cannot find the file specified
 at java.lang.ProcessBuilder.start (ProcessBuilder.java:1143)
    java.lang.ProcessBuilder.start (ProcessBuilder.java:1073)
    leiningen.sass$sass.invokeStatic (sass.clj:85)
    leiningen.sass$sass.doInvoke (sass.clj:71)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:669)
    clojure.core$apply.invoke (core.clj:662)
    leiningen.core.main$partial_task$fn__7380.doInvoke (main.clj:284)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:669)
    clojure.core$apply.invoke (core.clj:662)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    leiningen.init$init.invokeStatic (init.clj:88)
    leiningen.init$init.doInvoke (init.clj:75)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:669)
    clojure.core$apply.invoke (core.clj:662)
    leiningen.core.main$partial_task$fn__7380.doInvoke (main.clj:284)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:669)
    clojure.core$apply.invoke (core.clj:662)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    leiningen.core.main$_main$fn__7469.invoke (main.clj:453)
    leiningen.core.main$_main.invokeStatic (main.clj:442)
    leiningen.core.main$_main.doInvoke (main.clj:439)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.main$main_opt.invokeStatic (main.clj:514)
    clojure.main$main_opt.invoke (main.clj:510)
    clojure.main$main.invokeStatic (main.clj:664)
    clojure.main$main.doInvoke (main.clj:616)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
 at java.lang.ProcessImpl.create (ProcessImpl.java:-2)
    java.lang.ProcessImpl.<init> (ProcessImpl.java:499)
    java.lang.ProcessImpl.start (ProcessImpl.java:158)
    java.lang.ProcessBuilder.start (ProcessBuilder.java:1110)
    java.lang.ProcessBuilder.start (ProcessBuilder.java:1073)
    leiningen.sass$sass.invokeStatic (sass.clj:85)
    leiningen.sass$sass.doInvoke (sass.clj:71)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:669)
    clojure.core$apply.invoke (core.clj:662)
    leiningen.core.main$partial_task$fn__7380.doInvoke (main.clj:284)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:669)
    clojure.core$apply.invoke (core.clj:662)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    leiningen.init$init.invokeStatic (init.clj:88)
    leiningen.init$init.doInvoke (init.clj:75)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:669)
    clojure.core$apply.invoke (core.clj:662)
    leiningen.core.main$partial_task$fn__7380.doInvoke (main.clj:284)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:669)
    clojure.core$apply.invoke (core.clj:662)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    leiningen.core.main$_main$fn__7469.invoke (main.clj:453)
    leiningen.core.main$_main.invokeStatic (main.clj:442)
    leiningen.core.main$_main.doInvoke (main.clj:439)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.main$main_opt.invokeStatic (main.clj:514)
    clojure.main$main_opt.invoke (main.clj:510)
    clojure.main$main.invokeStatic (main.clj:664)
    clojure.main$main.doInvoke (main.clj:616)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)

```

EIDT: PATH problems again with my shell environment, all good now, I managed to build editor and engine. I’ll get to building stuff now 🥳
