[cmake-developers] CMAKE 3.7 (for Android target) error: crtbegin_dynamic.o:crtbrand.c:function _start: error: undefined reference to 'main’
Roberto Regalino
Roberto.Regalino at autodesk.com
Mon Nov 14 16:38:12 EST 2016
Hi,
Not sure if this is the place to ask my question but here we go:
I am trying to build C++ code targeting the Android platform. I already have the whole system setup to generate VisualStudio projects and it is using the Nsight Tegra plug-in.
I’ve been asked to update the CMake files so we can still target Android but not using VisualStudio in hope to migrate to AndroidStudio.
So far, I managed to create a new toolchain file containing the following:
set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)
set(CMAKE_ANDROID_API 21)
set(CMAKE_ANDROID_NDK $ENV{ANDROID_HOME})
set(CMAKE_ANDROID_SKIP_ANT_STEP 0)
set(CMAKE_ANDROID_JAVA_SOURCE_DIR java)
set(CMAKE_ANDROID_BUILD_SYSTEM GradleBuild)
With these settings, I can successfully compile the whole project source files but when I get to the link pass, it fails with the error:
C:/NVPACK/android-ndk-r10e/platforms/android-21/arch-arm/usr/lib/../lib\crtbegin_dynamic.o:crtbrand.c:function _start: error: undefined reference to 'main’
I believe that I am missing the equivalent steps that are taken care by the “Gradle Build” steps found in the VisualStudio project.
My understanding is that these Gradle steps are responsible for embedding the AndroidManifest (that, I’ve been told, will define the ‘main’) and generate the apk file from the so.
Is this indeed what I am missing? Also, can anyone confirm if CMake 3.7 does provide the equivalent steps or if I need to define them myself?
Thank you in advance
Regalir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20161114/38690dfa/attachment.html>
More information about the cmake-developers
mailing list