Open gilmarsquinelato opened 6 years ago
I think this happens because your haxe installation must be adding its PATH environment variable through maybe .bashrc or something similar, so when running a GUI application, it won't find Haxe. You can check if that's the issue by trying to call build from the command-line (console), like so:
haxe -version # just check if haxe is in the PATH
/path/to/UnrealEngine/Engine/Build/BatchFiles/Mac/Build.sh MyProjectEditor Mac Development -project="/Users/gilmar/Documents/Unreal Projects/MyProject/MyProject.uproject"
I'm not sure what's the best way to fix this in Mac.
On terminal it's working, not works only on Editor.
Okay, so it's really this issue. It's been some time since I've used a Mac, so I'm not sure what would be the 'proper' solution for this. I'm leaning towards making the burden on the user to add the Haxe path to the global path configuration. You can tell where it is installed by running
which haxe
I'm not sure where brew installs it anymore, but I'm guessing it's installed through brew
Once you have found the path, it seems that you can set it by editing /etc/paths
I checked haxe path. I installed it with the .pkg provided by haxe.org, and it's located at /usr/local/bin/haxe.
try echo "/usr/local/bin" | sudo tee /etc/paths.d/haxe
Note that you'll probably need to reboot your pc to see if that worked
Oh it seems that this only works for shells, not for GUI applications: https://emacs.stackexchange.com/questions/18017/why-exec-path-doesnt-contain-usr-local-bin-while-etc-paths-already-contains-i . It seems some launchd config is needed. I found this https://apple.stackexchange.com/questions/51677/how-to-set-path-for-finder-launched-applications that may help you
Unfortunately didn't work. Rebooted Mac, and the last approach too.
Alright. Another try - it seems homebrew has a FAQ with exactly this problem outlined: https://docs.brew.sh/FAQ
My Mac .apps don’t find /usr/local/bin utilities!
GUI apps on macOS don’t have /usr/local/bin in their PATH by default. If you’re on Mountain Lion or later, you can fix this by running sudo launchctl config user path "/usr/local/bin:$PATH" and then rebooting, as documented in man launchctl. Note that this sets the launchctl PATH for all users. For earlier versions of macOS, see this page.
Could you try this?
Yeah! It's worked!!! Could be a tip on the wiki for MacOS users 😀 Because this plugin runs a tool outside Unreal, and with this tip could help a lot of people too.
Thanks a lot!
Right. I'll add this to do the todo list ;)
When I try to compile the source on Editor it's causing an error. Investigating I found that the error is occurring on BuildApi.Build.cs, when it calls the haxe command. When the code calls the haxe command, it's calling from mono, and mono doesn't recognize the bin path to call.
ERROR: Unable to instantiate module 'MyProject': System.ComponentModel.Win32Exception: ApplicationName='haxe', CommandLine='--cwd "/Users/gilmar/Documents/Unreal Projects/MyProject/Plugins/UnrealHx/Haxe/BuildTool" compile-project.hxml -D "EngineDir=/Users/Shared/Epic Games/UE_4.19/Engine" -D "ProjectDir=/Users/gilmar/Documents/Unreal Projects/MyProject" -D "TargetName=MyProjectEditor" -D "TargetPlatform=Mac" -D "TargetConfiguration=Development" -D "TargetType=Editor" -D "ProjectFile=/Users/gilmar/Documents/Unreal Projects/MyProject/MyProject.uproject" -D "PluginDir=/Users/gilmar/Documents/Unreal Projects/MyProject/Plugins/UnrealHx" -D UE_BUILD_CS', CurrentDirectory='', Native error= Cannot find the specified file at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in:0
at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in :0
at System.Diagnostics.Process.Start () [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start ()
at HaxeModuleRules.callHaxe (UnrealBuildTool.ModuleRules rules, HaxeCompilationInfo info, HaxeConfigOptions options) [0x00000] in :0
at HaxeModuleRules.setupHaxeTarget (UnrealBuildTool.ModuleRules rules, Boolean forceHaxeCompilation, HaxeConfigOptions options) [0x00000] in :0
at HaxeModuleRules.run () [0x00000] in :0
at BaseModuleRules..ctor (UnrealBuildTool.ReadOnlyTargetRules target) [0x00000] in :0
at HaxeModuleRules..ctor (UnrealBuildTool.ReadOnlyTargetRules target) [0x00000] in :0
at MyProject..ctor (UnrealBuildTool.ReadOnlyTargetRules Target) [0x00000] in :0
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in :0
(referenced via MyProject.Target.cs)