Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when building for Android #2452

Closed
vinothkumarc2805 opened this issue Apr 20, 2023 · 17 comments · Fixed by #2685
Closed

Errors when building for Android #2452

vinothkumarc2805 opened this issue Apr 20, 2023 · 17 comments · Fixed by #2685
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue

Comments

@vinothkumarc2805
Copy link

Describe the issue

While creating the AWS SDK C++ for Android as per the AWS SDK C++ documentation, I am getting the following error.

vinoth@vinoth-HP-245-G7-Notebook-PC:~/sdk_build$ cmake ../aws-sdk-cpp -DNDK_DIR="/home/vinoth/Android/Sdk/ndk/21.3.6528147/" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DCUSTOM_MEMORY_MANAGEMENT=ON -DTARGET_ARCH=ANDROID -DANDROID_NATIVE_API_LEVEL=21 -DCMAKE_PREFIX_PATH="/usr/local" -DLEGACY_MODE=OFF
CMake Warning at CMakeLists.txt:9 (message):
In 1.11 releases, we are releasing experimental alternative building
mode.By setting -DLEGACY_MODE=OFF you can test our advances in modern CMake
building and provide early feedback. The legacy support is set by default
in 1.11, when you complete build updating scripts please update the build
flags as mentioned in README.md and set -DLEGACY_BUILD=OFF. The legacy
support will be removed at 1.12.0 release.

CMake Deprecation Warning at CMakeLists.txt:17 (cmake_policy):
The OLD behavior for policy CMP0077 will be removed from a future version
of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.

-- Building AWS libraries as static objects
-- Android ABI: none specified, defaulting to armeabi-v7a
-- Android toolchain unspecified, defaulting to clang
-- Android std lib: c++_shared
-- Android API level: 21
-- Building project version: 1.11.62
-- Building Zlib as part of AWS SDK
-- Encryption: LibCrypto
-- Building Openssl as part of AWS SDK
-- Http client: Curl
-- Building Curl as part of AWS SDK
CMake Error: The source directory "/home/vinoth/aws-sdk-cpp/android-build" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
CMake Error at cmake/build_external.cmake:139 (message):
Failed to configure dependency libraries.
Call Stack (most recent call first):
CMakeLists.txt:198 (include)

-- Configuring incomplete, errors occurred!

Links

https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/setup-linux.html

@vinothkumarc2805 vinothkumarc2805 added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Apr 20, 2023
@jmklix
Copy link
Member

jmklix commented Apr 20, 2023

Can you confirm that this dir does exist and that you are running the cmake commands with the proper permissions to access this folder:

/home/vinoth/aws-sdk-cpp/android-build

This error:

CMake Error: The source directory "/home/vinoth/aws-sdk-cpp/android-build" does not exist.

points to something being wrong with this folder. You shouldn't need admin/sudo access to the folder but it could be blocked by that.

@jmklix jmklix added bug This issue is a bug. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. p2 This is a standard priority issue and removed documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Apr 20, 2023
@github-actions
Copy link

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Apr 23, 2023
@vinothkumarc2805
Copy link
Author

The problem is the non existence of "android-build" folder inside the "aws-sdk-cpp" folder. i feel this suppose to be present in the aws-sdk-cpp in the latest code (main branch). However, When i refer the branch "version1.9", the "android-build" folder exists. Please recommend which branch to be used to create Andorid build.

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. labels Apr 24, 2023
@ankurthegamedev
Copy link

We are also facing the same issue sdk compiling fine for win and linux.But for android we are helples.

-- Building Curl as part of AWS SDK
CMake Error: The source directory "/home//AWS/aws-sdk-cpp/android-build" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
CMake Error at cmake/build_external.cmake:139 (message):
Failed to configure dependency libraries.
Call Stack (most recent call first):
CMakeLists.txt:198 (include)

@yasminetalby
Copy link
Contributor

Hello @vinothkumarc2805 and @ankurgamedev ,

Thank you very much for your submissions and collaboration.
I sincerely apologize for the delay of answer.
There has been a restructuring of File Hierarchy of the project source code in v1.11.0 (see).
As mentioned by @vinothkumarc2805 aws-sdk-cpp/android-build does exist in version prior to this change.
I have created a backlog item to fix the issue you are currently experiencing.

In the meantime, are you able to work around this by using previous versions of the SDK?

Thank you once again for your time and for reporting this issue.

Sincerely,

Yasmine.

@ankurthegamedev
Copy link

Yes sdk 1.8 is compiling fine. But as a game project we have four build targets Win64 linux ios and android and want to stick with same latest sdk version.
So a blog post or some sort of guide on how to update script and cmake files can be helpful for us.

@yasminetalby yasminetalby self-assigned this May 24, 2023
@yasminetalby
Copy link
Contributor

Thank you very much for your feedback @ankurgamedev!
This makes sense. I will post an update here as soon as this issue is resolved.
We really appreciate you reaching out and bringing this issue to our attention.

Sincerely,

Yasmine.

@ankurthegamedev
Copy link

ankurthegamedev commented May 30, 2023

### If you want build latest sdk for android change below files and it will compile successfully.Tested and Working.

  • IN ..\aws-sdk-cpp\cmake\build_external.cmake ->** change* ${CMAKE_CURRENT_SOURCE_DIR}/android-build change it to ${CMAKE_CURRENT_SOURCE_DIR}/tools/android-build**

  • IN ..\aws-sdk-cpp\cmake\build_external.cmake ->remove extra -- before -j ${NUM_JOBS} it fixes the problem.***

  • IN ..\aws-sdk-cpp\tools\android-build\configure_openssl_cmake.py ——> change sourceDir = os.path.join(baseDir, "android-build", "cmakefiles", "openssl-cmake") to sourceDir = os.path.join(baseDir,”tools”,"android-build", "cmakefiles", "openssl-cmake")

  • IN ..\aws-sdk-cpp\tools\android-build\CMakeLists.txt -> CHANGE python ${AWS_NATIVE_SDK_ROOT}/android-build/configure_openssl_cmake.py to python ${AWS_NATIVE_SDK_ROOT}/tools/android-build/configure_openssl_cmake.py**

  • IN ..\aws-sdk-cpp\tools\android-build\CMakeLists.txt -> Change ${AWS_NATIVE_SDK_ROOT}/android-build/CurlAndroidCrossCompile.cmake to C ${AWS_NATIVE_SDK_ROOT}/tools/android-build/CurlAndroidCrossCompile.cmake**

Thanks

@protsenko85
Copy link

protsenko85 commented Jun 9, 2023

### If you want build latest sdk for android change below files and it will compile successfully.Tested and Working.

  • IN ..\aws-sdk-cpp\cmake\build_external.cmake ->** change* ${CMAKE_CURRENT_SOURCE_DIR}/android-build change it to ${CMAKE_CURRENT_SOURCE_DIR}/tools/android-build**
  • IN ..\aws-sdk-cpp\cmake\build_external.cmake ->remove extra -- before -j ${NUM_JOBS} it fixes the problem.***
  • IN ..\aws-sdk-cpp\tools\android-build\configure_openssl_cmake.py ——> change sourceDir = os.path.join(baseDir, "android-build", "cmakefiles", "openssl-cmake") to sourceDir = os.path.join(baseDir,”tools”,"android-build", "cmakefiles", "openssl-cmake")
  • IN ..\aws-sdk-cpp\tools\android-build\CMakeLists.txt -> CHANGE python ${AWS_NATIVE_SDK_ROOT}/android-build/configure_openssl_cmake.py to python ${AWS_NATIVE_SDK_ROOT}/tools/android-build/configure_openssl_cmake.py**
  • IN ..\aws-sdk-cpp\tools\android-build\CMakeLists.txt -> Change ${AWS_NATIVE_SDK_ROOT}/android-build/CurlAndroidCrossCompile.cmake to C ${AWS_NATIVE_SDK_ROOT}/tools/android-build/CurlAndroidCrossCompile.cmake**

Thanks

After using this fix i got a problem with OpelSSL
`FAILED: CMakeFiles/install.util
cmd.exe /C "cd /D C:_Projects\test_proj\build_sdk_android\external-build\ZLIB-prefix\src\ZLIB-build && "C:\Program Files\CMake\bin\cmake.exe" -P cmake_install.cmake"
ninja: build stopped: subcommand failed.
[3/16] Performing patch step for 'OPENSSL'
FAILED: OPENSSL-prefix/src/OPENSSL-stamp/OPENSSL-patch C:/_Projects/test_proj/build_sdk_android/external-build/OPENSSL-prefix/src/OPENSSL-stamp/OPENSSL-patch
cmd.exe /C "cd /D C:_Projects\test_proj\build_sdk_android\openssl-src && cd C:/_Projects/test_proj/build_sdk_android/external-build && python C:/_Projects/test_proj/aws-sdk-cpp/tools/android-build/configure_openssl_cmake.py --source C:/_Projects/test_proj/aws-sdk-cpp --dest C:/_Projects/test_proj/build_sdk_android/openssl-src && "C:\Program Files\CMake\bin\cmake.exe" -E touch C:/_Projects/test_proj/build_sdk_android/external-build/OPENSSL-prefix/src/OPENSSL-stamp/OPENSSL-patch"
Python
ninja: build stopped: subcommand failed.
CMake Error at cmake/build_external.cmake:148 (message):
Failed to build dependency libraries.
Call Stack (most recent call first):
CMakeLists.txt:198 (include)

-- Configuring incomplete, errors occurred!`

Do you know what could be the possible causes and solutions?

@ankurthegamedev
Copy link

Please provide cmake command you are using to build??

@protsenko85
Copy link

@ankurgamedev here it is
cmake ../aws-sdk-cpp -DNDK_DIR="C:\Users\prots\AppData\Local\Android\Sdk\ndk\21.4.7075529" -DBUILD_SHARED_LIBS=OFF -GNinja -DENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DCUSTOM_MEMORY_MANAGEMENT=ON -DTARGET_ARCH=ANDROID -DANDROID_NATIVE_API_LEVEL=21 -DBUILD_ONLY="identity-management;s3"

@ankurthegamedev
Copy link

Try -G "Ninja" instead of -GNinja and cmake version 3.21.6 installed because as far as I know sdk has issues with latest cmake

@protsenko85
Copy link

I have install cmake version 3.21.6 and changed cmake command to cmake ../aws-sdk-cpp -DNDK_DIR="C:\Users\prots\AppData\Local\Android\Sdk\ndk\21.4.7075529" -DBUILD_SHARED_LIBS=OFF -G "Ninja" -DENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DCUSTOM_MEMORY_MANAGEMENT=ON -DTARGET_ARCH=ANDROID -DANDROID_NATIVE_API_LEVEL=21 -DBUILD_ONLY="identity-management;s3" -DCMAKE_INSTALL_PREFIX="C:\_Projects\test_proj\install_sdk_android"
Still having the same error

@ankurthegamedev
Copy link

Are you able to build for windows?? Have you installed visual studio llvm component for target cpu. Please share visual studio components installed?

@protsenko85
Copy link

Yes, i am able to build for windows, problems start with build for android
I just installed the Clang/LLVM component for VS, but it didn't change anything
VS installed components list:
"Microsoft.VisualStudio.Component.CoreEditor", "Microsoft.VisualStudio.Workload.CoreEditor", "Microsoft.VisualStudio.Component.NuGet", "Microsoft.Net.Component.4.6.1.TargetingPack", "Microsoft.VisualStudio.Component.Roslyn.Compiler", "Microsoft.VisualStudio.Component.Roslyn.LanguageServices", "Microsoft.VisualStudio.Component.FSharp", "Microsoft.ComponentGroup.ClickOnce.Publish", "Microsoft.NetCore.Component.DevelopmentTools", "Microsoft.VisualStudio.Component.FSharp.WebTemplates", "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions", "Microsoft.VisualStudio.Component.DockerTools", "Microsoft.NetCore.Component.Web", "Microsoft.Net.Component.4.8.SDK", "Microsoft.Net.Component.4.7.2.TargetingPack", "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites", "Microsoft.VisualStudio.Component.TypeScript.4.3", "Microsoft.VisualStudio.Component.JavaScript.TypeScript", "Microsoft.VisualStudio.Component.JavaScript.Diagnostics", "Microsoft.Component.MSBuild", "Microsoft.VisualStudio.Component.TextTemplating", "Component.Microsoft.VisualStudio.RazorExtension", "Microsoft.VisualStudio.Component.IISExpress", "Microsoft.VisualStudio.Component.SQL.ADAL", "Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime", "Microsoft.VisualStudio.Component.Common.Azure.Tools", "Microsoft.VisualStudio.Component.SQL.CLR", "Microsoft.VisualStudio.Component.MSODBC.SQL", "Microsoft.VisualStudio.Component.MSSQL.CMDLnUtils", "Microsoft.VisualStudio.Component.ManagedDesktop.Core", "Microsoft.Net.Component.4.5.2.TargetingPack", "Microsoft.Net.Component.4.5.TargetingPack", "Microsoft.VisualStudio.Component.SQL.SSDT", "Microsoft.VisualStudio.Component.SQL.DataSources", "Component.Microsoft.Web.LibraryManager", "Component.Microsoft.WebTools.BrowserLink.WebLivePreview", "Microsoft.VisualStudio.ComponentGroup.Web", "Microsoft.VisualStudio.Component.Web", "Microsoft.VisualStudio.ComponentGroup.Web.Client", "Microsoft.Net.Component.4.TargetingPack", "Microsoft.Net.Component.4.5.1.TargetingPack", "Microsoft.Net.Component.4.6.TargetingPack", "Microsoft.Net.ComponentGroup.TargetingPacks.Common", "Component.Microsoft.VisualStudio.Web.AzureFunctions", "Microsoft.VisualStudio.ComponentGroup.AzureFunctions", "Microsoft.VisualStudio.Component.Azure.Compute.Emulator", "Microsoft.VisualStudio.Component.Azure.Storage.Emulator", "Microsoft.VisualStudio.Component.Azure.ClientLibs", "Microsoft.VisualStudio.Component.Azure.AuthoringTools", "Microsoft.VisualStudio.Component.CloudExplorer", "Microsoft.VisualStudio.ComponentGroup.Web.CloudTools", "Microsoft.VisualStudio.Component.DiagnosticTools", "Microsoft.VisualStudio.Component.EntityFramework", "Microsoft.VisualStudio.Component.AspNet45", "Microsoft.VisualStudio.Component.AppInsights.Tools", "Microsoft.VisualStudio.Component.WebDeploy", "Microsoft.VisualStudio.Component.Debugger.JustInTime", "Component.Microsoft.VisualStudio.LiveShare", "Microsoft.VisualStudio.Component.WslDebugging", "Microsoft.VisualStudio.Component.IntelliCode", "Microsoft.NetCore.Component.Runtime.3.1", "Microsoft.NetCore.Component.Runtime.5.0", "Microsoft.NetCore.Component.SDK", "Microsoft.VisualStudio.Workload.NetWeb", "Microsoft.VisualStudio.Component.VC.CoreIde", "Microsoft.VisualStudio.Component.Windows10SDK", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", "Microsoft.VisualStudio.Component.Graphics.Tools", "Microsoft.VisualStudio.Component.VC.DiagnosticTools", "Microsoft.VisualStudio.Component.Windows10SDK.19041", "Microsoft.ComponentGroup.Blend", "Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging", "Microsoft.VisualStudio.Component.VC.Redist.14.Latest", "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", "Microsoft.VisualStudio.Component.VC.Tools.ARM64", "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake", "Microsoft.VisualStudio.Component.VC.CMake.Project", "Microsoft.VisualStudio.Component.VC.ATL", "Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest", "Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest", "Microsoft.VisualStudio.Component.VC.CLI.Support", "Microsoft.VisualStudio.Component.VC.ASAN", "Microsoft.VisualStudio.Component.VC.Modules.x86.x64", "Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset", "Microsoft.VisualStudio.Component.VC.Llvm.Clang", "Component.IncredibuildMenu", "Component.Incredibuild", "Microsoft.VisualStudio.Component.Windows11SDK.22000", "Microsoft.VisualStudio.Component.Windows10SDK.18362", "Microsoft.VisualStudio.Workload.NativeDesktop", "Microsoft.Component.NetFX.Native", "Microsoft.VisualStudio.ComponentGroup.UWP.NetCoreAndStandard", "Microsoft.VisualStudio.Component.Graphics", "Microsoft.VisualStudio.ComponentGroup.UWP.Xamarin", "Microsoft.VisualStudio.ComponentGroup.UWP.Support", "Microsoft.VisualStudio.Component.UWP.VC.ARM64", "Microsoft.VisualStudio.Component.VC.Tools.ARM64EC", "Microsoft.VisualStudio.Component.UWP.VC.ARM64EC", "Microsoft.VisualStudio.Workload.Universal", "Component.OpenJDK", "Component.Android.SDK25.Private", "Component.Android.NDK.R16B", "Component.Ant", "Component.MDD.Android", "Microsoft.VisualStudio.Workload.NativeMobile", "Microsoft.VisualStudio.Workload.NativeGame", "Microsoft.VisualStudio.Component.VC.14.29.16.10.ARM", "Microsoft.VisualStudio.Component.VC.14.29.16.10.ARM.Spectre"

When i'm trying to build with VS 2019 - error is different:
CLANGCOMPILE : error : unknown target CPU 'armv7-a' [C:\_Projects\test_proj\build_sdk_android\CMakeFiles\CMakeTmp\cmTC_98aa9.vcxproj]

When compile with Ninja error is still with OpenSSL

@qiantanjingtao
Copy link

### If you want build latest sdk for android change below files and it will compile successfully.Tested and Working.

  • IN ..\aws-sdk-cpp\cmake\build_external.cmake ->** change* ${CMAKE_CURRENT_SOURCE_DIR}/android-build change it to ${CMAKE_CURRENT_SOURCE_DIR}/tools/android-build**
  • IN ..\aws-sdk-cpp\cmake\build_external.cmake ->remove extra -- before -j ${NUM_JOBS} it fixes the problem.***
  • IN ..\aws-sdk-cpp\tools\android-build\configure_openssl_cmake.py ——> change sourceDir = os.path.join(baseDir, "android-build", "cmakefiles", "openssl-cmake") to sourceDir = os.path.join(baseDir,”tools”,"android-build", "cmakefiles", "openssl-cmake")
  • IN ..\aws-sdk-cpp\tools\android-build\CMakeLists.txt -> CHANGE python ${AWS_NATIVE_SDK_ROOT}/android-build/configure_openssl_cmake.py to python ${AWS_NATIVE_SDK_ROOT}/tools/android-build/configure_openssl_cmake.py**
  • IN ..\aws-sdk-cpp\tools\android-build\CMakeLists.txt -> Change ${AWS_NATIVE_SDK_ROOT}/android-build/CurlAndroidCrossCompile.cmake to C ${AWS_NATIVE_SDK_ROOT}/tools/android-build/CurlAndroidCrossCompile.cmake**

Thanks

Maybe add one:
change cmake/build_external.cmake : line 21, as following:

set(ZLIB_INCLUDE_DIR ${ZLIB_INSTALL_DIR}/include CACHE INTERNAL "zlib include dir")

AMZN-Gene added a commit to aws-lumberyard-dev/o3de that referenced this issue Sep 20, 2023
Signed-off-by: AMZN-Gene <genewalt@amazon.com>
AMZN-Gene added a commit to aws-lumberyard-dev/o3de that referenced this issue Sep 20, 2023
Signed-off-by: AMZN-Gene <genewalt@amazon.com>
AMZN-Gene added a commit to aws-lumberyard-dev/3p-package-source that referenced this issue Sep 21, 2023
Signed-off-by: AMZN-Gene <genewalt@amazon.com>
SergeyRyabinin pushed a commit that referenced this issue Sep 26, 2023
Fixes #2452

In a previous [commit](de98602)
a bunch of directories were moved under /tools, including android-build.
At this time, scripts and CMake configurations were not updated, which
has caused build failures.
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

AMZN-Gene added a commit to o3de/3p-package-source that referenced this issue Nov 2, 2023
AWS C++ SDK upgrade from 1.9 to 1.11 in order to support GameLift 5.1.1
Leaving Android back at 1.9 due to a bug: [Errors when building for
Android · Issue #2452 · aws/aws-sdk-cpp
(github.com)](aws/aws-sdk-cpp#2452)

AWS MobileAnalytics no longer exists and was replaced by AWS Pinpoint.
Removing MobileAnalytics and can bring back AWS Pinpoint at a later date
if desired.

Pass AWSCore.Tests
Pass AWSClientAuth.Tests
Pass AWSGameLift.Client.Tests
Pass AWSGameLift.Server.Tests
Pass AWSMetrics.Tests

Deployed GameLift server on Windows and Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants