Android build fails on packaging ETC1 from Linux

During builing Android ETC1 got exception

clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: UBT ERROR: Failed to produce item: /home/maxim/Documents/Unreal Projects/AndroidProject/Binaries/Android/AndroidProject-armv7-es2.so
Total build time: 2046,52 seconds (Local executor: 0,00 seconds)
Took 2047,101559s to run mono, ExitCode=5
ERROR: Command failed (Result:5): /home/maxim/workspace/UnrealEngine/Engine/Binaries/DotNET/UnrealBuildTool.exe AndroidProject Android Development -Project="/home/maxim/Documents/Unreal Projects/AndroidProject/AndroidProject.uproject" “/home/maxim/Documents/Unreal Projects/AndroidProject/AndroidProject.uproject” -NoUBTMakefiles -remoteini="/home/maxim/Documents/Unreal Projects/AndroidProject" -skipdeploy -noxge -NoHotReload -ignorejunk. See logfile for details: ‘UnrealBuildTool-2018.02.12-22.19.58.txt’
(see /home/maxim/Library/Logs/Unreal Engine/LocalBuildLogs/UAT_Log.txt for full exception trace)
AutomationTool exiting with ExitCode=5 (5)
[2018.02.12-20.54.06:525][997]UATHelper: Packaging (Android (ETC1)): RunUAT ERROR: AutomationTool was unable to run successfully.
[2018.02.12-20.54.06:525][997]PackagingResults: Error: Unknown Error

Attaching full log
UAT_log
and UnrealBuildTool-2018.02.12-22.19.58.txt

The same problem appears for another types of packaging. There are lots of
*** error: undefined reference to ***

Ubuntu 17.10
UE 4.18.3

Building everything by instructions of Epic Games - Android Quick Start | Unreal Engine Documentation

Anyone had similar problem?

Resoled this problem.

In general, solution is to rebuild UE4. After going through AndroidGettingStarted, did

make UE4Editor ARGS=-clean

and again ran Setup and Generate scripts. This time Android dependency was downloaded too. Before, it was excluding Android dependency. Ran make, accepted Android licenses and got working Android packaging.

Looks like ./GenerateProjectFiles.sh script checks if we have ANDROID_HOME or NDK_HOME environment variables and decide if we need Android dependency being downloaded and built.

Hope this helps.