Android 未能为AOSIP生成目标:使用未声明的标识符';页面大小';INSSYSTEM/core/base/cmsg.cpp:36:21:

Android 未能为AOSIP生成目标:使用未声明的标识符';页面大小';INSSYSTEM/core/base/cmsg.cpp:36:21:,android,custom-rom,Android,Custom Rom,我正在使用MacOSCatalina版本10.15.7。我正在尝试为OnePlus 7T编译AOSIP分支10的映像,但我无法使用命令make api stubs docs update current api完成构建 我有几个模块被报告丢失了,按照@TheHardGamer的建议,我去了AOSIP的Git页面,下载了以下模块的branch ten libsquashfs_util -> placed into systems/extras/squashfs_utils fec &

我正在使用MacOSCatalina版本10.15.7。我正在尝试为OnePlus 7T编译AOSIP分支10的映像,但我无法使用命令make api stubs docs update current api完成构建

我有几个模块被报告丢失了,按照@TheHardGamer的建议,我去了AOSIP的Git页面,下载了以下模块的branch ten

libsquashfs_util -> placed into systems/extras/squashfs_utils
fec & verity -> placed into systems/extras/verity
libtestUtil -> placed into test/vts-testcase/kernel/testUtil
simpleperf-inferno -> The systems/extras/simpleperf/scripts was not present so i copied the entire scripts folder from Git
libc++_darwin -> I did git clone https://android.googlesource.com/platform/prebuilts/clang/host/darwin-x86 -b android-10.0.0_r40 on the prebuilts/clang/host folder
然后我遇到了以下错误:

internal error: Could not find a supported mac sdk: ["10.10" "10.11" "10.12" "10.13" "10.14"]
internal error: Could not find a supported mac sdk: ["10.10" "10.11" "10.12" "10.13" "10.14"]
所以我听从了他的建议

编辑了以下文件/Volumes/android/build/soong/cc/config/x86\u darwin\u host.go

将“11.1”添加到文件中的以下代码段中

darwinSupportedSdkVersions = []string{
    "10.10",
    "10.11",
    "10.12",
    "10.13",
    "10.14",
    "11.1",
}
然后发生了以下错误

error: system/extras/simpleperf/Android.bp:72:1: module "libsimpleperf_elf_read" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/read_apk.cpp" does not exist
error: system/extras/simpleperf/Android.bp:72:1: module "libsimpleperf_elf_read" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/read_elf.cpp" does not exist
error: system/extras/simpleperf/Android.bp:72:1: module "libsimpleperf_elf_read" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/utils.cpp" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/dso.cpp" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/event_attr.cpp" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/event_type.cpp" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/perf_regs.cpp" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/read_apk.cpp" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/read_elf.cpp" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/record.cpp" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/record_file_reader.cpp" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/report_sample.proto" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/thread_tree.cpp" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/tracing.cpp" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/utils.cpp" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/nonlinux_support/nonlinux_support.cpp" does not exist
error: system/extras/simpleperf/Android.bp:310:1: module "libsimpleperf" variant "darwin_x86_64_static": module source path "system/extras/simpleperf/nonlinux_support/include" does not exist
然后我将整个simpleperf文件夹从分支十复制到我的simpleperf文件夹上

然后我遇到了以下错误

art/build/Android.common.mk:51: warning: unsupported HOST_ARCH=x86_64
[ 24% 116/481] including device_oneplus_hotdogb/overlay/packages/apps/overlays/NoCutoutOverlay/Android.mk ...
FAILED: 
build/make/core/base_rules.mk:324: error: device_oneplus_hotdogb/overlay/packages/apps/overlays/NoCutoutOverlay: MODULE.TARGET.APPS.NoCutoutOverlay already defined by device/oneplus/hotdogb/overlay/packages/apps/overlays/NoCutoutOverlay.
10:15:54 ckati failed with: exit status 1
我删除了设备\u oneplus\u hotdogb文件夹

之后我遇到了这个错误

FAILED: out/soong/.intermediates/system/core/base/libbase/darwin_x86_64_static/obj/system/core/base/cmsg.o
 prebuilts/clang/host/darwin-x86/clang-r353983c1/bin/clang++ -c -Isystem/core/base  -fPIC -funwind-tables -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.8 -DMACOSX_DEPLOYMENT_TARGET=10.8 -m64 -integrated-as -fstack-protector-strong -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -D__compiler_offsetof=__builtin_offsetof -faddrsig -Wimplicit-fallthrough -Werror=int-conversion -Wno-reserved-id-macro -Wno-format-pedantic -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-zero-as-null-pointer-constant -Wno-sign-compare -Wno-defaulted-function-deleted -Wno-inconsistent-missing-override   -Isystem/core/base/include -Iexternal/libcxx/include -Iexternal/libcxxabi/include -Isystem/core/liblog/include -Isystem/core/include -Isystem/media/audio/include -Ihardware/libhardware/include -Ihardware/libhardware_legacy/include -Ihardware/ril/include -Iframeworks/native/include -Iframeworks/native/opengl/include -Iframeworks/av/include  -Ilibnativehelper/include_jni -Wall -Werror -Wextra -D_FILE_OFFSET_BITS=64 -target x86_64-apple-darwin -B/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -DANDROID_STRICT -fPIC -D_USING_LIBCXX -std=gnu++17 -Wsign-promo -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-thread-safety-negative -Wno-gnu-include-next  -Wexit-time-destructors  -D_LIBCPP_DISABLE_AVAILABILITY -nostdinc++ -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-tautological-type-limit-compare -Wno-tautological-unsigned-enum-zero-compare -Wno-tautological-unsigned-zero-compare -Wno-c++98-compat-extra-semi -Wno-return-std-move-in-c++11 -MD -MF out/soong/.intermediates/system/core/base/libbase/darwin_x86_64_static/obj/system/core/base/cmsg.o.d -o out/soong/.intermediates/system/core/base/libbase/darwin_x86_64_static/obj/system/core/base/cmsg.o system/core/base/cmsg.cpp
system/core/base/cmsg.cpp:36:21: error: use of undeclared identifier 'PAGE_SIZE'
  if (cmsg_space >= PAGE_SIZE) {
                    ^
system/core/base/cmsg.cpp:78:21: error: use of undeclared identifier 'PAGE_SIZE'
  if (cmsg_space >= PAGE_SIZE) {
                    ^
我应该尝试定义页面大小吗?如果是,我如何决定尺寸?或者我在什么地方丢失了头文件


谢谢。

我试图在M1 Mac上编译AOSP,我以前遇到过这个问题。我解决这个问题的方法是添加

#ifndef PAGE_SIZE
#define PAGE_SIZE (size_t)(sysconf(_SC_PAGESIZE))
#endif
in/system/core/base/cmsg.cpp

更新: 以防其他人试图在M1 Mac上编译Android,这是完全可能的,也不太难实现。您将遇到的下一个问题与此类似:

external/python/cpython2/Modules/getpath.c:414:50: error: incompatible pointer types passing 'unsigned long *' to parameter of type 'uint32_t *' (aka 'unsigned int *') [-Werror,-Wincompatible-pointer-types]
     else if(0 == _NSGetExecutablePath(progpath, &nsexeclength) && progpath[0] == SEP)
                                                 ^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/mach-o/dyld.h:98:54: note: passing argument to parameter 'bufsize' here
extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize)                 __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
                                                     ^
1 error generated.
16:29:38 ninja failed with: exit status 1
您可以在external/python/cpython2/Modules/getpath.c中通过查找

#ifdef __APPLE__
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
    uint32_t nsexeclength = MAXPATHLEN;
#else
    unsigned long nsexeclength = MAXPATHLEN;
#endif
#endif
把它改成

#ifdef __APPLE__
    uint32_t nsexeclength = MAXPATHLEN;
#endif
接下来,您可能会遇到一个关于sed的问题。解决方案是从自制软件安装gsed,如下所述


这些都不是可以贡献给AOSP的合适解决方案,但它们可以用于本地编译。我已经使用这些更改成功地编译了AOSP的两个变体。希望这有帮助:)

支持的Mac sdk版本列表是有原因的。是的,你可以把自己的加入到列表中,并抱着最好的希望,但你很可能会像以前一样遇到问题

既然谷歌在Linux上开发了Android,最好的办法就是在虚拟机上安装一些Linux发行版,然后在那里编译。别误会我的意思,我并不是说在Mac上构建是不可能的。这只是自找麻烦(如果你是专家,那没关系)。

更新此:

替换
external/python/cpython2/Modules/getpath.c

苹果公司__ #如果MAC_OS_X_VERSION_MAX_ALLOWED>=MAC_OS_X_VERSION_10_4 uint32_t nsexeclength=MAXPATHLEN; #否则 无符号长nsexeclength=MAXPATHLEN; #恩迪夫 #恩迪夫 与

苹果公司__ uint32_t nsexeclength=MAXPATHLEN; #恩迪夫 在
external/python/cpython3/Modules/getpath.c
中执行同样的操作:

苹果公司__ char execpath[MAXPATHLEN+1]; uint32\u t nsexeclength=Py\u数组长度(execpath)-1; #恩迪夫