热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

androidlog4,在AndroidNDK下编译log4cpp1.1

NDK版本r8下载log4cpp-1.1.tar.gz并解压默认情况下,log4cpp准备好了windows平台的config文件,但是linux下一般是通过configurato

NDK版本r8

下载log4cpp-1.1.tar.gz并解压

默认情况下, log4cpp准备好了windows平台的config文件, 但是linux下一般是通过configurator生成的.

我先找了个linux生成了一下, 然后把config放在log4cpp/include/log4cpp/config.h, 内容参见

#ifndef _INCLUDE_LOG4CPP_CONFIG_H#define _INCLUDE_LOG4CPP_CONFIG_H 1/* include/log4cpp/config.h. Generated automatically at end of configure. *//* include/config.h. Generated from config.h.in by configure. *//* include/config.h.in. Generated from configure.in by autoheader. *//* Define to 1 if you have the header file. */#ifndef LOG4CPP_HAVE_DLFCN_H#define LOG4CPP_HAVE_DLFCN_H 1#endif/* Define to 1 if you have the `ftime' function. */#ifndef LOG4CPP_HAVE_FTIME#define LOG4CPP_HAVE_FTIME 1#endif/* Define to 1 if you have the `gettimeofday' function. */#ifndef LOG4CPP_HAVE_GETTIMEOFDAY#define LOG4CPP_HAVE_GETTIMEOFDAY 1#endif/* define if the compiler has int64_t */#ifndef LOG4CPP_HAVE_INT64_T#define LOG4CPP_HAVE_INT64_T /**/#endif/* Define to 1 if you have the header file. */#ifndef LOG4CPP_HAVE_INTTYPES_H#define LOG4CPP_HAVE_INTTYPES_H 1#endif/* Define to 1 if you have the header file. *//* #undef LOG4CPP_HAVE_IO_H *//* Define to 1 if you have the `idsa' library (-lidsa). *//* #undef LOG4CPP_HAVE_LIBIDSA *//* Define to 1 if you have the `localtime_r' function. */#ifndef LOG4CPP_HAVE_LOCALTIME_R#define LOG4CPP_HAVE_LOCALTIME_R 1#endif/* Define to 1 if you have the header file. */#ifndef LOG4CPP_HAVE_MEMORY_H#define LOG4CPP_HAVE_MEMORY_H 1#endif/* define if the compiler implements namespaces */#ifndef LOG4CPP_HAVE_NAMESPACES#define LOG4CPP_HAVE_NAMESPACES /**/#endif/* Define if you have POSIX threads libraries and header files. */#ifndef LOG4CPP_HAVE_PTHREAD#define LOG4CPP_HAVE_PTHREAD 1#endif/* define if the C library has snprintf */#ifndef LOG4CPP_HAVE_SNPRINTF#define LOG4CPP_HAVE_SNPRINTF /**/#endif/* define if the compiler has stringstream */#ifndef LOG4CPP_HAVE_SSTREAM#define LOG4CPP_HAVE_SSTREAM /**/#endif/* define if you have the header file. */#ifndef LOG4CPP_HAVE_STDINT_H#define LOG4CPP_HAVE_STDINT_H /**/#endif/* Define to 1 if you have the header file. */#ifndef LOG4CPP_HAVE_STDLIB_H#define LOG4CPP_HAVE_STDLIB_H 1#endif/* Define to 1 if you have the header file. */#ifndef LOG4CPP_HAVE_STRINGS_H#define LOG4CPP_HAVE_STRINGS_H 1#endif/* Define to 1 if you have the header file. */#ifndef LOG4CPP_HAVE_STRING_H#define LOG4CPP_HAVE_STRING_H 1#endif/* Define to 1 if you have the `syslog' function. */#ifndef LOG4CPP_HAVE_SYSLOG#define LOG4CPP_HAVE_SYSLOG 1#endif/* Define to 1 if you have the header file. */#ifndef LOG4CPP_HAVE_SYS_STAT_H#define LOG4CPP_HAVE_SYS_STAT_H 1#endif/* Define to 1 if you have the header file. */#ifndef LOG4CPP_HAVE_SYS_TYPES_H#define LOG4CPP_HAVE_SYS_TYPES_H 1#endif/* define if threading is enabled */#ifndef LOG4CPP_HAVE_THREADING#define LOG4CPP_HAVE_THREADING 1#endif/* Define to 1 if you have the header file. */#ifndef LOG4CPP_HAVE_UNISTD_H#define LOG4CPP_HAVE_UNISTD_H 1#endif/* Define to the sub-directory in which libtool stores uninstalled libraries.*/#ifndef LOG4CPP_LT_OBJDIR#define LOG4CPP_LT_OBJDIR ".libs/"#endif/* Name of package */#ifndef LOG4CPP_PACKAGE#define LOG4CPP_PACKAGE "log4cpp"#endif/* Define to the address where bug reports for this package should be sent. */#ifndef LOG4CPP_PACKAGE_BUGREPORT#define LOG4CPP_PACKAGE_BUGREPORT ""#endif/* Define to the full name of this package. */#ifndef LOG4CPP_PACKAGE_NAME#define LOG4CPP_PACKAGE_NAME "log4cpp"#endif/* Define to the full name and version of this package. */#ifndef LOG4CPP_PACKAGE_STRING#define LOG4CPP_PACKAGE_STRING "log4cpp 1.1"#endif/* Define to the one symbol short name of this package. */#ifndef LOG4CPP_PACKAGE_TARNAME#define LOG4CPP_PACKAGE_TARNAME "log4cpp"#endif/* Define to the home page for this package. */#ifndef LOG4CPP_PACKAGE_URL#define LOG4CPP_PACKAGE_URL ""#endif/* Define to the version of this package. */#ifndef LOG4CPP_PACKAGE_VERSION#define LOG4CPP_PACKAGE_VERSION "1.1"#endif/* Define to necessary symbol if this constant uses a non-standard name onyour system. *//* #undef LOG4CPP_PTHREAD_CREATE_JOINABLE *//* Define to 1 if you have the ANSI C header files. */#ifndef LOG4CPP_STDC_HEADERS#define LOG4CPP_STDC_HEADERS 1#endif/* define if pthread library is available */#ifndef LOG4CPP_USE_PTHREADS#define LOG4CPP_USE_PTHREADS 1#endif/* Version number of package */#ifndef LOG4CPP_VERSION#define LOG4CPP_VERSION "1.1"#endif/* _INCLUDE_LOG4CPP_CONFIG_H */#endif

接着, 修改log4cpp/include/log4cpp/RemoteSyslogAppender.hh的包含,改为

#ifdef WIN32

#include

#else

#include

#include

#include

#include

#endif

可以删除RemoteSyslogAppender.cpp里的这个定义即可

添加Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := log4cpp

LOCAL_SRC_FILES := \

src/AbortAppender.cpp \

src/Appender.cpp \

src/AppendersFactory.cpp \

src/AppenderSkeleton.cpp \

src/BasicConfigurator.cpp \

src/BasicLayout.cpp \

src/BufferingAppender.cpp \

src/Category.cpp \

src/CategoryStream.cpp \

src/Configurator.cpp \

src/DllMain.cpp \

src/DummyThreads.cpp \

src/FactoryParams.cpp \

src/FileAppender.cpp \

src/Filter.cpp \

src/FixedContextCategory.cpp \

src/HierarchyMaintainer.cpp \

src/IdsaAppender.cpp \

src/LayoutAppender.cpp \

src/LayoutsFactory.cpp \

src/LevelEvaluator.cpp \

src/Localtime.cpp \

src/LoggingEvent.cpp \

src/Manipulator.cpp \

src/MSThreads.cpp \

src/NDC.cpp \

src/NTEventLogAppender.cpp \

src/OmniThreads.cpp \

src/OstreamAppender.cpp \

src/PassThroughLayout.cpp \

src/PatternLayout.cpp \

src/PortabilityImpl.cpp \

src/Priority.cpp \

src/Properties.cpp \

src/PropertyConfigurator.cpp \

src/PropertyConfiguratorImpl.cpp \

src/PThreads.cpp \

src/RemoteSyslogAppender.cpp \

src/RollingFileAppender.cpp \

src/SimpleConfigurator.cpp \

src/SimpleLayout.cpp \

src/SmtpAppender.cpp \

src/StringQueueAppender.cpp \

src/StringUtil.cpp \

src/SyslogAppender.cpp \

src/TimeStamp.cpp \

src/TriggeringEventEvaluatorFactory.cpp \

LOCAL_C_INCLUDES := $(LOCAL_PATH) \

$(LOCAL_PATH)/include

include $(BUILD_STATIC_LIBRARY)

编译即可



推荐阅读
  • 如何自行分析定位SAP BSP错误
    The“BSPtag”Imentionedintheblogtitlemeansforexamplethetagchtmlb:configCelleratorbelowwhichi ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • 怎么在PHP项目中实现一个HTTP断点续传功能发布时间:2021-01-1916:26:06来源:亿速云阅读:96作者:Le ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 开发笔记:加密&json&StringIO模块&BytesIO模块
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了加密&json&StringIO模块&BytesIO模块相关的知识,希望对你有一定的参考价值。一、加密加密 ... [详细]
  • 本文介绍了在Linux下安装Perl的步骤,并提供了一个简单的Perl程序示例。同时,还展示了运行该程序的结果。 ... [详细]
  • 个人学习使用:谨慎参考1Client类importcom.thoughtworks.gauge.Step;importcom.thoughtworks.gauge.T ... [详细]
  • 本文介绍了PE文件结构中的导出表的解析方法,包括获取区段头表、遍历查找所在的区段等步骤。通过该方法可以准确地解析PE文件中的导出表信息。 ... [详细]
  • 本文介绍了如何使用C#制作Java+Mysql+Tomcat环境安装程序,实现一键式安装。通过将JDK、Mysql、Tomcat三者制作成一个安装包,解决了客户在安装软件时的复杂配置和繁琐问题,便于管理软件版本和系统集成。具体步骤包括配置JDK环境变量和安装Mysql服务,其中使用了MySQL Server 5.5社区版和my.ini文件。安装方法为通过命令行将目录转到mysql的bin目录下,执行mysqld --install MySQL5命令。 ... [详细]
  • 开发笔记:实验7的文件读写操作
    本文介绍了使用C++的ofstream和ifstream类进行文件读写操作的方法,包括创建文件、写入文件和读取文件的过程。同时还介绍了如何判断文件是否成功打开和关闭文件的方法。通过本文的学习,读者可以了解如何在C++中进行文件读写操作。 ... [详细]
  • 本文介绍了Swing组件的用法,重点讲解了图标接口的定义和创建方法。图标接口用来将图标与各种组件相关联,可以是简单的绘画或使用磁盘上的GIF格式图像。文章详细介绍了图标接口的属性和绘制方法,并给出了一个菱形图标的实现示例。该示例可以配置图标的尺寸、颜色和填充状态。 ... [详细]
  • 纠正网上的错误:自定义一个类叫java.lang.System/String的方法
    本文纠正了网上关于自定义一个类叫java.lang.System/String的错误答案,并详细解释了为什么这种方法是错误的。作者指出,虽然双亲委托机制确实可以阻止自定义的System类被加载,但通过自定义一个特殊的类加载器,可以绕过双亲委托机制,达到自定义System类的目的。作者呼吁读者对网上的内容持怀疑态度,并带着问题来阅读文章。 ... [详细]
  • 基于Socket的多个客户端之间的聊天功能实现方法
    本文介绍了基于Socket的多个客户端之间实现聊天功能的方法,包括服务器端的实现和客户端的实现。服务器端通过每个用户的输出流向特定用户发送消息,而客户端通过输入流接收消息。同时,还介绍了相关的实体类和Socket的基本概念。 ... [详细]
  • 本文介绍了Android中的assets目录和raw目录的共同点和区别,包括获取资源的方法、目录结构的限制以及列出资源的能力。同时,还解释了raw目录中资源文件生成的ID,并说明了这些目录的使用方法。 ... [详细]
  • 超级简单加解密工具的方案和功能
    本文介绍了一个超级简单的加解密工具的方案和功能。该工具可以读取文件头,并根据特定长度进行加密,加密后将加密部分写入源文件。同时,该工具也支持解密操作。加密和解密过程是可逆的。本文还提到了一些相关的功能和使用方法,并给出了Python代码示例。 ... [详细]
author-avatar
紫陌红尘一笑_423
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有