Scons build system

Godot Version

master branch

Question

How am I supposed to use the scons build system when trying to understand Godot’s source code? I know Godot has documentation on scons, but I’m still unsure about what the workflow actually looks like.

Like, is this the correct command to compile from source?
scons platform=linuxbsd target=editor dev_mode=yes llvm=yes

(For context, I’m using Linux, and I want to compile with clang)

And if yes, should I run that same command every time I want to recompile after making changes? And how would debugging work?

Sorry for asking all of this at once, I’m just a bit lost

Yes, the build is pretty smart, it should only rebuild what has changed.

You can get a list of options with scons --help, all the options you see come from the sconstruct file.

If you want to learn about scons, check out there website.

Debugging the source code on Linux, you can use GDB, or Valgrind. There are many other options available out there.

@pennyloafers

I have another error while trying to compile Godot. After doing more research, I decided to run this to compile Godot:
bear – scons dev_mode=yes use_llvm=yes optimize=debug

“bear --” because I need clangd to know how the project is structured so that I don’t get unnecessary errors, before I even changed anything.

But now I’m getting this compilation error:
/usr/bin/ld: cannot find -l:libatomic.a: No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [bin/godot.linuxbsd.editor.x86_64.llvm] Error 1

In-case this info helps:
I’m using Arch Linux, and I installed this package thinking it will resolve the issue: libatomic_ops.
Then I recompiled it, using the same “bear – scons…” command, and I’m getting the same error

Have you installed the clang development library?

Atomics is part of the standard library, so if you have installed clang correctly you should have it already.

If you have already installed clang properly then you may have an environment issue. What does running the scons command without bear tell you?

@pennyloafers
I installed clang with “sudo pacman -S clang”. If the “clang development library” is stored in some other package, then I don’t have it installed. Running scons without “bear --”, gives me the same error.

Running “pacman -Ss libatomic” only outputs 1 result: libatomic_ops 7.8.2-1
So like I mentioned earlier, I tried installing that package, but still the same issue

I found this

Thank you! That fixed it.

There’s still a few small issues with “bear” and the “compile_commands.json” file, But I think I’ll be able to figure it out

1 Like