Skip to content

[tools] Fix case handling when checking options changes - #1453

Open
tobil4sk wants to merge 4 commits into
HaxeFoundation:masterfrom
tobil4sk:fix/uppercase-options-rebuild
Open

tobil4sk wants to merge 4 commits into
HaxeFoundation:masterfrom
tobil4sk:fix/uppercase-options-rebuild

Conversation

@tobil4sk

@tobil4sk tobil4sk commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Fix adapted from #1420

Not handling the cases correctly here could lead to stale objects failing to rebuild when adding flags. For example rebuilding a project with -D HXCPP_DEBUGGER caused:

/usr/bin/ld: obj/linux64/da3c452f_Debug.o: in function `__hxcpp_execution_trace(int)':
Debug.cpp:(.text+0x310): multiple definition of `__hxcpp_execution_trace(int)'; obj/linux64/da3c452f_Debugger.o:Debugger.cpp:(.text+0x2af0): first defined here
/usr/bin/ld: obj/linux64/da3c452f_Debug.o: in function `__hxcpp_set_debugger_info(char const**, char const**)':
Debug.cpp:(.text+0x540): multiple definition of `__hxcpp_set_debugger_info(char const**, char const**)'; obj/linux64/da3c452f_Debugger.o:Debugger.cpp:(.text+0x2b30): first defined here
/usr/bin/ld: obj/linux64/aea44ed0_Std.o: in function `Std_obj::isOfType(Dynamic, Dynamic)':
Std.cpp:(.text+0x767): undefined reference to `hx::ExceptionStackFrame::ExceptionStackFrame(hx::StackFrame const&)'
/usr/bin/ld: Std.cpp:(.text+0x7a4): undefined reference to `hx::StackContext::tracePosition()'
/usr/bin/ld: obj/linux64/aea44ed0_Std.o: in function `Std_obj::is(Dynamic, Dynamic)':
Std.cpp:(.text+0xa27): undefined reference to `hx::ExceptionStackFrame::ExceptionStackFrame(hx::StackFrame const&)'
/usr/bin/ld: Std.cpp:(.text+0xa64): undefined reference to `hx::StackContext::tracePosition()'
/usr/bin/ld: obj/linux64/aea44ed0_Std.o: in function `Std_obj::downcast(Dynamic, hx::ObjectPtr<hx::Class_obj>)':
Std.cpp:(.text+0xd67): undefined reference to `hx::ExceptionStackFrame::ExceptionStackFrame(hx::StackFrame const&)'
/usr/bin/ld: Std.cpp:(.text+0xd9c): undefined reference to `hx::StackContext::tracePosition()'
/usr/bin/ld: obj/linux64/aea44ed0_Std.o: in function `Std_obj::instance(Dynamic, hx::ObjectPtr<hx::Class_obj>)':
Std.cpp:(.text+0x10a7): undefined reference to `hx::ExceptionStackFrame::ExceptionStackFrame(hx::StackFrame const&)'
/usr/bin/ld: Std.cpp:(.text+0x10dc): undefined reference to `hx::StackContext::tracePosition()'
/usr/bin/ld: obj/linux64/aea44ed0_Std.o: in function `Std_obj::string(Dynamic)':
Std.cpp:(.text+0x1354): undefined reference to `hx::StackContext::tracePosition()'
/usr/bin/ld: Std.cpp:(.text+0x1397): undefined reference to `hx::ExceptionStackFrame::ExceptionStackFrame(hx::StackFrame const&)'
/usr/bin/ld: obj/linux64/aea44ed0_Std.o: in function `Std_obj::_hx_int(double)':
Std.cpp:(.text+0x1650): undefined reference to `hx::ExceptionStackFrame::ExceptionStackFrame(hx::StackFrame const&)'
/usr/bin/ld: Std.cpp:(.text+0x168c): undefined reference to `hx::StackContext::tracePosition()'
/usr/bin/ld: obj/linux64/aea44ed0_Std.o: in function `Std_obj::parseInt(String)':
Std.cpp:(.text+0x1917): undefined reference to `hx::ExceptionStackFrame::ExceptionStackFrame(hx::StackFrame const&)'
/usr/bin/ld: Std.cpp:(.text+0x1954): undefined reference to `hx::StackContext::tracePosition()'
/usr/bin/ld: obj/linux64/aea44ed0_Std.o: in function `Std_obj::parseFloat(String)':
Std.cpp:(.text+0x1bb5): undefined reference to `hx::ExceptionStackFrame::ExceptionStackFrame(hx::StackFrame const&)'
/usr/bin/ld: Std.cpp:(.text+0x1bf4): undefined reference to `hx::StackContext::tracePosition()'
/usr/bin/ld: obj/linux64/aea44ed0_Std.o: in function `Std_obj::random(int)':
Std.cpp:(.text+0x1ea4): undefined reference to `hx::StackContext::tracePosition()'
/usr/bin/ld: Std.cpp:(.text+0x1eeb): undefined reference to `hx::ExceptionStackFrame::ExceptionStackFrame(hx::StackFrame const&)'
/usr/bin/ld: obj/linux64/aea44ed0_Std.o: in function `hx::StackContext::popFrame(hx::StackFrame*)':
Std.cpp:(.text._ZN2hx12StackContext8popFrameEPNS_10StackFrameE[_ZN2hx12StackContext8popFrameEPNS_10StackFrameE]+0x43): undefined reference to `hx::ExceptionStackFrame::ExceptionStackFrame(hx::StackFrame const&)'
/usr/bin/ld: obj/linux64/3a5324da_Main_Fields_.o: in function `_Main::Main_Fields__obj::main() [clone .cold]':
Main_Fields_.cpp:(.text.unlikely+0x19): undefined reference to `hx::ExceptionStackFrame::ExceptionStackFrame(hx::StackFrame const&)'
/usr/bin/ld: obj/linux64/3a5324da_Main_Fields_.o: in function `_Main::Main_Fields__obj::main()':
Main_Fields_.cpp:(.text.startup+0x112): undefined reference to `hx::ExceptionStackFrame::ExceptionStackFrame(hx::StackFrame const&)'
/usr/bin/ld: Main_Fields_.cpp:(.text.startup+0x146): undefined reference to `hx::StackContext::tracePosition()'
/usr/bin/ld: obj/linux64/da3c452f_Debugger.o: in function `__hxcpp_on_line_changed(hx::StackContext*)':
Debugger.cpp:(.text+0x2a0d): undefined reference to `hx::StackContext::tracePosition()'
/usr/bin/ld: obj/linux64/da3c452f_Debugger.o: in function `hx::Breakpoints::HandleBreakpoints(hx::StackContext*)':
Debugger.cpp:(.text._ZN2hx11Breakpoints17HandleBreakpointsEPNS_12StackContextE[_ZN2hx11Breakpoints17HandleBreakpointsEPNS_12StackContextE]+0x3a9): undefined reference to `hx::StackContext::tracePosition()'
collect2: error: ld returned 1 exit status
Error: Build failed

Closes #991.

When a `HXCPP_ ...` flag changes, we should rebuild. In the past, these
checks were case insensitive but that changed in:
7218783
Hxcpp only respects some of these in upper case, so make sure this
filter matches what hxcpp uses.

This also worked prior to:
7218783
however, now it is more accurate and filters options only in the form
that matches what Hxcpp will read.
Previously, rebuilding a project with HXCPP_DEBUGGER caused stale object
files which gave linking errors.
`HXCPP_LINK_NO_TOOL_DEPENDS` is already covered by the check above:
`name.indexOf("HXCPP_LINK")>=0`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HXCPP-DEBUGGER fatal error LNK1120: 2 unresolved externals

1 participant