Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling regex module for custom web export throws undefined symbol error #45462

Closed
Tracked by #39196
ghost opened this issue Jan 25, 2021 · 5 comments
Closed
Tracked by #39196

Comments

@ghost
Copy link

ghost commented Jan 25, 2021

Godot version:

3.2.3

OS/device including version:

Windows 10

Issue description:

When disabling regex module for web export, there is an undefined symbol error.
error
To be more specific, when advanced_gui is enabled and regex is disabled, the error happens.

Steps to reproduce:
Type "scons platform=javascript tools=no target=release_debug module_regex_enabled=no"

Minimal reproduction project:

@Faless
Copy link
Collaborator

Faless commented Jan 26, 2021

Also happens on Linux:
scons platform=x11 tools=no target=release_debug module_regex_enabled=no -j9

/usr/bin/ld: scene/libscene.x11.opt.debug.64.a(rich_text_label.x11.opt.debug.64.o): in function `RichTextLabel::parse_expressions_for_values(Vector<String>)':
/home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2945: undefined reference to `RegEx::RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2946: undefined reference to `RegEx::compile(String const&)'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2947: undefined reference to `RegEx::RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2948: undefined reference to `RegEx::compile(String const&)'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2949: undefined reference to `RegEx::RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2950: undefined reference to `RegEx::compile(String const&)'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2951: undefined reference to `RegEx::RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2952: undefined reference to `RegEx::compile(String const&)'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2953: undefined reference to `RegEx::RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2954: undefined reference to `RegEx::compile(String const&)'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2957: undefined reference to `RegEx::search(String const&, int, int) const'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2959: undefined reference to `RegEx::search(String const&, int, int) const'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2953: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2951: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2949: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2947: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2945: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2964: undefined reference to `RegEx::search(String const&, int, int) const'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2970: undefined reference to `RegEx::search(String const&, int, int) const'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2972: undefined reference to `RegEx::search(String const&, int, int) const'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2953: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2951: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2949: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2947: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/fales/Programming/workspaces/git/godot-3.2/scene/gui/rich_text_label.cpp:2945: undefined reference to `RegEx::~RegEx()'

Apparently RichTextLabel uses the RegEx class even when it's not supposed to

@Faless
Copy link
Collaborator

Faless commented Jan 26, 2021

This patch fixes the compilation issue in 3.2, but BBCode parsing gets disabled.
In 4.0 the GLTF module also uses RegEx though: https://github.com/godotengine/godot/blob/master/modules/gltf/gltf_document.cpp

diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 7cde6bbdc5..6741777abe 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -2930,6 +2930,7 @@ Ref<RichTextEffect> RichTextLabel::_get_custom_effect_by_code(String p_bbcode_id
 
 Dictionary RichTextLabel::parse_expressions_for_values(Vector<String> p_expressions) {
        Dictionary d = Dictionary();
+#ifdef MODULE_REGEX_ENABLED
        for (int i = 0; i < p_expressions.size(); i++) {
                String expression = p_expressions[i];
 
@@ -2982,6 +2983,7 @@ Dictionary RichTextLabel::parse_expressions_for_values(Vector<String> p_expressi
                        d[key] = a[0];
                }
        }
+#endif
        return d;
 }
 

@akien-mga akien-mga modified the milestones: 3.2, 3.3 Mar 17, 2021
@swashdev
Copy link

swashdev commented Jun 3, 2021

The problem appears to persist in 3.3.2-stable (commit 7610409) on Linux.

I was trying to compile an optimized export template using the following command:

scons platform=x11 target=release tools=no disable_3d=yes

The error also presented when compiling with LLVM/LLD, but the error reports below are from the above command which used GCC:

/usr/bin/ld: scene/libscene.x11.opt.64.a(rich_text_label.x11.opt.64.o): in function `RichTextLabel::parse_expressions_for_values(Vector<String>)':
/home/philip/code/godot/scene/gui/rich_text_label.cpp:2953: undefined reference to `RegEx::RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2954: undefined reference to `RegEx::compile(String const&)'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2955: undefined reference to `RegEx::RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2956: undefined reference to `RegEx::compile(String const&)'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2957: undefined reference to `RegEx::RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2958: undefined reference to `RegEx::compile(String const&)'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2959: undefined reference to `RegEx::RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2960: undefined reference to `RegEx::compile(String const&)'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2961: undefined reference to `RegEx::RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2962: undefined reference to `RegEx::compile(String const&)'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2965: undefined reference to `RegEx::search(String const&, int, int) const'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2967: undefined reference to `RegEx::search(String const&, int, int) const'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2961: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2959: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2957: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2955: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2953: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2972: undefined reference to `RegEx::search(String const&, int, int) const'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2978: undefined reference to `RegEx::search(String const&, int, int) const'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2980: undefined reference to `RegEx::search(String const&, int, int) const'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2961: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2959: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2957: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2955: undefined reference to `RegEx::~RegEx()'
/usr/bin/ld: /home/philip/code/godot/scene/gui/rich_text_label.cpp:2953: undefined reference to `RegEx::~RegEx()'
collect2: error: ld returned 1 exit status
scons: *** [bin/godot.x11.opt.64] Error 1
scons: building terminated because of errors.```

@akien-mga akien-mga modified the milestones: 3.3, 4.0 Jun 3, 2021
@KoBeWi
Copy link
Member

KoBeWi commented Apr 9, 2022

This should've been fixed already (likely on both branches). Can someone check?

@KoBeWi KoBeWi moved this to To Assess in 4.x Priority Issues Apr 9, 2022
@swashdev
Copy link

I can confirm that 3.4.4-stable now compiles without errors with the regex module disabled.

@KoBeWi KoBeWi closed this as completed Apr 20, 2022
Repository owner moved this from To Assess to Done in 4.x Priority Issues Apr 20, 2022
@akien-mga akien-mga modified the milestones: 4.0, 3.5 Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants