proletariatgames / unreal.hx

Unreal.hx: Haxe Integration for Unreal
MIT License
424 stars 43 forks source link

Getting unreal.hx to work with UE 4.22 #126

Closed mfoda closed 4 years ago

mfoda commented 5 years ago

Hi. I tried compiling the plugin in an empty 4.22 project but got two errors in UnrealHx/Source/HaxeInit/BuildApi.Build.cs due to API changes in 4.22, which required changing these two lines:

// line 204
BuildVersion version = BuildVersion.ReadDefault();
// changed to -->
ReadOnlyBuildVersion version = ReadOnlyBuildVersion.Current;

//...

// line 347
foreach (FileReference ProjectFile in UProjectInfo.AllProjectFiles)
// changed to -->
foreach (FileReference ProjectFile in UnrealBuildTool.NativeProjects.EnumerateProjectFiles())
//

After that, I tried compiling but got EXEC : error : Build failed: Cannot find property PluginDir

Any ideas what's causing this or how I can get more debug info to troubleshoot? I'm not sure how to trace it back to the specific file/function where this is happening. Here's the full build output (using vs2017, latest (development) unreal.hx, haxe 3.4.7, and UE-4.22).

Any help would be appreciated!

1>------ Build started: Project: StealthGame, Configuration: Development_Editor x64 ------ 1>Creating makefile for StealthGameEditor (no existing makefile) 1>UnrealBuildTool : warning : Could not find any code project with name StealthGame 1>UnrealBuildTool : warning : Could not find any code project 1>BuildApi.Build.cs: Using Haxe 1>Generating False 1>Calling Haxe 1>Calling the build tool with arguments --cwd "C:\Users\AMD\unreal\StealthGame\Plugins\UnrealHx/Haxe/BuildTool" compile-project.hxml -D "EngineDir=C:\ue4\UE_4.22\Engine" -D "ProjectDir=C:\Users\AMD\unreal\StealthGame\" -D "TargetName=StealthGameEditor" -D "TargetPlatform=Win64" -D "TargetConfiguration=Development" -D "TargetType=Editor" -D "ProjectFile=C:\Users\AMD\unreal\StealthGame\StealthGame.uproject" -D "PluginDir=C:\Users\AMD\unreal\StealthGame\Plugins\UnrealHx" -D UE_BUILD_CS -D "RootDir=C:\ue4\UE_4.22" 1>EXEC : error : Build failed: Cannot find property PluginDir 1>UnrealBuildTool : error : Error: Haxe compilation failed 1>UnrealBuildTool : error : Unable to instantiate module 'StealthGame': System.Exception: Haxe compilation failed 1> at HaxeModuleRules.callHaxe(ModuleRules rules, HaxeCompilationInfo info, HaxeConfigOptions options, Boolean throwOnError, String command) in c:\Users\AMD\unreal\StealthGame\Plugins\UnrealHx\Source\HaxeInit\BuildApi.Build.cs:line 311 1> at HaxeModuleRules.setupHaxeTarget(ModuleRules rules, Boolean forceHaxeCompilation, HaxeConfigOptions options) in c:\Users\AMD\unreal\StealthGame\Plugins\UnrealHx\Source\HaxeInit\BuildApi.Build.cs:line 241 1> at HaxeModuleRules.run() in c:\Users\AMD\unreal\StealthGame\Plugins\UnrealHx\Source\HaxeInit\BuildApi.Build.cs:line 142 1> at StealthGame..ctor(ReadOnlyTargetRules Target) in c:\Users\AMD\unreal\StealthGame\Source\StealthGame\StealthGame.Build.cs:line 7 1> (referenced via StealthGameEditor.Target.cs) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command "C:\ue4\UE_4.22\Engine\Build\BatchFiles\Build.bat StealthGameEditor Win64 Development -Project="C:\Users\AMD\unreal\StealthGame\StealthGame.uproject" -WaitMutex -FromMsBuild" exited with code 5. Please verify that you have sufficient rights to run this command. 1>Done building project "StealthGame.vcxproj" -- FAILED. 1> 1>Project Performance Summary: 1> 1179 ms C:\Users\AMD\unreal\StealthGame\Intermediate\ProjectFiles\StealthGame.vcxproj 1 calls

datee commented 5 years ago

It seems to be support for 4.22 in the development branch now, and generated externs also exist. But im getting the same issue even with the latest commits too. Maybe @waneck is still working on the 4.22 support and its not ready yet?

datee commented 5 years ago

Actually i was mistaken - the current error seems to be:

1>------ Build started: Project: Hx422_test1, Configuration: Development_Editor x64 ------ 1>Creating makefile for Hx422_test1Editor (no existing makefile) 1>UnrealBuildTool : warning : Could not find any code project with name Hx422_test1 1>UnrealBuildTool : warning : Could not find any code project 1>BuildApi.Build.cs: Using Haxe 1>Calling Haxe 1>Calling the build tool with arguments --cwd "D:\work\unreal\projects\Hx422_test1\Plugins\UnrealHx/Haxe/BuildTool" compile-project.hxml -D "EngineDir=C:\UnrealEngine\Engines\UE_4.22\Engine" -D "ProjectDir=D:\work\unreal\projects\Hx422_test1\" -D "TargetName=Hx422_test1Editor" -D "TargetPlatform=Win64" -D "TargetConfiguration=Development" -D "TargetType=Editor" -D "ProjectFile=D:\work\unreal\projects\Hx422_test1\Hx422_test1.uproject" -D "PluginDir=D:\work\unreal\projects\Hx422_test1\Plugins\UnrealHx" -D "RootDir=C:\UnrealEngine\Engines\UE_4.22" -D UE_BUILD_CS 1>EXEC : error : Build failed: Cannot find property ProjectFile 1>UnrealBuildTool : error : Error: Haxe compilation failed 1>UnrealBuildTool : error : Unable to instantiate module 'Hx422_test1': System.Exception: Haxe compilation failed 1> at HaxeModuleRules.callHaxe(ModuleRules rules, HaxeCompilationInfo info, HaxeConfigOptions options, Boolean throwOnError, String command) in d:\work\unreal\projects\Hx422_test1\Plugins\UnrealHx\Source\HaxeInit\BuildApi.Build.cs:line 366 1> at HaxeModuleRules.setupHaxeTarget(ModuleRules rules, Boolean forceHaxeCompilation, HaxeConfigOptions options) in d:\work\unreal\projects\Hx422_test1\Plugins\UnrealHx\Source\HaxeInit\BuildApi.Build.cs:line 289 1> at HaxeModuleRules.run() in d:\work\unreal\projects\Hx422_test1\Plugins\UnrealHx\Source\HaxeInit\BuildApi.Build.cs:line 174 1> at Hx422_test1..ctor(ReadOnlyTargetRules Target) in d:\work\unreal\projects\Hx422_test1\Source\Hx422_test1\Hx422_test1.Build.cs:line 7 1> (referenced via Hx422_test1Editor.Target.cs) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command "C:\UnrealEngine\Engines\UE_4.22\Engine\Build\BatchFiles\Build.bat Hx422_test1Editor Win64 Development -Project="D:\work\unreal\projects\Hx422_test1\Hx422_test1.uproject" -WaitMutex -FromMsBuild" exited with code 5. Please verify that you have sufficient rights to run this command. 1>Done building project "Hx422_test1.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Lets hope for a fix to this :)

StatiS commented 5 years ago

Same issue here, still no news on 4.22 support??

StatiS commented 5 years ago

I also get the same error trying to compile with ue4 4.21.2... Also tried with older versions of hxcpp with same results.

@datee Are you able to build succesfully on any ue version currently? I can't.

waneck commented 5 years ago

Hey guys! Could you please test now? I just submitted a fix, https://github.com/proletariatgames/unreal.hx/commit/f3a097e27e16ea6f6004ca87dc746e818a7be5dd , which I believe should fix it

datee commented 5 years ago

Hi!

I gave it a quick try with the latest commit - clean c++ 4.22 project from the epic launcher, windows 10, Haxe 4 rc2.

Same error:

1>------ Build started: Project: HX4_test4, Configuration: Development_Editor x64 ------ 1>Creating makefile for HX4_test4Editor (no existing makefile) 1>UnrealBuildTool : warning : Could not find any code project with name HX4_test4 1>UnrealBuildTool : warning : Could not find any code project 1>BuildApi.Build.cs: Using Haxe 1>Calling Haxe 1>Calling the build tool with arguments --cwd "D:\work\unreal\projects\HX4_test4\Plugins\UnrealHx/Haxe/BuildTool" compile-project.hxml -D "EngineDir=C:\UnrealEngine\Engines\UE_4.22\Engine" -D "ProjectDir=D:\work\unreal\projects\HX4_test4\" -D "TargetName=HX4_test4Editor" -D "TargetPlatform=Win64" -D "TargetConfiguration=Development" -D "TargetType=Editor" -D "ProjectFile=D:\work\unreal\projects\HX4_test4\HX4_test4.uproject" -D "PluginDir=D:\work\unreal\projects\HX4_test4\Plugins\UnrealHx" -D "RootDir=C:\UnrealEngine\Engines\UE_4.22" -D UE_BUILD_CS 1>EXEC : error : Build failed: Cannot find property ProjectFile 1>UnrealBuildTool : error : Error: Haxe compilation failed 1>UnrealBuildTool : error : Unable to instantiate module 'HX4_test4': System.Exception: Haxe compilation failed 1> at HaxeModuleRules.callHaxe(ModuleRules rules, HaxeCompilationInfo info, HaxeConfigOptions options, Boolean throwOnError, String command) in d:\work\unreal\projects\HX4_test4\Plugins\UnrealHx\Source\HaxeInit\BuildApi.Build.cs:line 366 1> at HaxeModuleRules.setupHaxeTarget(ModuleRules rules, Boolean forceHaxeCompilation, HaxeConfigOptions options) in d:\work\unreal\projects\HX4_test4\Plugins\UnrealHx\Source\HaxeInit\BuildApi.Build.cs:line 289 1> at HaxeModuleRules.run() in d:\work\unreal\projects\HX4_test4\Plugins\UnrealHx\Source\HaxeInit\BuildApi.Build.cs:line 174 1> at HX4_test4..ctor(ReadOnlyTargetRules Target) in d:\work\unreal\projects\HX4_test4\Source\HX4_test4\HX4_test4.Build.cs:line 7 1> (referenced via HX4_test4Editor.Target.cs) 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command "C:\UnrealEngine\Engines\UE_4.22\Engine\Build\BatchFiles\Build.bat HX4_test4Editor Win64 Development -Project="D:\work\unreal\projects\HX4_test4\HX4_test4.uproject" -WaitMutex -FromMsBuild" exited with code 5. Please verify that you have sufficient rights to run this command. 1>Done building project "HX4_test4.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

datee commented 5 years ago

Tried it more on several computers - all still with the same issue .. UnrealBuildTool gives errors with 4.22. (Works fine on 4.21 though)

waneck commented 5 years ago

Thanks for trying it! Could you give me more information on what error do you see? I believe that Build failed: Cannot find property ProjectFile should be fixed now

StatiS commented 5 years ago

Trying things out at the moment, attempting to build on a fresh c++ 4.22.3 project, with the latest commits, still gives the same error for me as well:

1>Calling the build tool with arguments --cwd "C:\Users\jb2709\Documents\UnrealProjects\UnrealHx422\Plugins\unreal.hx-development/Haxe/BuildTool" compile-project.hxml  -D "EngineDir=C:\Games\UnrealEngine\UE_4.22\Engine"  -D "ProjectDir=C:\Users\jb2709\Documents\UnrealProjects\UnrealHx422\"  -D "TargetName=UnrealHx422Editor"  -D "TargetPlatform=Win64"  -D "TargetConfiguration=Development"  -D "TargetType=Editor"  -D "ProjectFile=C:\Users\jb2709\Documents\UnrealProjects\UnrealHx422\UnrealHx422.uproject"  -D "PluginDir=C:\Users\jb2709\Documents\UnrealProjects\UnrealHx422\Plugins\unreal.hx-development"  -D "RootDir=C:\Games\UnrealEngine\UE_4.22" -D UE_BUILD_CS
1>EXEC : error : Build failed: Cannot find property ProjectFile
1>UnrealBuildTool : error : Error: Haxe compilation failed
1>UnrealBuildTool : error : Unable to instantiate module 'UnrealHx422': System.Exception: Haxe compilation failed
1>                           at HaxeModuleRules.callHaxe(ModuleRules rules, HaxeCompilationInfo info, HaxeConfigOptions options, Boolean throwOnError, String command) in c:\Users\jb2709\Documents\UnrealProjects\UnrealHx422\Plugins\unreal.hx-development\Source\HaxeInit\BuildApi.Build.cs:line 366
1>                           at HaxeModuleRules.setupHaxeTarget(ModuleRules rules, Boolean forceHaxeCompilation, HaxeConfigOptions options) in c:\Users\jb2709\Documents\UnrealProjects\UnrealHx422\Plugins\unreal.hx-development\Source\HaxeInit\BuildApi.Build.cs:line 289
1>                           at HaxeModuleRules.run() in c:\Users\jb2709\Documents\UnrealProjects\UnrealHx422\Plugins\unreal.hx-development\Source\HaxeInit\BuildApi.Build.cs:line 174
1>                           at UnrealHx422..ctor(ReadOnlyTargetRules Target) in c:\Users\jb2709\Documents\UnrealProjects\UnrealHx422\Source\UnrealHx422\UnrealHx422.Build.cs:line 7
1>                        (referenced via UnrealHx422Editor.Target.cs)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command "C:\Games\UnrealEngine\UE_4.22\Engine\Build\BatchFiles\Build.bat UnrealHx422Editor Win64 Development -Project="C:\Users\jb2709\Documents\UnrealProjects\UnrealHx422\UnrealHx422.uproject" -WaitMutex -FromMsBuild" exited with code 5. Please verify that you have sufficient rights to run this command.
1>Done building project "UnrealHx422.vcxproj" -- FAILED.

Before these latest commits, I was getting the same error even when using version 4.21.2, but with the latest commits, I don't anymore.

Also Im using win10, Haxe 4 rc2, hxcpp 4.0.8

datee commented 5 years ago

Yup, same here. I guess the "Build failed: Cannot find property ProjectFile" error is still present even after the fix then.

waneck commented 5 years ago

Sorry guys, I realized that our perforce automatic syncs isn't working so that's why the change isn't in the git repo. I'm looking into solving this ASAP and I'll let you know as soon as I do

Le jeu. 27 juin 2019 à 11:34, Datee notifications@github.com a écrit :

Yup, same here. I guess the "Build failed: Cannot find property ProjectFile" error is still present even after the fix then.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/proletariatgames/unreal.hx/issues/126?email_source=notifications&email_token=AABLP6ZKJ2CSLRCRSMSYWODP4TFX3A5CNFSM4HJTPAO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYXKCPY#issuecomment-506372415, or mute the thread https://github.com/notifications/unsubscribe-auth/AABLP64WW3UFKUD5OLP3ASTP4TFX3ANCNFSM4HJTPAOQ .

datee commented 5 years ago

Great!! Now its working to compile and start a 4.22 project!

Some things i noticed in testing:

The initial build fails: 1>Building 4 actions with 16 processes... 1> [1/4] Unreal.Win-Dev-Editor.uhxglue.cpp 1>D:/work/unreal/projects/HX4_test4/Intermediate/Haxe/HX4_test4-Win-Development-Editor/Generated/Private/uhx/glues/FTextImpl_Glue.cpp(40): error C2039: 'AsHourMinuteTimespan': is not a member of 'FText' 1> c:\unrealengine\engines\ue_4.22\engine\source\runtime\core\public\Internationalization/Text.h(325): note: see declaration of 'FText' 1>D:/work/unreal/projects/HX4_test4/Intermediate/Haxe/HX4_test4-Win-Development-Editor/Generated/Private/uhx/glues/FTextImpl_Glue.cpp(40): error C2664: 'unreal::VariantPtr uhx::glues::FTextImpl_Glue_obj::AsHourMinuteTimespan(unreal::VariantPtr,unreal::VariantPtr)': cannot convert argument 1 from 'T' to 'unreal::VariantPtr' 1> with 1> [ 1> T=FTimespan 1> ] 1> D:/work/unreal/projects/HX4_test4/Intermediate/Haxe/HX4_test4-Win-Development-Editor/Generated/Private/uhx/glues/FTextImpl_Glue.cpp(40): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command "C:\UnrealEngine\Engines\UE_4.22\Engine\Build\BatchFiles\Build.bat HX4_test4Editor Win64 Development -Project="D:\work\unreal\projects\HX4_test4\HX4_test4.uproject" -WaitMutex -FromMsBuild" exited with code 5. Please verify that you have sufficient rights to run this command. 1>Done building project "HX4_test4.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Removing AsHourMinuteTimespan from FText_Impl and FText fixes the problem and the project compiles. Are you getting the same error?

And.. ... I get this warning always when compiling .. however the project does compile and run... What is the reason for this? This was also present before the fix.

1>------ Build started: Project: HxTest17, Configuration: Development_Editor x64 ------ 1>Creating makefile for HxTest17Editor (.uproject file is newer) 1>UnrealBuildTool : warning : Could not find any code project with name HxTest17 1>UnrealBuildTool : warning : Could not find any code project

StatiS commented 5 years ago

Thanks for the fix waneck! 😄

Also, seconding datee here, I ran into the same issue with AsHourMinuteTimespan and am getting the same UnrealBuildTool warning.

datee commented 5 years ago

Should this issue be re-opened? As is now the 4.22 build is failing with a standard project without fixing it... I can do a pull request with the fixes maybe

waneck commented 5 years ago

Sure. Sorry about that. I'll prioritize the issues here to look into them later this week