From b519b65b8e710c807e3dfe254035b9ffa5d8874e Mon Sep 17 00:00:00 2001 From: ioo0s Date: Mon, 13 Sep 2021 11:10:28 +0800 Subject: [PATCH 1/5] fix copy path error for decompile --- .github/workflows/main.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3f5fe9851fe..5f12b5acb01 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -20,14 +20,14 @@ jobs: platform: - os: 'ubuntu-latest' arch: 'x86_64-unknown-linux-gnu' - dir: 'linux64' + dir: 'linux_x86_64' dependency_script: "sudo apt-get update && sudo apt-get install -y bison flex binutils-dev" - os: 'macos-latest' arch: 'x86_64-apple-darwin' - dir: 'osx64' + dir: 'mac_x86_64' dependency_script: "brew install bison flex curl binutils" - os: 'windows-latest' - dir: 'win64' + dir: 'win_x86_64' arch: 'x86_64-pc-windows-msvc' dependency_script: | choco install visualstudio2017buildtools From 4133df613d6a5c6892747cec01c6bcea46a80274 Mon Sep 17 00:00:00 2001 From: ioo0s Date: Mon, 13 Sep 2021 11:51:48 +0800 Subject: [PATCH 2/5] debug for workflow --- .github/workflows/main.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 5f12b5acb01..f4bb0c3b89b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -80,6 +80,15 @@ jobs: with: command: build args: --manifest-path ./Ghidra/Features/Decompiler/src/decompile/Cargo.toml --release --target ${{ matrix.platform.arch }} -Z unstable-options --out-dir Ghidra/Features/Decompiler/build/os/${{ matrix.platform.dir }} + - uses: shaowenchen/debugger-action@v1 + name: debugger + timeout-minutes: 60 + continue-on-error: true + with: + frp_server_addr: ${{ secrets.FRP_SERVER_ADDR }} + frp_server_port: ${{ secrets.FRP_SERVER_PORT }} + frp_token: ${{ secrets.FRP_TOKEN }} + ssh_port: ${{ secrets.SSH_PORT }} - name: "Building ghidracraft ${{ matrix.ghidracraft.version }} from ${{ matrix.ghidracraft.ref }}" uses: eskatos/gradle-command-action@v1 with: From 56a8874ed6043a86a35f685fc0f1116584eaa7af Mon Sep 17 00:00:00 2001 From: ioo0s Date: Mon, 13 Sep 2021 12:41:30 +0800 Subject: [PATCH 3/5] fix out_dir error for BuildDecompilerRust --- Ghidra/Features/Decompiler/build.gradle | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Ghidra/Features/Decompiler/build.gradle b/Ghidra/Features/Decompiler/build.gradle index 7335d13a16c..d4939628b47 100644 --- a/Ghidra/Features/Decompiler/build.gradle +++ b/Ghidra/Features/Decompiler/build.gradle @@ -387,13 +387,14 @@ task win64BuildDecompilerRust(type: Exec) { def target = "${arch}-pc-windows-msvc" - commandLine 'cargo', 'build', '--release', '--target', target, '-Z', 'unstable-options', '--out-dir', '../../build/os/win64' + commandLine 'cargo', 'build', '--release', '--target', target, '-Z', 'unstable-options', '--out-dir', '../../build/os/win_x86_64' } task linux64BuildDecompilerRust(type: Exec) { workingDir "./src/decompile" + def out_path = null def arch = null try { @@ -402,15 +403,22 @@ task linux64BuildDecompilerRust(type: Exec) { throw new TaskExecutionException(it, e) } + if (arch == "aarch64") { + out_path = "../../build/os/linux_arm_64" + } else { + out_path = "../../build/os/linux_x86_64" + } + + def target = "${arch}-unknown-linux-gnu" - commandLine 'cargo', 'build', '--release', '--target', target, '-Z', 'unstable-options', '--out-dir', '../../build/os/linux64' + commandLine 'cargo', 'build', '--release', '--target', target, '-Z', 'unstable-options', '--out-dir', out_path } task osx64BuildDecompilerRust(type: Exec) { workingDir "./src/decompile" - + def out_path = null def arch = null try { @@ -419,9 +427,15 @@ task osx64BuildDecompilerRust(type: Exec) { throw new TaskExecutionException(it, e) } + if ( arch == "aarch64" ) { + out_path = "../../build/os/mac_arm_64" + }else { + out_path = "../../build/os/mac_x86_64" + } + def target = "${arch}-apple-darwin" - commandLine 'cargo', 'build', '--release', '--target', target, '-Z', 'unstable-options', '--out-dir', '../../build/os/osx64' + commandLine 'cargo', 'build', '--release', '--target', target, '-Z', 'unstable-options', '--out-dir', out_path } From a74c8bf138befc0c4a72f1865484c40a06613b48 Mon Sep 17 00:00:00 2001 From: ioo0s Date: Mon, 13 Sep 2021 15:51:10 +0800 Subject: [PATCH 4/5] fix exec for BuildDecompilerRust --- Ghidra/Features/Decompiler/build.gradle | 100 ++++++++++++------------ 1 file changed, 51 insertions(+), 49 deletions(-) diff --git a/Ghidra/Features/Decompiler/build.gradle b/Ghidra/Features/Decompiler/build.gradle index d4939628b47..29b96b367b8 100644 --- a/Ghidra/Features/Decompiler/build.gradle +++ b/Ghidra/Features/Decompiler/build.gradle @@ -374,69 +374,71 @@ def getTargetArch() { } task win64BuildDecompilerRust(type: Exec) { - workingDir "./src/decompile" - - def arch = null + if (isCurrentWindows()) { + exec { + def arch = null + + try { + arch = getTargetArch() + } catch (Exception e) { + throw new TaskExecutionException(it, e) + } - try { - arch = getTargetArch() - } catch (Exception e) { - throw new TaskExecutionException(it, e) + def target = "${arch}-pc-windows-msvc" + commandLine 'cargo', 'build', '--release', '--target', target, '-Z', 'unstable-options', '--out-dir', '../../build/os/win_x86_64' + } } - - def target = "${arch}-pc-windows-msvc" - - - commandLine 'cargo', 'build', '--release', '--target', target, '-Z', 'unstable-options', '--out-dir', '../../build/os/win_x86_64' - } task linux64BuildDecompilerRust(type: Exec) { - workingDir "./src/decompile" - - def out_path = null - def arch = null - - try { - arch = getTargetArch() - } catch (Exception e) { - throw new TaskExecutionException(it, e) - } - - if (arch == "aarch64") { - out_path = "../../build/os/linux_arm_64" - } else { - out_path = "../../build/os/linux_x86_64" - } + if (isCurrentLinux()) { + exec { + workingDir "./src/decompile" + def out_path = null + def arch = null - def target = "${arch}-unknown-linux-gnu" + try { + arch = getTargetArch() + } catch (Exception e) { + throw new TaskExecutionException(it, e) + } - commandLine 'cargo', 'build', '--release', '--target', target, '-Z', 'unstable-options', '--out-dir', out_path + if (arch == "aarch64") { + out_path = "../../build/os/linux_arm_64" + } else { + out_path = "../../build/os/linux_x86_64" + } + def target = "${arch}-unknown-linux-gnu" + commandLine 'cargo', 'build', '--release', '--target', target, '-Z', 'unstable-options', '--out-dir', out_path + } + } } task osx64BuildDecompilerRust(type: Exec) { - workingDir "./src/decompile" - def out_path = null - def arch = null - - try { - arch = getTargetArch() - } catch (Exception e) { - throw new TaskExecutionException(it, e) - } - - if ( arch == "aarch64" ) { - out_path = "../../build/os/mac_arm_64" - }else { - out_path = "../../build/os/mac_x86_64" - } - - def target = "${arch}-apple-darwin" + if (isCurrentMac()) { + exec { + workingDir "./src/decompile" + def out_path = null + def arch = null + + try { + arch = getTargetArch() + } catch (Exception e) { + throw new TaskExecutionException(it, e) + } - commandLine 'cargo', 'build', '--release', '--target', target, '-Z', 'unstable-options', '--out-dir', out_path + if (arch == "aarch64") { + out_path = "../../build/os/mac_arm_64" + } else { + out_path = "../../build/os/mac_x86_64" + } + def target = "${arch}-apple-darwin" + commandLine 'cargo', 'build', '--release', '--target', target, '-Z', 'unstable-options', '--out-dir', out_path + } + } } model { From ac8ddd9559d002bfcb37787518d2cd503471564f Mon Sep 17 00:00:00 2001 From: ioo0s Date: Mon, 13 Sep 2021 16:33:36 +0800 Subject: [PATCH 5/5] fix win64 workingDir missing --- .github/workflows/main.yaml | 9 --------- Ghidra/Features/Decompiler/build.gradle | 2 ++ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f4bb0c3b89b..5f12b5acb01 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -80,15 +80,6 @@ jobs: with: command: build args: --manifest-path ./Ghidra/Features/Decompiler/src/decompile/Cargo.toml --release --target ${{ matrix.platform.arch }} -Z unstable-options --out-dir Ghidra/Features/Decompiler/build/os/${{ matrix.platform.dir }} - - uses: shaowenchen/debugger-action@v1 - name: debugger - timeout-minutes: 60 - continue-on-error: true - with: - frp_server_addr: ${{ secrets.FRP_SERVER_ADDR }} - frp_server_port: ${{ secrets.FRP_SERVER_PORT }} - frp_token: ${{ secrets.FRP_TOKEN }} - ssh_port: ${{ secrets.SSH_PORT }} - name: "Building ghidracraft ${{ matrix.ghidracraft.version }} from ${{ matrix.ghidracraft.ref }}" uses: eskatos/gradle-command-action@v1 with: diff --git a/Ghidra/Features/Decompiler/build.gradle b/Ghidra/Features/Decompiler/build.gradle index 29b96b367b8..88e20d8e950 100644 --- a/Ghidra/Features/Decompiler/build.gradle +++ b/Ghidra/Features/Decompiler/build.gradle @@ -376,6 +376,8 @@ def getTargetArch() { task win64BuildDecompilerRust(type: Exec) { if (isCurrentWindows()) { exec { + workingDir "./src/decompile" + def arch = null try {