modules/speech_to_text/register_types.cpp:2:10: fatal error: ‘object_type_db.h’ file not found – GODOT Compilation

If you get this error modules/speech_to_text/register_types.cpp:2:10: fatal error: ‘object_type_db.h’ file not found you need to do this :

modules/speech_to_text/register_types.cpp:2:10: fatal error: 'object_type_db.h' file not found - GODOT Compilation

Introduction – modules/speech_to_text/register_types.cpp:2:10: fatal error: ‘object_type_db.h’ file not found

Go into directory source of GODOT and modules/speech_to_text :

File to open is register_types.cpp

You will see use of a header file

#include "object_type_db.h"

It changes between GODOT 2 and 3 from object_type_db.h to class_db.h

So chang it by :

#include "core/object/class_db.h"

Save and execute GODOT source compilation again it will works.

I get similar error on

modules/speech_to_text/stt_config.h:4:10: fatal error: ‘core/resource.h’ file not found

You need to open modules/speech_to_text/stt_config.h and modify :

#include "core/resource.h"

By :

#include "core/io/resource.h"

Also i get modules/speech_to_text/stt_error.h:4:10: fatal error: ‘core/object.h’ file not found

so i do the following in stt_error.h :

#include "core/object.h"
#include "core/ustring.h"
#include "core/object/object.h"
#include "core/string/ustring.h"

Internal links :

https://128mots.com/index.php/en/2021/02/17/typeerror-can_build-takes-1-positional-argument-but-2-were-given/

https://docs.godotengine.org/en/3.0/development/compiling/compiling_for_osx.html

TypeError: can_build() takes 1 positional argument but 2 were given – Godot Compilation

If you get this type of errors TypeError: can_build() takes 1 positional argument but 2 were given when trying to compile Godot you have to do this :

When i tried to compile with scons i got this errors :

scons: Reading SConscript files ...
Automatically detected platform: osx
Building for macOS 10.12+, platform x86-64.
TypeError: can_build() takes 1 positional argument but 2 were given:
  File "/Users/myuser/godot/SConstruct", line 556:
    if config.can_build(env, selected_platform):

How to solve this error ?

First check you version of scons by launching :

scons -v

It will give you the scons path :

SCons path: ['/usr/local/Cellar/scons/4.1.0.post1/libexec/lib/python3.9/site-packages/SCons']

You then notice the use of python 3.9

You have to update your python to 3.9 :

Update Python easy update to Python 3.9 with homebrew – To update Mac os python from an older version to the latest python example python 3.9.1 you can do the folowing :

This article briefly describes how to replace its version of python on Mac. I wrote a similar article some time ago.

python mac Mac os update Python

I used Homebrew to get the latest python as describe on https://formulae.brew.sh/formula/python@3.9:

brew install python@3.9
python --version
Python 3.8.5
python3 --version
Python 3.8.5

You see that it stays on the older version.

Detect where python or python3 is setup

I had to first verify where my python command is pointing, by launching :

which python

It gave me in my case:

/Users/myuser/.pyenv/shims/python

You need also to verify where is python3 command if you have different versions :

which python3  

I get :

/Users/myuser/.pyenv/shims/python3

Replace the version

I need to replace the version of the both command python and python3 by launching :

ln -s -f /usr/local/bin/python3.9 /Users/myuser/.pyenv/shims/python3

And also launch :

ln -s -f /usr/local/bin/python3.9 /Users/myuser/.pyenv/shims/python

The you can test it works :

python --version 
Python 3.9.1
python3 --version 
Python 3.9.1

Come back on GODOT compilation with Scons :

You need to localize the module that is bad in GODOT modules directory

For example i localize speech_to_text that was bad in config.py

So i directly modify config.py from this directory from can_build(env) to can_build(env, platform):

import os  # system()


def can_build(env, platform):
    if platform == "x11":
        has_pulse = os.system("pkg-config --exists libpulse-simple") == 0
        has_alsa = os.system("pkg-config --exists alsa") == 0
        return has_pulse or has_alsa
    elif platform in ["windows", "osx", "iphone", "android"]:
        return True
    else:
        return False


def configure(env):
    pass

And it works :

godot % scons
scons: Reading SConscript files ...
Automatically detected platform: osx
Building for macOS 10.12+, platform x86-64.
YASM is necessary for WebM SIMD optimizations.
WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!
Checking for C header file mntent.h... no
scons: done reading SConscript files.
scons: Building targets ...
[Initial build] Compiling ==> platform/osx/crash_handler_osx.mm
[Initial build] Compiling ==> platform/osx/os_osx.mm
[Initial build] Building RD_GLSL header: "servers/rendering/renderer_rd/shaders/canvas.glsl.gen.h"
[Initial build] Building RD_GLSL header: "servers/rendering/renderer_rd/shaders/canvas_occlusion.glsl.gen.h"
[Initial build] Building RD_GLSL header: "servers/rendering/renderer_rd/shaders/scene_forward.glsl.gen.h"
[Initial build] Building RD_GLSL header: "servers/rendering/renderer_rd/shaders/canvas_sdf.glsl.gen.h"

TypeError: can_build() takes 1 positional argument but 2 were given – Internal links :

This article briefly describes how to replace its version of python on Mac. I wrote a similar article some time ago.

https://128mots.com/index.php/2021/02/15/implementation-des-graphes-en-python/

Mac os update Python easy update to Python 3.9 with homebrew

Update Python easy update to Python 3.9 with homebrew – To update Mac os python from an older version to the latest python example python 3.9.1 you can do the folowing :

This article briefly describes how to replace its version of python on Mac. I wrote a similar article some time ago.

python mac Mac os update Python

Introduction – update to Python 3.9.1 – HOMEBREW

I used Homebrew to get the latest python as describe on https://formulae.brew.sh/formula/python@3.9:

brew install python@3.9
python --version
Python 3.8.5
python3 --version
Python 3.8.5

You see that it stays on the older version.

Detect where python or python3 is setup

I had to first verify where my python command is pointing, by launching :

which python

It gave me in my case:

/Users/myuser/.pyenv/shims/python

You need also to verify where is python3 command if you have different versions :

which python3  

I get :

/Users/myuser/.pyenv/shims/python3

Replace the version

I need to replace the version of the both command python and python3 by launching :

ln -s -f /usr/local/bin/python3.9 /Users/myuser/.pyenv/shims/python3

And also launch :

ln -s -f /usr/local/bin/python3.9 /Users/myuser/.pyenv/shims/python

The you can test it works :

python --version 
Python 3.9.1
python3 --version 
Python 3.9.1

Mac os update Python – Internal links :

This article briefly describes how to replace its version of python on Mac. I wrote a similar article some time ago.

https://128mots.com/index.php/2021/02/15/implementation-des-graphes-en-python/