问题描述
在android中,当您打开终端仿真器或连接adb shell时,可以执行命令//Path to a file.
PHYSFS_INCLUDE_DIR:PATH=/usr/local/include
//Path to a library.
PHYSFS_LIBRARY:FILEPATH=/usr/local/lib/libphysfs.so
//Path to a library.
SDL2MAIN_LIBRARY:FILEPATH=/usr/lib/libSDL2main.a
//SDL2 directory
SDL2_DIR:PATH=
//Path to a file.
SDL2_IMAGE_INCLUDE_DIR:PATH=/usr/include/SDL2
//Path to a library.
SDL2_IMAGE_LIBRARY:FILEPATH=/usr/lib/libSDL2_image.so
//Path to a file.
SDL2_INCLUDE_DIR:PATH=/usr/include/SDL2
//Where the SDL Library can be found
SDL2_LIBRARY:STRING=/usr/lib/libSDL2.so;-lpthread
//Path to a file.
SDL2_mixer_INCLUDE_DIR:PATH=/usr/include/SDL2
//Path to a library.
SDL2_mixer_LIBRARY:FILEPATH=/usr/lib/libSDL2_mixer.so
,该命令可以在某种程度上与系统服务进行交互。就我的目的而言,功能太有限了,我想对其进行一些扩展。
很遗憾,此可执行文件没有记录。
我已经在此处找到了源代码:service.cpp
同一目录中还有一个名为Android.bp的文件,其内容如下:
service
对我来说,那些cflag看起来像g ++标志。我不太了解g ++,但是经过反复尝试,我最终还是这样:
cc_binary {
name: "service",srcs: ["service.cpp"],shared_libs: [
"libcutils","libutils","libbinder",],cflags: [
"-DXP_UNIX","-Wall","-Werror",}
cc_binary {
name: "vndservice",proprietary: true,"-DvendORSERVICES",}
不幸的是,我收到大量错误:
https://pastebin.com/fnu7LJLU
我的G ++版本是:# Download required source code
git clone https://android.googlesource.com/platform/superproject
cd superproject
git submodule init
git submodule update frameworks/native
git submodule update system/libbase
git submodule update system/core
git submodule update system/logging
# Set required include directories in CPATH
export CPATH="./frameworks/native/include:./system/libbase/include:./system/core/libcutils/include:./system/core/libutils/include:./system/logging/liblog/include:./system/core/libsystem/include:./frameworks/native/libs/binder/include"
# Build
g++ -DXP_UNIX -Wall -Werror -o service ./frameworks/native/cmds/service/service.cpp
有什么想法为什么会失败?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)