Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build Openssl for Android on Windows with ndk8?

I tried downloading OpenSSL-Android. Then run ndk-build which is ndk8c in this case.

I get the error:

process_begin: CreateProcess(NULL, pwd, ...) failed.
d:/Development/android/android-ndk-r8d/build/gmsl/__gmsl:512: *** non-numeric second argument to `wordlist' function: ''.  Stop.

When I apply a fix to __gsml as described here

I get the error:

Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: /Android.mk
d:/Development/android/android-ndk-r8c/build/core/add-application.mk:165: *** Android NDK: Aborting...    .  Stop.

Or is there a binary I can download? I basically just need libcrypto.so.

This is the Android.mk I am using:

LOCAL_PATH := $(call my-dir)

subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
        crypto \
        ssl \
        apps \
    ))

include $(subdirs)
like image 464
tmanthey Avatar asked Jan 18 '13 11:01

tmanthey


3 Answers

If you get the following error after you run ndk-build:

android-ndk-r8d/build/gmsl/__gmsl:512: *** non-numeric second argument to `wordlist' function: ''.  Stop.

you should add at least "android:minSdkVersion" inside the AndroidManifest.xml file:

<uses-sdk android:minSdkVersion="14"
          android:targetSdkVersion="17"
          android:maxSdkVersion="17" />

If you want to fix the second error I think you should remove the leading "/" from "/Android.mk" at ,$(addsuffix /Android.mk

EDIT: I tried building the OpenSSL library for Android project from the Github page you linked and it worked, after I changed AndroidManifest.xml file to something like below:

Note: I'm using android-ndk-r8d on a GNU/Linux distribution and I ran ndk-build from the root of the project.

You don't have to remove the leading "/".

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.jp.algi"
      android:versionCode="1"
      android:versionName="1.0">

      <uses-sdk android:minSdkVersion="14"
          android:targetSdkVersion="17"
          android:maxSdkVersion="17" />

    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
        <activity android:name="MyJpAndroidAppActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>
like image 26
Alex Bitek Avatar answered Nov 07 '22 14:11

Alex Bitek


I used the command dos2unix AndroidManifest.xml and it clears up the error for me. I hope that helps

like image 43
luckyreed76 Avatar answered Nov 07 '22 14:11

luckyreed76


1.) as Bad Design pointed correctly out the __gsml error is fixed by the following AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.evotegra.aCoDriver"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="14"
          android:targetSdkVersion="17"
          android:maxSdkVersion="17" />

</manifest>

2.) The error:

Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: /Android.mk

is caused by the line

APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/Android.mk

in jni/Application.mk . On Windows the variable $APP_PROJECT_PATH is not set and for that reason it is looking in the root directory for th Android.mk.

This can be fixed by changing the file jni/Application.mk to the following:

LOCAL_PATH := $(call my-dir)
NDK_TOOLCHAIN_VERSION=4.4.3
APP_PROJECT_PATH := $(shell pwd)
APP_BUILD_SCRIPT := $(LOCAL_PATH)/../Android.mk
like image 143
tmanthey Avatar answered Nov 07 '22 14:11

tmanthey