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

Can't compile on Windows #44

Open
loudoweb opened this issue Apr 19, 2021 · 8 comments
Open

Can't compile on Windows #44

loudoweb opened this issue Apr 19, 2021 · 8 comments

Comments

@loudoweb
Copy link

loudoweb commented Apr 19, 2021

I have tried the ammer sample project here in this lib.

I have build the windows dll with success.
I can compile to hxcpp and the exe is working as attended.
But I can't compile to hl, here is my error:

C:\HaxeToolkit\haxe\lib\ammer\git\samples\poc>haxe build-hl.hxml
Uncaught exception Null Access
C:\HaxeToolkit\haxe\lib\ammer/git/src/ammer/build/BuildTools.hx:76: characters 29-70 : Called from here
C:\HaxeToolkit\haxe\lib\ammer/git/src/ammer/LineBuf.hx:25: characters 5-8 : Called from here
C:\HaxeToolkit\haxe\lib\ammer/git/src/ammer/build/BuildTools.hx:41: lines 41-101 : Called from here
C:\HaxeToolkit\haxe\lib\ammer/git/src/ammer/build/BuildHl.hx:10: lines 10-34 : Called from here
C:\HaxeToolkit\haxe\lib\ammer/git/src/ammer/Ammer.hx:439: characters 9-53 : Called from here

Is there a specific haxe version to use?

Mine is : 4.1.2

@Aurel300
Copy link
Owner

That was indeed a Windows-specific bug (and Windows CI is not set up yet…), now fixed. Depending on your installation, just haxe build-hl.hxml in the poc directory might not be enough. If that happens, make sure to read the README, which shows the additional command-line arguments you need.

@loudoweb
Copy link
Author

Thanks!

So after executing build-hl.hxml I tried to execute Makefile.hl.ammer in the output directory with nmake /F Makefile.hl.ammer to create the hdll but it doesn't seem to work.

Here are the files I got:
image

When I execute hl sample.hl it complains about a missing hdll :
FATAL ERROR : Failed to load library ammer_adder.hdll

@Aurel300
Copy link
Owner

nmake is supposed to run automatically on Windows, was there another error when invoking Haxe? I also see there is a ammer_adder.hl.dll file in the directory, does it work when you rename it to ammer_adder.hdll?

@loudoweb
Copy link
Author

No it doesn't work.

But I have warning when invoking haxe:

haxe -D ammer.hl.hlInclude=C:\Development\hl-1.11.0-win\include -D ammer.hl.hlLibrary=C:\Development\hl-1.11.0-win build-hl.hxml
nmake [/f,Makefile.hl.ammer]

Microsoft (R) Program Maintenance Utility Version 14.16.27030.1
Copyright (C) Microsoft Corporation. Tous droits réservés.

        cl /OUT:ammer_adder.hdll /LD ammer_adder.hl.obj /DLIBHL_EXPORTS /link /LIBPATH:"C:\Development\hl-1.11.0-win" /LIBPATH:"C:/HaxeToolkit/haxe/lib/ammer/git/samples/poc/native" libhl.lib adder.lib
Compilateur d'optimisation Microsoft (R) C/C++ version 19.16.27030.1 pour x86
Copyright (C) Microsoft Corporation. Tous droits réservés.

cl : Ligne de commande warning D9002 : option '/OU' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/OT' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/O:' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/Oa' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/Om' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/Om' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/Oe' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/Or' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/O_' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/Oa' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/Oe' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/Or' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/O.' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/Oh' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/Ol' inconnue ignorée
cl : Ligne de commande warning D9002 : option '/Ol' inconnue ignorée
Microsoft (R) Incremental Linker Version 14.16.27030.1
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:ammer_adder.hl.dll
/dll
/implib:ammer_adder.hl.lib
/LIBPATH:C:\Development\hl-1.11.0-win
/LIBPATH:C:/HaxeToolkit/haxe/lib/ammer/git/samples/poc/native
libhl.lib
adder.lib
ammer_adder.hl.obj
   Création de la bibliothèque ammer_adder.hl.lib et de l'objet ammer_adder.hl.exp

@Aurel300 Aurel300 reopened this Apr 19, 2021
@Aurel300 Aurel300 changed the title can't compile to hl Can't compile on Windows Apr 19, 2021
@pecheny
Copy link
Contributor

pecheny commented Jun 28, 2021

@Aurel300 Playing around i've found MSVC cl.exe has no /OUT switch for defining resulting filename so it ignores blahblah.hdll and creates dll with default name. The manual says /Fe switch suit this goal. I've tried to fix makefile produced by ammer and call nmake manually then everything worked fine.
BTW What do you think about if BuildTools could be more OOP-like? I mean smth like MSVCProcessor, GCCProcessor instead of multiple Ammer.config.useMSVC checks?

@Aurel300
Copy link
Owner

@pecheny Ah, I see, thanks. I'm not sure where I got /OUT from in the first place. As for the BuildTools change – why not. I didn't want to overengineer these parts, but you're right that it's weird to do the useMSVC check multiple times.

@pecheny
Copy link
Contributor

pecheny commented Jun 29, 2021

@Aurel300 glad you liked the idea. As for me it doesn't look like overengineering but most appropriate place to apply oop.
Several opened issues about support different platforms/toolchains would be easier to support in this way.
Also i have another idea. Maybe CMake configuration instead of several makefile formats would be easier to support. It can be good addition because it supports any composiotion of platform/os/compiler.

@Aurel300
Copy link
Owner

CMake would be nice as another alternative, but not as the only method. I know it is becoming pretty ubiquitous as a build system but I still prefer that the only thing you need for ammer projects (apart from Haxe) really is just the most basic C compiler + make stack possible.

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

3 participants