Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Patch failed when compiling android-llvm of ndk r25c

163 views
Skip to first unread message

s18

unread,
Jul 26, 2023, 4:20:26 AM7/26/23
to android-llvm
Hi everyone!

I downloaded the code of NDK r25c using the following command:

  $ cd path/to/workspace
  $ repo init -u https://android.googlesource.com/platform/manifest -b llvm-toolchain
  $ cp /path/to/manifest_9352603.xml ./.repo/manifests
  $ repo init -m manifest_9352603.xml
  $ repo sync

"manifest_9352603.xml" is from "ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/manifest_9352603.xml"

I compiled using the following command:

  $ ./toolchain/llvm_android/build.py --no-build windows --enable-assertions --skip-package

Then an error occurred:
 
  Failed to apply patch: 86617256864ebcbda03b6ce843deeb6a41a85800.patch.

After deleting some patches that caused errors in the toolchain/llvm_android/patches/PATCHES.json,
I compiled successfully, but received the message:

  The following patches were not applicable:
  bd22a99c57b472774a8addcaeef503540abe7b57.patch
  79f8b5f0d00fd10fee8aee3c3c58e17a8fea8946.patch
  c3aecf87d5b97c3d3580457164e7fe4a19c4221a.patch
  8901f8beea3a70f92be8c0b80313260502f03727.patch
  f2fa6ad0476b318fdba46f09a2d59187228431ee.patch

these patches should be applied, right? But why did they fail or show as not applicable?
What can I do to solve this issue?

Thanks.

Pirama Arumuga Nainar

unread,
Jul 26, 2023, 5:50:26 PM7/26/23
to s18, android-llvm
On Wed, Jul 26, 2023 at 1:20 AM s18 <zlz1...@gmail.com> wrote:
Hi everyone!

I downloaded the code of NDK r25c using the following command:

  $ cd path/to/workspace
  $ repo init -u https://android.googlesource.com/platform/manifest -b llvm-toolchain
  $ cp /path/to/manifest_9352603.xml ./.repo/manifests
  $ repo init -m manifest_9352603.xml
  $ repo sync

"manifest_9352603.xml" is from "ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/manifest_9352603.xml"

I compiled using the following command:

  $ ./toolchain/llvm_android/build.py --no-build windows --enable-assertions --skip-package

Then an error occurred:
 
  Failed to apply patch: 86617256864ebcbda03b6ce843deeb6a41a85800.patch.

After deleting some patches that caused errors in the toolchain/llvm_android/patches/PATCHES.json,

This works for me.  Do you have any other patches after sync-ing the manifest?
 

I compiled successfully, but received the message:

  The following patches were not applicable:
  bd22a99c57b472774a8addcaeef503540abe7b57.patch
  79f8b5f0d00fd10fee8aee3c3c58e17a8fea8946.patch
  c3aecf87d5b97c3d3580457164e7fe4a19c4221a.patch
  8901f8beea3a70f92be8c0b80313260502f03727.patch
  f2fa6ad0476b318fdba46f09a2d59187228431ee.patch

these patches should be applied, right? But why did they fail or show as not applicable?

Each patch has a start and end version and it gets applied only if the current llvm-project version is between the start and end.  It's ok to ignore the `patches were not applicable` message.  It's just for book-keeping.

What can I do to solve this issue?

Thanks.

--
You received this message because you are subscribed to the Google Groups "android-llvm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-llvm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-llvm/b6784b7d-e4e2-4963-97b3-5ddcac40888fn%40googlegroups.com.

s18

unread,
Jul 26, 2023, 11:14:30 PM7/26/23
to android-llvm
在2023年7月27日星期四 UTC+8 05:50:26<Pirama Arumuga Nainar> 写道:
On Wed, Jul 26, 2023 at 1:20 AM s18 <zlz1...@gmail.com> wrote:
Hi everyone!

I downloaded the code of NDK r25c using the following command:

  $ cd path/to/workspace
  $ repo init -u https://android.googlesource.com/platform/manifest -b llvm-toolchain
  $ cp /path/to/manifest_9352603.xml ./.repo/manifests
  $ repo init -m manifest_9352603.xml
  $ repo sync

"manifest_9352603.xml" is from "ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/manifest_9352603.xml"

I compiled using the following command:

  $ ./toolchain/llvm_android/build.py --no-build windows --enable-assertions --skip-package

Then an error occurred:
 
  Failed to apply patch: 86617256864ebcbda03b6ce843deeb6a41a85800.patch.

After deleting some patches that caused errors in the toolchain/llvm_android/patches/PATCHES.json,

This works for me.  Do you have any other patches after sync-ing the manifest?

No other patches, only those in 'toolchain/llvm_android/patches/'.
After sync-ing the manifest, I compiled using the following command:


  $ ./toolchain/llvm_android/build.py --no-build windows --enable-assertions --skip-package
    INFO:__main__:do_build=True do_stage1=True do_stage2=True do_runtimes=True do_package=False need_windows=False lto=False bolt=False
    DEBUG:utils:subprocess.run:08:14:15
    /Volumes/develop/ndk_r25c/prebuilts/python/darwin-x86/bin/python3
    /Volumes/develop/ndk_r25c/external/toolchain-utils/llvm_tools/patch_manager.py
    --svn_version 450784
    --patch_metadata_file /Volumes/develop/ndk_r25c/toolchain/llvm_android/patches/PATCHES.json
    --filesdir_path /Volumes/develop/ndk_r25c/toolchain/llvm_android/patches
    --src_path /Volumes/develop/ndk_r25c/out/llvm-project.tmp --use_src_head --failure_mode fail

    Traceback (most recent call last):
      File "/Volumes/develop/ndk_r25c/external/toolchain-utils/llvm_tools/patch_manager.py", line 758, in <module>
        main()
      File "/Volumes/develop/ndk_r25c/external/toolchain-utils/llvm_tools/patch_manager.py", line 748, in main
        patch_info = HandlePatches(
      File "/Volumes/develop/ndk_r25c/external/toolchain-utils/llvm_tools/patch_manager.py", line 607, in HandlePatches
        raise ValueError(
    ValueError: Failed to apply patch: fad7e491a0770ac4336934030ac67d77e7af5520.patch

An error occurred:
  Failed to apply patch: fad7e491a0770ac4336934030ac67d77e7af5520.patch.

Then I tried executing the following command:
  % patch -d /Volumes/develop/ndk_r25c/out/llvm-project.tmp -f -p1 -E
    --no-backup-if-mismatch
    -i /Volumes/develop/ndk_r25c/toolchain/llvm_android/patches/cherry/fad7e491a0770ac4336934030ac67d77e7af5520.patch

    patching file 'clang/docs/ReleaseNotes.rst'
    patching file 'clang/include/clang/Basic/TargetInfo.h'
    patching file 'clang/lib/Frontend/InitPreprocessor.cpp'
    patching file 'clang/lib/Headers/limits.h'
    patching file 'clang/lib/Sema/SemaType.cpp'
    1 out of 2 hunks failed--saving rejects to 'clang/lib/Sema/SemaType.cpp.rej'
    patching file 'clang/test/CodeGen/ext-int-cc.c'
    patching file 'clang/test/CodeGen/ext-int.c'
    patching file 'clang/test/CodeGenCXX/ext-int.cpp'
    patching file 'clang/test/Headers/limits.cpp'
    patching file 'clang/test/Preprocessor/init-aarch64.c'
    patching file 'clang/test/Preprocessor/init.c'
    patching file 'clang/test/Sema/builtins-overflow.c'
    patching file 'clang/test/SemaCXX/ext-int.cpp'

After removing fad7e491a0770ac4336934030ac67d77e7af5520.patch from PATCHES.json, I encountered the same error for the following patches:

  Failed to apply patch: 86617256864ebcbda03b6ce843deeb6a41a85800.patch.
  Failed to apply patch: a9a012086a917dff367bb63de2d63782b23111fc.patch.
  Failed to apply patch: 786c687810a5e3db4c64312018de25c65527c40c.patch.

  % patch -d /Volumes/develop/ndk_r25c/out/llvm-project.tmp -f -p1 -E
    --no-backup-if-mismatch
    -i /Volumes/develop/ndk_r25c/toolchain/llvm_android/patches/cherry/86617256864ebcbda03b6ce843deeb6a41a85800.patch

    patching file 'llvm/test/Transforms/CodeGenPrepare/AArch64/sink-free-instructions.ll'
    No such line 493 in input file, ignoring
    1 out of 1 hunks failed--saving rejects to 'llvm/test/Transforms/CodeGenPrepare/AArch64/sink-free-instructions.ll.rej'

  % patch -d /Volumes/develop/ndk_r25c/out/llvm-project.tmp -f -p1 -E
    --no-backup-if-mismatch
    -i /Volumes/develop/ndk_r25c/toolchain/llvm_android/patches/cherry/a9a012086a917dff367bb63de2d63782b23111fc.patch
   
    patching file 'llvm/test/Transforms/CodeGenPrepare/AArch64/sink-free-instructions.ll'
    No such line 584 in input file, ignoring
    2 out of 2 hunks failed--saving rejects to 'llvm/test/Transforms/CodeGenPrepare/AArch64/sink-free-instructions.ll.rej'

  % patch -d /Volumes/develop/ndk_r25c/out/llvm-project.tmp -f -p1 -E
    --no-backup-if-mismatch
    -i /Volumes/develop/ndk_r25c/toolchain/llvm_android/patches/cherry/786c687810a5e3db4c64312018de25c65527c40c.patch
   
    patching file 'llvm/lib/Target/AArch64/AArch64ISelLowering.cpp'
    patching file 'llvm/test/Transforms/CodeGenPrepare/AArch64/sink-free-instructions.ll'
    No such line 497 in input file, ignoring
    6 out of 7 hunks failed--saving rejects to 'llvm/test/Transforms/CodeGenPrepare/AArch64/sink-free-instructions.ll.rej'

After deleting above patches that caused errors in the toolchain/llvm_android/patches/PATCHES.json,
I compiled successfully.
 
 

I compiled successfully, but received the message:

  The following patches were not applicable:
  bd22a99c57b472774a8addcaeef503540abe7b57.patch
  79f8b5f0d00fd10fee8aee3c3c58e17a8fea8946.patch
  c3aecf87d5b97c3d3580457164e7fe4a19c4221a.patch
  8901f8beea3a70f92be8c0b80313260502f03727.patch
  f2fa6ad0476b318fdba46f09a2d59187228431ee.patch

these patches should be applied, right? But why did they fail or show as not applicable?

Each patch has a start and end version and it gets applied only if the current llvm-project version is between the start and end.  It's ok to ignore the `patches were not applicable` message.  It's just for book-keeping.

oh, i got it, thanks

Pirama Arumuga Nainar

unread,
Aug 1, 2023, 4:21:43 PM8/1/23
to s18, android-llvm
Realized that you're building on a Mac (based on one of the failing commands you posted).  I can repro the failure on a Mac as well.  Build on Linux, if that is an option for you.  Or, maybe the fact that it fails only on Mac could help you debug further.  Unfortunately, investigating this is a fairly low priority for us right now.

app...@google.com

unread,
Aug 1, 2023, 6:53:53 PM8/1/23
to android-llvm
seems like there are a set of patches for: sink-free-instructions.ll
Could it be that the ordering of patches in Mac vs. Linux are different?

Reply all
Reply to author
Forward
0 new messages