Hxtelemetry errors

I’m trying to run hxtelemetry, but I get weird errors.

$ openfl create project hxtest
[email protected] MINGW64 /d/Dev/private/haxe
$ cd hxtest

[email protected] MINGW64 /d/Dev/private/haxe/hxtest
$ openfl test neko -Dtelemetry
D:\Programs\Haxe\haxe\std/neko/vm/Mutex.hx:36: characters 6-20 : Primitive not found [email protected]_create:0
<builtin>:1: character 0 : Called from
D:\Programs\Haxe\haxe\std/neko/vm/Mutex.hx:29: lines 29-69 : Called from
D:/Programs/Haxe/haxe/lib/hxtelemetry/0,3,5/hxtelemetry/HxTelemetry.hx:77: characters 36-47 : Called from
Aborted

[email protected] MINGW64 /d/Dev/private/haxe/hxtest
$ openfl test cpp -Dtelemetry
D:\Programs\Haxe\haxe\std/neko/vm/Mutex.hx:36: characters 6-20 : Primitive not found [email protected]_create:0
<builtin>:1: character 0 : Called from
D:\Programs\Haxe\haxe\std/neko/vm/Mutex.hx:29: lines 29-69 : Called from
D:/Programs/Haxe/haxe/lib/hxtelemetry/0,3,5/hxtelemetry/HxTelemetry.hx:77: characters 36-47 : Called from
Aborted
[email protected] MINGW64 /d/Dev/private/haxe/hxtest
$ haxelib list hx
hxcpp: 3.2.205 3.3.49 3.4.2 [3.4.49]
hxtelemetry: [0.3.5]

It tries to use neko.vm.Mutex for cpp target too?
I’m certain I used hxscout successfully about a year ago on the same machine.
If somebody had similar problem please tell me the solution.
Thanks.

I managed to create minimal test case which causes exact the same error: https://gist.github.com/Misiur/e0c0d27b8c08c6fca60ccae6d8903f79

package;

#if macro
import neko.vm.Mutex;
import haxe.macro.Expr.Field;
#end

#if !macro
@:build(Macro.build())
class Main
{
    public static function main() {
    }
}
#else
class Macro
{
    private static var mutex:Mutex = new Mutex();

    public static function build():Array<Field>
    {
        return [];
    }
}
#end

I’ll look into openfl source now

1 Like

Well, after short investigation I did this: https://gist.github.com/Misiur/1eef986935714cfb13b29b740401986d

diff --git a/openfl/display/Stage.hx b/openfl/display/Stage.hx
index 74e33f9..b1ca49a 100644
--- a/openfl/display/Stage.hx
+++ b/openfl/display/Stage.hx
@@ -57,6 +57,9 @@ import openfl.ui.Mouse;
 import openfl.ui.MouseCursor;
 
 #if hxtelemetry
+#if macro
+#error "WTF"
+#end
 import openfl.profiler.Telemetry;
 #end
[email protected] MINGW64 /d/Dev/private/haxe/hxtest
$ openfl test neko -Dtelemetry
D:/Dev/haxe/openfl/openfl/display/Stage.hx:61: characters 7-12 : WTF

For some reason Stage.hx is executed in macro context! Is this intentional? @singmajesty

Hi @Misiur - it’s on my list to get back to hxtelemetry / hxScout and make sure it’s all working with the latest Haxe and hxcpp releases. When you said it was triggering neko in a cpp build, I thought of the macro context (which indeed is neko.) I’m not sure why Stage would be needed for the macro step, but maybe some #if !macro protection around the hxtelemetry stuff would help.

2 Likes

Does this help?

It does not :frowning: . Merely importing import openfl.profiler.Telemetry; (which in turn imports import hxtelemetry.HxTelemetry;) causes this error. I tried fiddling with #if !macro in openfl source but couldn’t find a solution myself.

This one?

:slight_smile:

Works perfectly! :slight_smile:

1 Like

@singmajesty I think you meant to link to this commit:

The other one is about Flash render priority. :smiley:

Haha, YES :flushed: :blush: