HxGodot / hxgodot

A Haxe GDExtension for Godot 4
MIT License
232 stars 11 forks source link

Error building GDExtension with Haxe 4.1.4 and HXCPP 4.1.15 #11

Closed drekay closed 1 year ago

drekay commented 2 years ago

Getting errors when creating the extension - make debug on Mac OS Mojave 10.14.6 with Haxe 4.1.4 and HXCPP 4.1.15. I use these version due to compatibility issues with other C++ libraries used in my projects so I was hoping this was going to work. It looks like the Haxe VariantFactory's constructor needs to be typed properly but can't figure it out.

Please see the error below:

`hxgodot-cpp ....$ make debug mkdir -p test/demo/bin haxe build-lib.hxml -debug src/godot/macros/Macros.hx:128: example.HxExample src/godot/macros/Macros.hx:153: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:154: // Class: example.HxExample src/godot/macros/Macros.hx:370: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:371: // FProp: hx_ImportantFloat src/godot/macros/Macros.hx:372: {name: hx_ImportantFloat, doc: null, pos: #pos(src/example/HxExample.hx:11: characters 5-55), access: [APublic], kind: FProp(get,set,TPath({name: Float, params: [], pos: #pos((unknown)), pack: []}),{pos: #pos(src/example/HxExample.hx:11: characters 52-54), expr: EConst(CInt(22))}), meta: [{name: :isVar, params: [], pos: #pos(src/example/HxExample.hx:7: characters 5-12)},{name: :export, params: [], pos: #pos(src/example/HxExample.hx:8: characters 5-13)},{name: :hint, params: [{pos: #pos(src/example/HxExample.hx:9: characters 12-32), expr: EField(<...>,<...>)},{pos: #pos(src/example/HxExample.hx:9: characters 34-45), expr: EConst(<...>)}], pos: #pos(src/example/HxExample.hx:9: characters 5-11)},{name: :group, params: [{pos: #pos(src/example/HxExample.hx:10: characters 13-33), expr: EConst(<...>)},{pos: #pos(src/example/HxExample.hx:10: characters 35-40), expr: EConst(<...>)}], pos: #pos(src/example/HxExample.hx:10: characters 5-12)}], name_pos: #pos(src/example/HxExample.hx:11: characters 16-33)} src/godot/macros/Macros.hx:373: get src/godot/macros/Macros.hx:374: set src/godot/macros/Macros.hx:375: TPath({name: Float, params: [], pos: #pos((unknown)), pack: []}) src/godot/macros/Macros.hx:235: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:236: // FFun: set_hx_ImportantFloat src/godot/macros/Macros.hx:249: {ret: TPath({name: Float, params: [], pos: #pos((unknown)), pack: []}), params: [], expr: {pos: #pos(src/example/HxExample.hx:14: lines 14-18), expr: EBlock([{pos: #pos(src/example/HxExample.hx:15: characters 9-29), expr: ECall(<...>,<...>)},{pos: #pos(src/example/HxExample.hx:16: characters 9-31), expr: EBinop(<...>,<...>,<...>)},{pos: #pos(src/example/HxExample.hx:17: characters 9-18), expr: EReturn(<...>)}])}, args: [{name: _v, opt: false, meta: [], type: TPath({name: Float, params: [], pos: #pos((unknown)), pack: []}), name_pos: #pos(src/example/HxExample.hx:14: characters 36-38), value: null}]} src/godot/macros/Macros.hx:235: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:236: // FFun: get_hx_ImportantFloat src/godot/macros/Macros.hx:249: {ret: TPath({name: Float, params: [], pos: #pos((unknown)), pack: []}), params: [], expr: {pos: #pos(src/example/HxExample.hx:21: lines 21-23), expr: EBlock([{pos: #pos(src/example/HxExample.hx:22: characters 9-33), expr: EReturn(<...>)}])}, args: []} src/godot/macros/Macros.hx:370: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:371: // FProp: hx_random_MyVector3 src/godot/macros/Macros.hx:372: {name: hx_random_MyVector3, doc: null, pos: #pos(src/example/HxExample.hx:29: characters 5-75), access: [APublic], kind: FProp(get,set,TPath({name: Vector3, params: [], pos: #pos((unknown)), pack: []}),{pos: #pos(src/example/HxExample.hx:29: characters 56-74), expr: ENew({name: Vector3, params: [], pos: #pos(src/example/HxExample.hx:29: characters 60-67), pack: []},[{pos: <...>, expr: <...>},{pos: <...>, expr: <...>},{pos: <...>, expr: <...>}])}), meta: [{name: :isVar, params: [], pos: #pos(src/example/HxExample.hx:25: characters 5-12)},{name: :export, params: [], pos: #pos(src/example/HxExample.hx:26: characters 5-13)},{name: :hint, params: [{pos: #pos(src/example/HxExample.hx:27: characters 12-31), expr: EField(<...>,<...>)},{pos: #pos(src/example/HxExample.hx:27: characters 33-43), expr: EConst(<...>)}], pos: #pos(src/example/HxExample.hx:27: characters 5-11)},{name: :subGroup, params: [{pos: #pos(src/example/HxExample.hx:28: characters 16-35), expr: EConst(<...>)},{pos: #pos(src/example/HxExample.hx:28: characters 37-48), expr: EConst(<...>)}], pos: #pos(src/example/HxExample.hx:28: characters 5-15)}], name_pos: #pos(src/example/HxExample.hx:29: characters 16-35)} src/godot/macros/Macros.hx:373: get src/godot/macros/Macros.hx:374: set src/godot/macros/Macros.hx:375: TPath({name: Vector3, params: [], pos: #pos((unknown)), pack: []}) src/godot/macros/Macros.hx:235: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:236: // FFun: set_hx_random_MyVector3 src/godot/macros/Macros.hx:249: {ret: TPath({name: Vector3, params: [], pos: #pos((unknown)), pack: []}), params: [], expr: {pos: #pos(src/example/HxExample.hx:32: lines 32-35), expr: EBlock([{pos: #pos(src/example/HxExample.hx:33: characters 9-33), expr: EBinop(<...>,<...>,<...>)},{pos: #pos(src/example/HxExample.hx:34: characters 9-18), expr: EReturn(<...>)}])}, args: [{name: _v, opt: false, meta: [], type: TPath({name: Vector3, params: [], pos: #pos((unknown)), pack: []}), name_pos: #pos(src/example/HxExample.hx:32: characters 38-40), value: null}]} src/godot/macros/Macros.hx:235: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:236: // FFun: get_hx_random_MyVector3 src/godot/macros/Macros.hx:249: {ret: TPath({name: Vector3, params: [], pos: #pos((unknown)), pack: []}), params: [], expr: {pos: #pos(src/example/HxExample.hx:38: lines 38-40), expr: EBlock([{pos: #pos(src/example/HxExample.hx:39: characters 9-35), expr: EReturn(<...>)}])}, args: []} src/godot/macros/Macros.hx:235: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:236: // FFun: simple_func src/godot/macros/Macros.hx:249: {ret: TPath({name: Bool, params: [], pos: #pos((unknown)), pack: []}), params: [], expr: {pos: #pos(src/example/HxExample.hx:60: lines 60-63), expr: EBlock([{pos: #pos(src/example/HxExample.hx:61: characters 9-36), expr: ECall(<...>,<...>)},{pos: #pos(src/example/HxExample.hx:62: characters 9-20), expr: EReturn(<...>)}])}, args: []} src/godot/macros/Macros.hx:235: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:236: // FFun: simple_add src/godot/macros/Macros.hx:249: {ret: TPath({name: Float, params: [], pos: #pos((unknown)), pack: []}), params: [], expr: {pos: #pos(src/example/HxExample.hx:66: lines 66-69), expr: EBlock([{pos: #pos(src/example/HxExample.hx:67: characters 9-54), expr: ECall(<...>,<...>)},{pos: #pos(src/example/HxExample.hx:68: characters 9-23), expr: EReturn(<...>)}])}, args: [{name: _a, opt: false, meta: [], type: TPath({name: Int, params: [], pos: #pos((unknown)), pack: []}), name_pos: #pos(src/example/HxExample.hx:66: characters 32-34), value: null},{name: _b, opt: false, meta: [], type: TPath({name: Float, params: [], pos: #pos((unknown)), pack: []}), name_pos: #pos(src/example/HxExample.hx:66: characters 40-42), value: null},{name: _bool, opt: false, meta: [], type: TPath({name: Bool, params: [], pos: #pos((unknown)), pack: []}), name_pos: #pos(src/example/HxExample.hx:66: characters 50-55), value: null}]} src/godot/macros/Macros.hx:235: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:236: // FFun: simple_add_vector3 src/godot/macros/Macros.hx:249: {ret: TPath({name: Vector3, params: [], pos: #pos((unknown)), pack: [godot,variants]}), params: [], expr: {pos: #pos(src/example/HxExample.hx:77: lines 77-80), expr: EBlock([{pos: #pos(src/example/HxExample.hx:78: characters 9-56), expr: ECall(<...>,<...>)},{pos: #pos(src/example/HxExample.hx:79: characters 9-25), expr: EReturn(<...>)}])}, args: [{name: _v0, opt: false, meta: [], type: TPath({name: Vector3, params: [], pos: #pos((unknown)), pack: [<...>,<...>]}), name_pos: #pos(src/example/HxExample.hx:77: characters 40-43), value: null},{name: _v1, opt: false, meta: [], type: TPath({name: Vector3, params: [], pos: #pos((unknown)), pack: [<...>,<...>]}), name_pos: #pos(src/example/HxExample.hx:77: characters 68-71), value: null}]} src/godot/macros/Macros.hx:483: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:484: // Virtuals src/godot/macros/Macros.hx:485: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:128: example.testPackage.HxOtherInPackage src/godot/macros/Macros.hx:153: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:154: // Class: example.testPackage.HxOtherInPackage src/godot/macros/Macros.hx:483: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:484: // Virtuals src/godot/macros/Macros.hx:485: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:128: example.HxOther src/godot/macros/Macros.hx:153: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:154: // Class: example.HxOther src/godot/macros/Macros.hx:483: //////////////////////////////////////////////////////////////////////////////// src/godot/macros/Macros.hx:484: // Virtuals src/godot/macros/Macros.hx:485: //////////////////////////////////////////////////////////////////////////////// haxelib run hxcpp Build.xml haxe -Ddebug -DHXCPP_CPP11="1" -DHXCPP_M64="1" -Dcompiletime="2.8.0" -Ddll_link="1" -Dhaxe="4.1.4" -Dhaxe3="1" -Dhaxe4="1" -Dhaxe_ver="4.104" -Dhxcpp_api_level="400" -Dhxcpp_smart_strings="1" -Dsource-header="Generated by Haxe 4.1.4" -Dstatic="1" -Dtarget.name="cpp" -Dtarget.static="true" -Dtarget.sys="true" -Dtarget.threaded="true" -Dtarget.unicode="true" -Dtarget.utf16="true" -Dutf16="1" -I"/usr/local/lib/haxe/lib/compiletime/2,8,0/src/" -I"src/" -I"" -I"/usr/local/lib/haxe/extraLibs/" -I"/usr/local/share/haxe/extraLibs/" -I"/usr/local/bin/extraLibs/" -I"/usr/local/lib/haxe/std/cpp/_std/" -I"/usr/local/share/haxe/std/cpp/_std/" -I"/usr/local/bin/std/cpp/_std/" -I"/usr/local/lib/haxe/std/" -I"/usr/local/share/haxe/std/" -I"/usr/local/bin/std/"

Compiling group: haxe g++ -Iinclude -I../godot-headers -I../src -c -fvisibility=hidden -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -g -I/usr/local/lib/haxe/lib/hxcpp/4,1,15/include -DHX_MACOS -m64 -Wno-parentheses -Wno-unused-value -Wno-format-extra-args -Wno-overflow -DHXCPP_DEBUG -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS(haxe) -DHXCPP_DLL_EXPORT(haxe) -DHX_SMART_STRINGS(haxe) -DHXCPP_API_LEVEL=400(haxe) ... tags=[haxe,static]

src/StringBuf.cpp src/haxe/IMap.cpp src/godot/variants/Vector3/Vector3_Impl.cpp src/godot/VariantFactory.cpp Error: ./src/godot/VariantFactory.cpp:47:24: error: cannot initialize a variable of type 'void ' with an rvalue of type 'GDNativeVariantFromTypeConstructorFunc' (aka 'void ()(void , void )') HXDLIN( 41) void * val = godot::internal::gdn_interface->get_variant_from_type_constructor((GDNativeVariantType)i); `

dazKind commented 2 years ago

Thanks for reporting this error! Yeah, there are definitely some issues present with all those nasty casts. Adding proper support for osx and linux is something I will tackle in the coming weeks.

dazKind commented 1 year ago

This should be fixed now