编译由于OpenSSL项目中缺少标题而导致的错误 [英] Compile errors due to missing headers in OpenSSL project

查看:567
本文介绍了编译由于OpenSSL项目中缺少标题而导致的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 错误:(62,11)我在项目中使用OpenSSL的preBuilt库,但我得到的错误是:致命错误:找不到'openssl / asn1.h'文件
错误:(62,11)致命错误:找不到'openssl / asn1.h'文件
pre>

和我的Android.mk文件在这里



Android.mk

  LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE:= myLibrary
TARGET_PLATFORM:= android-3
LOCAL_SRC_FILES:= native-lib.cpp $ b $ LOCAL_C_INCLUDES = $(LOCAL_PATH)/ src / main / jni / include / openssl
LOCAL_LDLIBS:= -log

包含$(BUILD_SHARED_LIBRARY)

在rss.h中出现错误

rsa.h的标题

  #include< openssl / asn1.h> 
#ifndef OPENSSL_NO_BIO
#include< openssl / bio.h>
#endif
#include< openssl / crypto.h>
#include< openssl / ossl_typ.h>
#ifndef OPENSSL_NO_DEPRECATED
#include< openssl / bn.h>
#endif

这里的错误是找不到OpenSSL



build.graddle

  apply plugin:'com.android.application'

android {
signingConfigs {
config {
keyAlias'manvish'

}
}

compileSdkVersion 25
buildToolsVersion '26 .0.2'
defaultConfig {
applicationIdcom.example.manvish.bwssb
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName1.0
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
ndk {
moduleNamemyLibrary
}
}

buildTypes {
release {

shrinkResources false
minifyEnabled true
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard-rules.pro'
signingConfig signingConfigs.config

debuggable true

debug {
shrinkResources false
minifyEnabled true
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard-rules.pro'
signingConfig signingConfigs.config

debuggable true
}
}
}



android {
packagingOptions {
排除'META-INF / DEPENDENCIES.txt'
排除'META-INF / LICENSE.txt'
排除'META- INF / NOTICE.txt'
排除META-INF / NOTICE'
排除'META-INF / LICENSE'
排除'META-INF / DEPENDENCIES'
排除'META-INF / notice.txt'
排除' META-INF / license.txt'
排除'META-INF / dependencies.txt'
排除'META-INF / LGPL2.1'
}

}

android {
defaultConfig {

ndk {
moduleNamemyLibrary
ldLibslog
}

}
externalNativeBuild {
ndkBuild {
path'src / main / jni / Android.mk'
}
}
}

依赖关系{
编译fileTree(包括:['* .jar'],dir:'libs')
androidTestCompile('com.android.support.test.espresso:espresso -core:2.2.2',{
exclude group:'com.android.support',module:'support- annotations'
})
compile'c​​om.android.support:appcompat-v7:25.3.1'
compile'c​​om.android.support:support-vector-drawable:25.3.1'
编译'com.android.support:recyclerview-v7:25.3.1'
编译'com.android.support:cardview-v7:25.3.1'
编译'xyz.danoz: recyclerviewfastscroller:0.1.3'
compile'c​​om.android.support.constraint:constraint-layout:1.0.2'
compile'c​​om.android.support:design:25.3.1'
testCompile'junit:junit:4.12'
编译文件('libs / MorphoSmart_SDK_6.13.2.0-4.1.jar')

//编译'com.google.android.gms:play -services-location:11.0.4'

//编译'com.google.android.gms:play-services-maps:11.0.4'
编译文件('libs / commons '
编译文件('libs / core.jar')
compile('org.apache.httpcomponents:httpmime:4.3'){
exclude group:' org.apache.httpcomponents',m odule:'httpclient'
}
编译('org.apache.httpcomponents:httpcore:4.4.1'){
排除组:'org.apache.httpcomponents',模块:'httpclient '

}
编译'com.google.code.gson:gson:2.7'
编译'de.hdodenhof:circleimageview:2.1.0'
编译文件('libs / zip4j_1.3.2.jar')
编译文件('libs / idkit.jar')
编译文件('libs / jna-4.0.0.jar')
编译'org.apache.commons:commons-lang3:3.6'
compile'c​​om.github.bumptech.glide:glide:3.7.0'
}

我在适当的文件夹中添加了.so文件。
已经有四天了,我无法解决这个问题。



请帮助我们。

Android.mk 位于 $ {proj} / src / main / jni 中,你的 $(LOCAL_PATH)。因此,您应该使用

  LOCAL_C_INCLUDES:= $(LOCAL_PATH)/ include 

这会找到 $ {proj} /src/main/jni/include/openssl/asn1.h as

  #include< openssl / asn1.h> 


I am using preBuilt library of OpenSSL in project but i am getting error as:

Error:(62, 11) fatal error: 'openssl/asn1.h' file not found
Error:(62, 11) fatal error: 'openssl/asn1.h' file not found

and my Android.mk file is here

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := myLibrary
TARGET_PLATFORM := android-3
LOCAL_SRC_FILES := native-lib.cpp
LOCAL_C_INCLUDES = $(LOCAL_PATH)/src/main/jni/include/openssl
LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_LIBRARY)

getting error in rss.h

headers of rsa.h

# include <openssl/asn1.h>    
# ifndef OPENSSL_NO_BIO
#  include <openssl/bio.h>
# endif
# include <openssl/crypto.h>
# include <openssl/ossl_typ.h>
# ifndef OPENSSL_NO_DEPRECATED
#  include <openssl/bn.h>
# endif

the error here is cannot find OpenSSL

build.graddle

apply plugin: 'com.android.application'

android {
    signingConfigs {
        config {
            keyAlias 'manvish'

        }
    }

        compileSdkVersion 25
        buildToolsVersion '26.0.2'
        defaultConfig {
            applicationId "com.example.manvish.bwssb"
            minSdkVersion 19
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
            vectorDrawables.useSupportLibrary = true
            multiDexEnabled true
            ndk {
                moduleName "myLibrary"
            }
        }

        buildTypes {
            release {

                shrinkResources false
                minifyEnabled true
                zipAlignEnabled true
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
                        'proguard-rules.pro'
                signingConfig signingConfigs.config

                debuggable true
            }
            debug {
                shrinkResources false
                minifyEnabled true
                zipAlignEnabled true
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
                        'proguard-rules.pro'
                signingConfig signingConfigs.config

                debuggable true
            }
        }
        }



    android {
        packagingOptions {
            exclude 'META-INF/DEPENDENCIES.txt'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/notice.txt'
            exclude 'META-INF/license.txt'
            exclude 'META-INF/dependencies.txt'
            exclude 'META-INF/LGPL2.1'
        }

    }

    android {
        defaultConfig {

                ndk {
                    moduleName "myLibrary"
                    ldLibs "log"
                }

        }
        externalNativeBuild {
            ndkBuild {
                path 'src/main/jni/Android.mk'
            }
        }
    }

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:support-vector-drawable:25.3.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'xyz.danoz:recyclerviewfastscroller:0.1.3'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:25.3.1'
    testCompile 'junit:junit:4.12'
    compile files('libs/MorphoSmart_SDK_6.13.2.0-4.1.jar')

    //    compile 'com.google.android.gms:play-services-location:11.0.4'

    //    compile 'com.google.android.gms:play-services-maps:11.0.4'
    compile files('libs/commons-io-2.4.jar')
    compile files('libs/core.jar')
    compile('org.apache.httpcomponents:httpmime:4.3') {
        exclude group: 'org.apache.httpcomponents', module: 'httpclient'
    }
    compile('org.apache.httpcomponents:httpcore:4.4.1') {
        exclude group: 'org.apache.httpcomponents', module: 'httpclient'

    }
    compile 'com.google.code.gson:gson:2.7'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile files('libs/zip4j_1.3.2.jar')
    compile files('libs/idkit.jar')
    compile files('libs/jna-4.0.0.jar')
    compile 'org.apache.commons:commons-lang3:3.6'
    compile 'com.github.bumptech.glide:glide:3.7.0'
}

I have added .so files in appropriate folders. its been four days I am not able to fix this.

please help me guys.

解决方案

Your Android.mk is in ${proj}/src/main/jni, which becomes your $(LOCAL_PATH). Therefore, you should use

LOCAL_C_INCLUDES := $(LOCAL_PATH)/include

This will find ${proj}/src/main/jni/include/openssl/asn1.h as

#include <openssl/asn1.h>

这篇关于编译由于OpenSSL项目中缺少标题而导致的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆