Library build error on Android

myz

After more than two days of building errors, I give up...

I followed this good tutorial here: http://www.cryptopp.com/wiki/Android_(Command_Line) . It compiles, and the "cryptest.exe" passes all tests. So, I guess that the static library "libcryptopp.a" is OK.

So, I move the "libcryptopp.a" and all the headers files in the Android project.

But when it comes to the building step (as often... :-) ), there are compilation errors, like:

    .../Classes/libs/android/libcryptopp.a(files.o): in function std::basic_filebuf<char, std::char_traits<char> >::_M_unshift() 
    [clone .part.40]:/Users/toto/Developer/NDKs/AndroidNDKs/android-ndk-r8e/sources/cxx-stl/stlport/stlport/stl/_fstream.h:322: 
    error: undefined reference to 'std::_Filebuf_base::_M_write(char*, int)' 

    and ~50 others ... 

"undefined reference to" errors usually mean that a library is not present, but "libcryptopp.a" is correct here. So I expect that something is missing in the "Android.mk":

    include $(CLEAR_VARS) 
    LOCAL_MODULE    := cryptopp-prebuilt 
    LOCAL_SRC_FILES := ...narf/Classes/libs/android/libcryptopp. 
    include $(PREBUILT_STATIC_LIBRARY) 


    include $(CLEAR_VARS) 
    /* 
       here are included other library 
    */ 

    LOCAL_STATIC_LIBRARIES := cryptopp-prebuilt                 
    include $(BUILD_SHARED_LIBRARY) 

After tries with "APP_STL := stlport_static/dynamic", "APP_STL := gnustl_static/dynamic", etc... no more chances.

Being really not a building/compilation expert (even worse on Android), can somebody help me. Thank you very much!

myz

Ok. It is working now!

So the linking of "libcryptopp.a" is not working on my Android project with "stlport" but only with "gnustl_static". Perhaps because of others include like "cocosd2-x".

So following the tuto "http://www.cryptopp.com/wiki/Android_(Command_Line)" you must change the script "setenv-android.sh" to have a result like this:

    ANDROID_STL_INC: /Users/toto/Developer/NDKs/AndroidNDKs/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.6/include/
    ANDROID_STL_LIB: /Users/toto/Developer/NDKs/AndroidNDKs/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_static.a

and also move the files (just for the compilation)

    /Users/toto/Developer/NDKs/AndroidNDKs/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits 

in

    /Users/toto/Developer/NDKs/AndroidNDKs/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.6/include/bits

otherwise there are compilation problems...

Ouf!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Android Studio Build error with AppCompat library newbie q

From Dev

Error to build native library from Android studio 6.1

From Dev

Build error as soon as I enable dataBinding for Android Library Project

From Dev

Error to build native library from Android studio 6.1

From Dev

Deploying Android AAR library to Artifactory via Gradle build fails with error "Error deploying artifact: Error transferring file"

From Dev

cephes math library build error

From Dev

Android NDK build shared library

From Dev

Android compile library error

From Dev

android BaseGamesUtils library error

From Dev

android BaseGamesUtils library error

From Dev

Cordova Build Error: More than one library with package name 'com.google.android.gms

From Dev

Android Gradle Build Error

From Dev

ionic build android error

From Dev

Error ionic build android

From Dev

Phonegap - Android Build Error

From Dev

Cordova Build Error for Android

From Dev

ionic build android error

From Dev

Android DataBinding build error

From Dev

Android 4.3 build error

From Dev

Cordova Build Error for Android

From Dev

Build FFMPEG for Android error

From Dev

ionic build android error

From Dev

oprofile binary build error - (liberty library not found)

From Dev

Class library project build error, broken references

From Dev

Release build does not work - error with Eigen library?

From Dev

Gitignore not ignoring some build files in Android library

From Dev

Build a closed source Android library based on Gradle

From Dev

Android studio - App with library project fails to build

From Dev

Minimal build.gradle for Android library modules