Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Powershell function to help setting up the Linux toolchain for UE4
function Install-LinuxToolChain {
Downloads and installs the UE4 linux toolchain components.
Downloads the clang compiler to $ToolChainDestination and creates a
system-wide environment variable pointing to it.
Afterwards you have to regenerate the UE4 engine project files and
rebuild the engine.
[string]$ToolChainDestination = "C:\UE-Toolchain\",
[string]$ToolChainURL = ""
if(!(Test-Path $ToolChainDestination))
Write-Verbose "Toolchain destination directory doesn't exist. Creating now..."
try {
[void](mkdir $ToolChainDestination)
catch {
Write-Error "Failed to create target folder (Error: " $_.Exception.Message ")"
$DestinationFilePath = Join-Path $ToolChainDestination $ToolChainURL.Split('/')[-1]
Write-Verbose ("Start download: [{0}]->[{1}]" -f $ToolChainURL,$DestinationFilePath)
Invoke-WebRequest $ToolChainURL -OutFile $DestinationFilePath
Write-Verbose ("Unpacking {0}" -f $DestinationFilePath)
try {
$shell = New-Object -ComObject Shell.Application
catch {
Write-Warning -Message "Unexpected Error. (Error: " $_.Exception.Message ")"
$ToolChain = Get-ChildItem -Path $ToolChainDestination -Recurse -Filter 'toolchain'
Write-Verbose ("Create environment variable: [{0}]->[{1}]" -f 'LINUX_ROOT',$ToolChain.FullName)
[Environment]::SetEnvironmentVariable('LINUX_ROOT', $ToolChain.FullName, 'Machine')
Get-Childitem $ToolChainDestination -filter *.zip | Remove-item -force
Install-LinuxToolChain -Verbose
Copy link

steve7411 commented Dec 1, 2016

Hey! I've updated this to work with the new v8 toolchain for 4.14, including the new environment variable and updating the LINUX_ROOT as well. If you're interested, my fork is here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment