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

build failure #38

Closed
Ilir-Liburn opened this issue Feb 1, 2022 · 6 comments
Closed

build failure #38

Ilir-Liburn opened this issue Feb 1, 2022 · 6 comments

Comments

@Ilir-Liburn
Copy link
Contributor

Hello,

run.win from test/unit is giving me error on hxcpp 4.2.1. What I'm doing wrong?

Error: GcRegCapture.cpp
C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(53): error C2039: 'Rbx': is not a member of '_CONTEXT'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT'
C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(54): error C2039: 'Rbp': is not a member of '_CONTEXT'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT'
C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(55): error C2039: 'Rdi': is not a member of '_CONTEXT'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT'
C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(56): error C2039: 'R12': is not a member of '_CONTEXT'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT'
C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(57): error C2039: 'R13': is not a member of '_CONTEXT'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT'
C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(58): error C2039: 'R14': is not a member of '_CONTEXT'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT'
C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(59): error C2039: 'R15': is not a member of '_CONTEXT'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT'
C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(60): error C2039: 'Xmm0': is not a member of '_CONTEXT'
C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT'
C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(60): error C2660: 'memcpy': function does not take 2 arguments

@haxiomic
Copy link
Owner

haxiomic commented Feb 1, 2022

Hey @Ilir-Liburn! Interesting one

What happens if you make a haxe file with just

// Main.hx
function main() trace("hello world!");

And compile it with hxcpp like

haxe --main Main --cpp bin/ -dce full

Do you get the same errors?

Those errors are about CPU registers so maybe there's something related to the CPU architecture to resolve
Are you on an ARM computer or a 32-bit computer out of interest?

@Ilir-Liburn
Copy link
Contributor Author

Hello,

here is the result

Compiling group: runtime
cl.exe -D_CRT_SECURE_NO_DEPRECATE -DHX_UNDEFINE_H -nologo /WX- /fp:precise -DHX_WINDOWS -D_USING_V140_SDK71_ -GR -O2(optim-std) -Zi(debug) -FdC:\HaxeToolkit\haxe\lib\haxe-c-bridge\0,7,0\test\unit\bin\obj/msvc19xp/vc.pdb(debug) -Od(debug) -O2(release) -Os(optim-size) -FS -Oy- -c -EHs -GS- -arch:SSE2 -IC:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/include -DHXCPP_VISIT_ALLOCS(haxe) -DHX_SMART_STRINGS(haxe) -DHXCPP_API_LEVEL=400(haxe) -D_CRT_SECURE_NO_DEPRECATE -D_ALLOW_MSC_VER_MISMATCH -D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH -wd4996 ... tags=[haxe]

  • src/Array.cpp
  • src/hx/Boot.cpp
  • src/hx/Anon.cpp
  • src/hx/Date.cpp
  • src/hx/Object.cpp
  • src/hx/Interface.cpp
  • src/Enum.cpp
  • src/hx/CFFI.cpp [haxe,static]
  • src/hx/Class.cpp
  • src/Dynamic.cpp
  • src/hx/gc/GcRegCapture.cpp [haxe,gc]
  • src/Math.cpp
  • src/hx/Hash.cpp
  • src/hx/Thread.cpp
  • src/hx/gc/Immix.cpp [haxe,gc]
  • src/hx/Lib.cpp [haxe,static]
  • src/hx/StdLibs.cpp [haxe,static]
  • src/hx/gc/GcCommon.cpp [haxe,gc]
  • src/hx/Debug.cpp
  • src/String.cpp [haxe,hxstring]
    Link: Main.exe
    Creating library Main.lib and object Main.exp

C:\HaxeToolkit\haxe\lib\haxe-c-bridge\0,7,0\test\unit\bin>"C:\HaxeToolkit\haxe\lib\haxe-c-bridge\0,7,0\test\unit\bin\Main.exe"
Main.hx:1: hello world!

I thought problem is in cl, e.g. I'm using 32 bit version (you can see that from the C:\Program Files (x86) path), but it is working just fine.
I'm surprised about your comment about CPU registers, I'm on Windows 10 Pro x64, i7 1st gen, is that a problem?

@haxiomic
Copy link
Owner

haxiomic commented Feb 1, 2022

I thought problem is in cl, e.g. I'm using 32 bit version

Ahh, that could be related: try removing -D HXCPP_M64 from build-library.hxml and trying haxe build-library.hxml

(The errors about "Rbx" and so on refers x64 CPU registers, so it seems the compiler is compiling in 32-bit mode whereas hxcpp was expecting 64)

It would be best to keep -D HXCPP_M64 and compile with 64 bit cl.exe however

@Ilir-Liburn
Copy link
Contributor Author

Hello,

yes, that solved the issue, great, thanks.

Now I need to find out how mapping works, e.g. if int,float,double are directly interchangeable, what about Dynamic, is Vector directly mapped to C array, etc.
I need this to either build a library (extension) or to embed it into other VM.
I think I also need special requirement: reference counting when it comes to GC, and for that I think I have to dig dipper into hxCPP.

@haxiomic
Copy link
Owner

haxiomic commented Feb 1, 2022

Currently it supports C primitives, C callbacks and strings

See the test for a complete view of features

For advanced things like objects you could use a C struct extern https://github.com/haxiomic/haxe-c-bridge/blob/main/test/unit/src/MessagePayload.h

Lots of good discussion about handling arrays here
#34

Good luck!

@Ilir-Liburn
Copy link
Contributor Author

OK, thanks. I have one year (more or less) to do so, there is no rush.

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

No branches or pull requests

2 participants