“build hikey960 error”的版本间的差异
来自个人维基
free6d1823(讨论 | 贡献) |
free6d1823(讨论 | 贡献) |
||
第26行: | 第26行: | ||
<source lang="c"> | <source lang="c"> | ||
− | ScopedFlock LockedFile:: | + | ScopedFlock LockedFile::Open(const char* filename, int flags, bool block, |
− | + | std::string* error_msg) { | |
− | + | while (true) { | |
− | + | std::unique_ptr<File> file(OS::OpenFileWithFlags(filename, flags, /* auto_flush= */ false)); | |
− | + | if (file.get() == nullptr) { | |
− | + | *error_msg = StringPrintf("Failed to open file '%s': %s", filename, strerror(errno)); | |
− | + | return nullptr; | |
− | + | } | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | } | + | |
+ | int operation = block ? LOCK_EX : (LOCK_EX | LOCK_NB); | ||
+ | int flock_result = TEMP_FAILURE_RETRY(flock(file->Fd(), operation)); | ||
+ | if (flock_result == EWOULDBLOCK) { | ||
+ | // File is locked by someone else and we are required not to block; | ||
+ | return nullptr; | ||
+ | } | ||
+ | if (flock_result != 0) { | ||
+ | *error_msg = StringPrintf("Failed to lock file '%s': %s", filename, strerror(errno)); | ||
+ | return nullptr; <== Remark this line | ||
+ | } | ||
</source> | </source> |
2019年10月13日 (日) 14:02的最后版本
Host:Linux 4.4.0-142-generic #168-Ubuntu x86_64 x86_64 x86_64 GNU/Linux
Log:
dex2oatd E 09-23 23:04:07 174391 174391 dex2oat.cc:2234] Cannot lock profiles: Failed to lock file 'out/soong/hikey960/dex_bootjars/boot.prof': Bad file descriptor dex2oatd E 09-23 23:04:07 174391 174391 dex2oat.cc:2842] Failed to process profile file ERROR: Dex2oat failed to compile a boot image.It is likely that the boot classpath is inconsistent.Rebuild with ART_BOOT_IMAGE_EXTRA_ARGS="--runtime-arg -verbose:verifier" to see verification errors.
Cause:
art/dex2oat/dex2oat.cc
bool LoadProfile() { .. if (profile_file_fd_ != -1) { profile_file = LockedFile::DupOf(profile_file_fd_, "profile", true /* read_only_mode */, &error); } else if (profile_file_ != "") { profile_file = LockedFile::Open(profile_file_.c_str(), O_RDONLY, true, &error); } // Return early if we're unable to obtain a lock on the profile. if (profile_file.get() == nullptr) { LOG(ERROR) << "Cannot lock profiles: " << error; return false; } }
art/libartbase/base/scoped_flock.cc
ScopedFlock LockedFile::Open(const char* filename, int flags, bool block, std::string* error_msg) { while (true) { std::unique_ptr<File> file(OS::OpenFileWithFlags(filename, flags, /* auto_flush= */ false)); if (file.get() == nullptr) { *error_msg = StringPrintf("Failed to open file '%s': %s", filename, strerror(errno)); return nullptr; } int operation = block ? LOCK_EX : (LOCK_EX | LOCK_NB); int flock_result = TEMP_FAILURE_RETRY(flock(file->Fd(), operation)); if (flock_result == EWOULDBLOCK) { // File is locked by someone else and we are required not to block; return nullptr; } if (flock_result != 0) { *error_msg = StringPrintf("Failed to lock file '%s': %s", filename, strerror(errno)); return nullptr; <== Remark this line }