Compilation issues on Linux (clang++ as CC)


trying to build Defold on Linux i am running into following problem:

The recognized C compiler is always clang++ and the compilation process stops with errors as soon as any C lib is compiled with clang++ (obviously C compiled as C++ works only if C code is written carefully with this in mind).


Is there anything i can do to fix this or to control this process better? (i.e. setting CC as an env-var or hardcode somewhere inside, etc).

Thank you

Hi @nkindt !

When I look at our documentation, I realize it doesn’t mention the fact that we don’t use the installed tools, but a certain version of clang which we’ve downloaded from their prepackaged download page.

Current version is 9.0.0 but that isn’t available at the downloads page (I couldn’t find it), but we already use Clang-10.0.1 on the build server, so it should be safe to use that instead. (I’m currently making this update in the repo now so it’ll be easier for others)

The key piece missing in the docs is the fact that you can install sdk packages from a local folder, if the packages are located there.

  • Download the package clang-10.0.1
  • put it in a local folder (e.g. ./local_sdks
  • Update your like so:
  • Run ./scripts/ install_ext
  • Inspect your installed SDKS, ls tmp/dynamo_home/ext/SDKs and you should find a folder linux/clang-10.0.1 there

Now, try to build the engine again, and the found gcc,cctool should point into the clang-10.0.1 folder.


As I test this myself, I found that it’s not that easy (each compiler upgrade comes with a new set of restrictions I have to work through).

Use the currently used version instead, and everything should work as intended.

I have updated the readme with this link.

1 Like

Thanks Mathias for the quick reply! Will try that.

1 Like

All went well - i ended up with tmp/dynamo_home/bin/x86_64-linux/ as stated in the docs but don’t know how to proceed from here. The Defold binary (everybody is used to) is not present so trying out ./launcher and ./dmengine result in some errors:

INFO:TOOLS: Launcher version 1f748d5b0a84e8b5c58bf747e4c48d153ef77a52
FATAL:TOOLS: Failed to load config file './config' (-1)

INFO:DLIB: Log server started on port 35943
INFO:ENGINE: Target listening with name: nk-zen - - Linux
INFO:ENGINE: Engine service started on port 8001
INFO:ENGINE: Defold Engine 1.2.186 (1f748d5)
INFO:ENGINE: Loading data from: .
INFO:ENGINE: Initialised sound device 'default'
INFO:DLIB: SSDP: Started on address
INFO:DLIB: SSDP: Started on address
INFO:DLIB: SSDP: Done on address
INFO:DLIB: SSDP: Done on address

The docs don’t mention anything else so might be just me new to Defold and missing some details.


The engine executable is located here:

but don’t know how to proceed from here.

Well, what do you wish to do?

Ok, that launches a window and waits for connection. I would like to make some changes to the source, recompile and just launch Defold as if i would’ve downloaded it from github. Basically replace current 1.2.186 release with the compiled one and work from there.

You have a few options:

  1. Build and run the editor. This will use a local engine
  2. Build bob (which will include your built engine) and bundle project that way
  3. Build project from an existing editor, then copy dmengine to the project root and run dmengine

I think there’s also an option to launch the editor in “dev mode” which lets you build and run using a local engine.

1 Like

Alright, thanks!

That’s because you launched it in a directory that doesn’t have the game.project available.

Launch it from your game project folder (make sure you’ve built the content first):

cd my_game_project_folder

You can edit your editor config and add to the “vmargs” property

It gives you an extra preference pane called “Dev” in the editor.
Add your custom executable there.
That way you can do “Build and run” directly from the editor.


I am trying the second approach now which seems to be perfect for bash scripts:

Building an android app via bob like this:

java -jar .../tmp/dynamo_home/share/java/bob.jar --archive --platform armv7-android resolve distclean build bundle

and it finishes ok with 100% … done! However i can’t find any logging strings, i added to the source, inside the that is placed inside armv7-android folder. Recompiling the engine doesn’t show any errors so i am bit confused why there aren’t any strings inside the binary.

I.e. LOGV(“glfw_atexit”) is there as expected:

[0x00021590]> f ~glfw_atexit
0x002c204f 12 str.glfw_atexit

Question is what might be the problem and if i can double check that somehow all went ok with the build. Either way some is pulled in and it even prints:

Building engine... ...done! during the bob build step with having the current timestamp.

Some last piece of the puzzle i am missing here. Thanks a bunch!

The logging is deiabled (amongst other things) when you run a release build.
To bundle a debug build add --variant debug

1 Like

Still the same unfortunately. I can see LOGV strings in binary as before but none of my own which implies that the engine is either not built (although shows success) or somehow a wrong one is pulled in.

I.e. i can fully locate this log string:

if (pthread_self() != g_MainThread)
    LOGV("Not on main thread, skipping.");
    return GL_FALSE;

in binary:

[0x00049de0]> f ~Not_on_main
0x002e43f2 30 str.Not_on_main_thread__skipping.

Buy anything i added before to log things won’t show up in the binary no matter what. I.e. added this log string for testing purposes:

static void android_app_free(struct android_app* android_app) {
    LOGV("android_app_free() {");

but it’s not included in the binary:

[0x00049de0]> f ~android_app_free

Anything i could potentially miss or any common build pitfalls or something similar maybe?
Will keep looking, would like to understand the whole process better.

Strange. Could you please share the sequence of command you are running to produce a build?

The engine is built according to the docs (done once and haven’t touched this since):

./scripts/ shell
./scripts/ install_ext --platform=x86_64-linux --package-path=./packages
./scripts/ build_builtins
./scripts/ build_engine --platform=x86_64-linux
./scripts/ build_bob --skip-tests

The android build is executed like this (in game folder with game.project):

java -jar .../defold/tmp/dynamo_home/share/java/bob.jar --archive --platform armv7-android --variant debug resolve distclean build bundle | grep engine
Building engine... ...done!

Didn’t spot any errors or warning and everything seems to be in order.

That looks like it should work.
Are you using any extensions (dependencies) in your game project?

Dependencies are being used (debug-draw, defold-input, defold-metrics) and one own native extension to call from Lua into Java.

Ok, so then you are building a custom engine, on the cloud server, using officially built engine libraries.

That build doesn’t know about your custom engine build (in particular the libraries you’ve built).

For most engine features/fixes though, I’d recommend testing it in a vanilla project (without native extension dependencies) and then making a pull request.

However, if you intend to continue making a custom engine, you need to build and use a local build server.
Instructions can be found here: