haxe icon indicating copy to clipboard operation
haxe copied to clipboard

Add hint to update build tools when the smart string check is triggered

Open PXshadow opened this issue 4 months ago • 6 comments

The information below is out of date: refer to @tobil4sk 's response and commits below that

~ ~

I'm unable to compile hxcpp without removing the smart string check, on the latest Haxe nightly version, and newest git version for hxcpp. Haxe Compiler 5.0.0-preview.1+ff3f3ef

% haxelib git hxcpp https://github.com/haxefoundation/hxcpp
You already have hxcpp version git installed.
Library hxcpp version git already up to date
  Current version is now git
Done

% haxe build.hxml
haxelib run hxcpp Build.xml haxe -Danalyzer_optimize="1" -Ddump.stage="dce" -Ddump_ignore_var_ids="1" -Ddump_path="dump" -Deval_call_stack_depth="1000" -Deval_print_depth="5" -Dhaxe="5.0.0-preview.1" -Dhaxe3="1" -Dhaxe4="1" -Dhaxe5="1" -Dhaxe_ver="5.000" -Dhxcpp_api_level="500" -Dhxcpp_smart_strings="1" -Dloop_unroll_max_cost="250" -Dmessage.log_format="indent" -Dmessage.reporting="pretty" -Dsource_header="Generated by Haxe 5.0.0-preview.1+ff3f3ef" -Dstatic="1" -Dtarget.atomics="1" -Dtarget.name="cpp" -Dtarget.static="1" -Dtarget.sys="1" -Dtarget.threaded="1" -Dtarget.unicode="1" -Dtarget.utf16="1" -Dutf16="1" -Isrc/ -I -I/usr/local/lib/haxe/std/cpp/_std/ -I/usr/local/lib/haxe/std/
Error: Hxcpp is out of date - please update
[ERROR] (unknown position)

   | Error: Build failed

-Dhxcpp_smart_strings="1" is still in the compilation.

This is the build.hxml:

-cp src
-D analyzer-optimize
-main Main # simple hello world
--cpp bin/cpp

PXshadow avatar Aug 07 '25 11:08 PXshadow

This message exists to catch issues which would manifest later on as C++ errors from internal hxcpp files. It's not a good idea to disable this check because it will turn a readable api mismatch error into more complicated errors that people will be more confused about.

If it's useful we could change the error message to be more helpful in the case where the user just needs to rebuild their hxcpp tools.

Originally it was only features related to hxcpp_smart_strings that needed additionally support from the hxcpp api, hence why the condition exists rather than it being on by default. Now it probably makes more sense to just enable it always because it is already very rare to compile without smart strings and there have been other api changes to hxcpp unrelated to them. The alternative would be to have a more robust system which can keep track of which features require which api version and only require a higher api version if it is strictly needed.

tobil4sk avatar Aug 07 '25 22:08 tobil4sk

@tobil4sk thanks for the detailed explanation. A per feature api version, sounds like the best solution indeed.

For now I'll add back the check with a hint about the build tool system potentially being out of date.

PXshadow avatar Aug 08 '25 10:08 PXshadow

Is this intentional? HxcppSmartStings and not HxcppSmartStrings (with an r)

PXshadow avatar Sep 03 '25 09:09 PXshadow

HxcppSmartStings and not HxcppSmartStrings (with an r)

Seems like a typo: https://github.com/HaxeFoundation/haxe/blob/bb569d9b99c23a9db3809eb760784d7f3a51735d/src-json/define.json#L473

tobil4sk avatar Sep 03 '25 17:09 tobil4sk

Another PR or can I put it in here?

PXshadow avatar Sep 03 '25 18:09 PXshadow

I think it would be fine as part of this PR

tobil4sk avatar Sep 12 '25 18:09 tobil4sk