adamrehn / conan-ue4cli

Integrate third-party libraries into the Unreal Engine with Conan
https://docs.adamrehn.com/conan-ue4cli/
MIT License
87 stars 20 forks source link

Unable to generate Conan profile on macOS #4

Closed McJones closed 4 years ago

McJones commented 4 years ago

I am currently on macOS (10.15.3) and the process fails when attempting to generate profile and packages using the ue4 conan generate command. It appears to not be creating a json file (or the file can't be read for whatever reason) from the build tool. I have downloaded a source checkout of UE4 engine and run the setup.sh to download the necessary files and set the root of ue4cli to the source code checkout. I have Unreal 4.24.3 installed locally and the latest (as of today) version of UE4 source checked code checked out from GitHub. Error message is below:

Using user-specified engine root: /Users/McJones/Development/UnrealEngine
Removing the "ue4" Conan profile if it already exists...
Removing any previous versions of profile base packages...
Creating "ue4" Conan profile using autodetected settings...
Installing profile base packages...
Retrieving thirdparty library list from UBT...
Traceback (most recent call last):
  File "/usr/local/bin/ue4", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/ue4cli/cli.py", line 216, in main
    SUPPORTED_COMMANDS[command]['action'](manager, args)
  File "/usr/local/lib/python3.7/site-packages/conan_ue4cli/main.py", line 34, in main
    SUBCOMMANDS[subcommand]['function'](manager, args[1:])
  File "/usr/local/lib/python3.7/site-packages/conan_ue4cli/generate.py", line 203, in generate
    libs = [lib for lib in manager.listThirdPartyLibs() if lib != 'libc++']
  File "/usr/local/lib/python3.7/site-packages/ue4cli/UnrealManagerBase.py", line 178, in listThirdPartyLibs
    return interrogator.list(self.getPlatformIdentifier(), configuration, self._getLibraryOverrides())
  File "/usr/local/lib/python3.7/site-packages/ue4cli/UE4BuildInterrogator.py", line 20, in list
    modules = self._getThirdPartyLibs(platformIdentifier, configuration)
  File "/usr/local/lib/python3.7/site-packages/ue4cli/UE4BuildInterrogator.py", line 162, in _getThirdPartyLibs
    result = json.loads(Utility.readFile(jsonFile))
  File "/usr/local/lib/python3.7/site-packages/ue4cli/Utility.py", line 30, in readFile
    with open(filename, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/9f/rlcq5h652zz3crvzzydl4v2h0000gp/T/tmpruulbau6/ubt_output.json'
adamrehn commented 4 years ago

I don't have access to a Mac to try and reproduce the issue, so I'll try to guide you through the steps to determine the cause. The first thing to check is whether UnrealBuildTool is producing the JSON file in the first place. If you run the command with the environment variable UE4CLI_VERBOSE set to 1, it should print out the underlying command that's being run:

# Run the command with verbose output enabled
UE4CLI_VERBOSE=1 ue4 conan generate

# The output should include a line that looks roughly like this:
# [UE4CLI] EXECUTE COMMAND: ['/path/to/Build.sh', 'UE4Editor', 'Win64', 'Development', '-Mode=JsonExport', '-OutputFile=/path/to/ubt_output.json']

Grab the command (removing the square brackets and comma separators) and try running it directly, but specify a non-temporary directory for the JSON output path (e.g. your Desktop directory, /Users/McJones/Desktop/ubt_output.json.) Does the JSON file get generated successfully? Is the generated file non-empty?

McJones commented 4 years ago

Ran the command in verbose mode and it turns out the UnrealBuildTool isn't even there. I checked this and there is no UnrealBuildTool in the Binaries/DotNet folder nor can I find it in any of the other binary folders. Output of the command below just in case:

Running system mono/msbuild, version: Mono JIT compiler version 6.6.0.155 (2019-08/296a9afdb24 Thu Nov 14 06:12:25 EST 2019)
Running command : Engine/Binaries/DotNET/UnrealBuildTool.exe UE4Editor Mac Development -Mode=JsonExport -OutputFile=/Users/McJones/Desktop/ubt_output.json
Cannot open assembly 'Engine/Binaries/DotNET/UnrealBuildTool.exe': No such file or directory.
McJones commented 4 years ago

Ok I built the UnrealBuildTool.exe myself from source, put it in the right spot and now it all appears to be working. Unsure why the setup didn't include the build tool by default, might just be a Mac thing. Thanks for your help.

adamrehn commented 4 years ago

Just a quick follow-up to this: in addressing ue4cli ussue #18 I realised that the behaviour of the Unreal Engine's build scripts varies slightly between Linux and Mac, and under Mac it's necessary to run GenerateProjectFiles.sh to ensure UnrealBuildTool is built. I've updated the README in commit 2dfdac3 to list project file generation as a necessary step.