Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add aarch64 control-freec (debugging) #52018

Closed
wants to merge 18 commits into from

Conversation

dslarm
Copy link
Contributor

@dslarm dslarm commented Nov 8, 2024

This is an attempt to understand why a build failure is happening in prior pull request for adding linux-aarch64 support for control-freec

Copy link
Contributor

coderabbitai bot commented Nov 8, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces modifications to the build.sh script and the meta.yaml file for the control-freec package. The build.sh script now includes debugging features, activated by set -x, to print executed commands during the ARM build process. It ensures the creation of a directory at $PREFIX/bin, makes all files in the scripts directory executable, and updates the path for Perl scripts. The script also lists the contents of the $PREFIX/bin directory and displays the contents of get_fasta_lengths.pl for better visibility. The compilation of C++ source files into an executable named freec is also part of the changes.

In the meta.yaml file, the version number has been incremented, and the test section has been expanded with additional commands. The license has been updated to GPL-2.0-or-later, and a new license_family field has been added. An additional-platforms field specifying linux-aarch64 has also been introduced, enhancing the package's metadata and testing procedures.

Possibly related PRs

Suggested labels

please review & merge, aarch64, WIP

Suggested reviewers

  • mencian
  • bgruening

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3acab93 and 31042aa.

📒 Files selected for processing (1)
  • recipes/control-freec/meta.yaml (3 hunks)
🔇 Additional comments (4)
recipes/control-freec/meta.yaml (4)

17-17: LGTM: Build number increment is appropriate

The build number increment is justified as we're making changes to the package build process for ARM support.


33-35: Remove debugging commands from test section

The ls and echo commands are debugging artifacts that don't contribute to package validation.

Also applies to: 40-41


49-50: LGTM: License specification follows SPDX standard

The update to use SPDX identifier "GPL-2.0-or-later" and addition of license family improves compliance and clarity.


63-64: Verify dependency compatibility with aarch64

The addition of aarch64 platform support is aligned with the PR objective. However, we should verify that all dependencies support this architecture.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (2)
recipes/control-freec/build.sh (2)

15-17: Improve debug output organization.

The debug output commands should be:

  1. Conditionally executed only during ARM builds
  2. More focused on relevant information
-ls -l $PREFIX/bin
-echo get_fasta_lengths.pl is...
-cat $PREFIX/bin/get_fasta_lengths.pl
+# Debug output for cross-compilation
+if [[ "${CONDA_BUILD_CROSS_COMPILATION:-}" == "1" ]]; then
+    echo "=== Verifying installation ==="
+    if [[ ! -x "$PREFIX/bin/get_fasta_lengths.pl" ]]; then
+        echo "ERROR: get_fasta_lengths.pl not found or not executable"
+        ls -l "$PREFIX/bin"
+        exit 1
+    fi
+    echo "=== Installation verified ==="
+fi

Line range hint 1-21: Enhance build script robustness and safety.

The build script needs improvements in error handling and variable safety:

  1. Add error checking for critical operations
  2. Quote variables to handle paths with spaces
  3. Validate required environment variables
 #!/bin/bash
-set -x
+set -euo pipefail
+
+# Validate required environment variables
+: "${PREFIX:?PREFIX must be set}"
+: "${CXX:?CXX must be set}"
+: "${CXXFLAGS:?CXXFLAGS must be set}"
+: "${LDFLAGS:?LDFLAGS must be set}"
 
-mkdir -p $PREFIX/bin
+mkdir -p "$PREFIX/bin"
 
-for f in scripts/*
+for f in scripts/*; do
+    if [[ ! -f "$f" ]]; then
+        echo "ERROR: Script file not found: $f"
+        exit 1
+    fi
+    chmod +x "$f"
+    pattern="s|/usr/bin/perl|${PREFIX}/bin/perl|g"
+    sed -i -e "$pattern" "$f"
+    cp "$f" "$PREFIX/bin/"
+done
 
-cd src
-$CXX -o $PREFIX/bin/freec $CXXFLAGS $LDFLAGS *.cpp -lpthread
+if [[ ! -d "src" ]]; then
+    echo "ERROR: src directory not found"
+    exit 1
+fi
+cd src || exit 1
+$CXX -o "$PREFIX/bin/freec" $CXXFLAGS $LDFLAGS ./*.cpp -lpthread
🧰 Tools
🪛 Shellcheck

[warning] 19-19: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 44fba42 and c947991.

📒 Files selected for processing (2)
  • recipes/control-freec/build.sh (2 hunks)
  • recipes/control-freec/meta.yaml (4 hunks)
🔇 Additional comments (3)
recipes/control-freec/meta.yaml (3)

17-19: LGTM: Build configuration is correct

The build number increment and run_exports configuration are appropriate for adding new platform support while maintaining ABI compatibility.


47-48: LGTM: Improved license specification

The update to use SPDX identifier "GPL-2.0-or-later" and addition of license_family improves metadata clarity and follows best practices.


61-62: Verify dependency compatibility with aarch64

The addition of aarch64 support is correctly specified. However, we should verify that all dependencies (especially the compiled ones like samtools and R packages) are available for the ARM architecture.

✅ Verification successful

Let me try a different approach to verify the dependencies by checking the meta.yaml file directly and then searching for these packages in the bioconda repository.


Let me check the specific aarch64 related content in the found recipes to verify the support.


ARM64 support is properly aligned with dependencies

The key dependencies samtools and bioconductor-rtracklayer already have aarch64 support explicitly declared in their recipes. Both packages list linux-aarch64 in their additional-platforms section, indicating they are built and tested for ARM architecture. Samtools even has additional osx-arm64 support. The other dependencies (perl, r-base) are core packages available across architectures through conda-forge.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if all dependencies are available for aarch64
echo "Checking dependency availability for aarch64..."

DEPS=("perl" "r-base" "bioconductor-rtracklayer" "samtools")

for dep in "${DEPS[@]}"; do
    echo "Checking $dep..."
    # Search for the package in conda-forge and bioconda
    conda search --json -c conda-forge -c bioconda "$dep" | jq -r '.[] | select(.platform == "linux-aarch64") | .version' || echo "No aarch64 build found for $dep"
done

Length of output: 1289


Script:

#!/bin/bash
# First, let's check all dependencies in the meta.yaml
echo "Dependencies from meta.yaml:"
cat recipes/control-freec/meta.yaml | grep -A20 "requirements:"

# Now let's check if these packages exist in bioconda-recipes for aarch64
echo -e "\nChecking bioconda-recipes for aarch64 support:"
# Using rg to search for aarch64 in the package recipes
for pkg in "perl" "r-base" "bioconductor-rtracklayer" "samtools"; do
    echo -e "\nChecking $pkg:"
    if [ -d "recipes/$pkg" ]; then
        rg "aarch64|arm64" "recipes/$pkg" -l
    fi
done

Length of output: 1405


Script:

#!/bin/bash
# Check the content of found recipes for aarch64 support details
echo "Checking bioconductor-rtracklayer aarch64 support:"
rg "aarch64|arm64" recipes/bioconductor-rtracklayer/meta.yaml -A 2 -B 2

echo -e "\nChecking samtools aarch64 support:"
rg "aarch64|arm64" recipes/samtools/meta.yaml -A 2 -B 2

# Let's also check if there are any skip directives or constraints
echo -e "\nChecking for architecture constraints:"
for file in recipes/bioconductor-rtracklayer/meta.yaml recipes/samtools/meta.yaml; do
    echo -e "\nChecking $file for skip directives:"
    rg "skip|platform" "$file" -A 2 -B 2
done

Length of output: 1367

Comment on lines +2 to +3
# Debug for ARM build, can remove later
set -x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add shell safety flags and plan debug mode cleanup.

While set -x is helpful for debugging ARM builds, consider:

  1. Adding recommended shell safety flags
  2. Removing debug mode once ARM issues are resolved
 #!/bin/bash
-# Debug for ARM build, can remove later
-set -x
+set -euo pipefail
+
+# TODO: Remove after ARM debugging is complete
+if [[ "${CONDA_BUILD_CROSS_COMPILATION:-}" == "1" ]]; then
+    set -x
+fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Debug for ARM build, can remove later
set -x
#!/bin/bash
set -euo pipefail
# TODO: Remove after ARM debugging is complete
if [[ "${CONDA_BUILD_CROSS_COMPILATION:-}" == "1" ]]; then
set -x
fi

Comment on lines 33 to 34
- ls -l
- ls -l bin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Remove debugging directory listing commands

The ls commands appear to be debugging artifacts and don't contribute to package validation. The existing test commands already properly verify the installation of all components.

  test:
    commands:
-    - ls -l
-    - ls -l bin
     - freec
     - freec2bed.pl
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- ls -l
- ls -l bin
- freec
- freec2bed.pl

@dslarm dslarm closed this Nov 11, 2024
@dslarm dslarm deleted the arm_support_cf_debug branch November 11, 2024 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants