-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Update Spring to support ARM #51773
Update Spring to support ARM #51773
Conversation
📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 WalkthroughWalkthroughThe pull request modifies the Possibly related PRs
Suggested labels
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
recipes/spring/build.sh (2)
11-11
: Quote the architecture comparison for better reliability.
While the architecture detection works, it should follow shell scripting best practices.
-if [ $(arch) == aarch64 ]; then
+if [ "$(arch)" = "aarch64" ]; then
Note: Also using =
instead of ==
for better POSIX compatibility.
🧰 Tools
🪛 Shellcheck
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
11-19
: Clean up script formatting.
The script would benefit from consistent formatting:
- Normalize indentation in the if-else block
- Remove extra blank lines at the end
if [ "$(arch)" = "aarch64" ]; then
- cmake ..
- else
- cmake -Dspring_optimize_for_portability=ON ..
-fi
+ cmake ..
+else
+ cmake -Dspring_optimize_for_portability=ON ..
+fi
make
cp spring $PREFIX/bin
-
-
🧰 Tools
🪛 Shellcheck
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- recipes/spring/build.sh (1 hunks)
🧰 Additional context used
🪛 Shellcheck
recipes/spring/build.sh
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
🔇 Additional comments (1)
recipes/spring/build.sh (1)
12-14
: Verify the removal of portability optimization for ARM.
Please confirm:
- Why is the portability optimization flag specifically removed for ARM?
- Are there any performance implications of this change?
Let's check if there's any documentation about ARM-specific build requirements:
Don't forget to bump the build number here too |
Drop newlines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's see what the CI says
you might need this patch for the recipe to build in ARM (not sure about the CI, though) diff --git a/src/libbsc/bsc.h b/src/libbsc/bsc.h
index 25230dc..caca189 100644
--- a/src/libbsc/bsc.h
+++ b/src/libbsc/bsc.h
@@ -48,6 +48,7 @@ preprocessor macro LIBBSC_SORT_TRANSFORM_SUPPORT at compile time.
#ifndef SPRING_LIBBSC_BSC_H_
#define SPRING_LIBBSC_BSC_H_
+#include <cstdint>
#include "params.h"
namespace spring {
diff --git a/src/util.h b/src/util.h
index 30bad68..a72a0b6 100644
--- a/src/util.h
+++ b/src/util.h
@@ -17,6 +17,7 @@ limitations under the License.
#include <fstream>
#include <string>
+#include <cstdint>
namespace spring { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
recipes/spring/build.sh (1)
Line range hint 1-15
: Consider adding error handling for cmake configuration.
The build script would benefit from error handling to catch potential cmake configuration issues.
Consider adding error handling:
if [ "$(arch)" = "aarch64" ]; then
- cmake ..
+ if ! cmake ..; then
+ echo "Failed to configure cmake for ARM architecture"
+ exit 1
+ fi
else
- cmake -Dspring_optimize_for_portability=ON ..
+ if ! cmake -Dspring_optimize_for_portability=ON ..; then
+ echo "Failed to configure cmake with portability optimization"
+ exit 1
+ fi
fi
🧰 Tools
🪛 Shellcheck
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
recipes/spring/meta.yaml (1)
The search results show that while many files use fixed-width integer types, they include <stdint.h> rather than . However, for ARM compatibility, it's safer to use in C++ code. Let me generate the final response:
Add header to ensure ARM compatibility
The codebase extensively uses fixed-width integer types but includes <stdint.h> instead of . For C++ code, is the proper header and helps ensure compatibility across platforms including ARM.
- Add
#include <cstdint>
to the following key files:- src/bsc.h
- src/util.h
The suggested patch in the recipe will help ensure proper integer type definitions are available on ARM platforms.
🔗 Analysis chain
Line range hint 11-13
: Consider adding the suggested patch for ARM compatibility.
Based on the PR comments, a patch adding <cstdint>
headers might be necessary for ARM builds. Consider adding a patches section:
source:
url: https://github.com/shubhamchandak94/Spring/archive/v{{ version }}.tar.gz
sha256: f3fdd6317295d143b244ca9dc0ca03e132a6fec3a60b8e42a514a705d49d6264
+ patches:
+ - cstdint.patch
And create a cstdint.patch
file in the recipe directory with:
diff --git a/src/bsc.h b/src/bsc.h
index abc123..def456 100644
--- a/src/bsc.h
+++ b/src/bsc.h
@@ -1,2 +1,3 @@
+#include <cstdint>
// rest of the file
diff --git a/src/util.h b/src/util.h
index abc123..def456 100644
--- a/src/util.h
+++ b/src/util.h
@@ +1,2 +1,3 @@
+#include <cstdint>
// rest of the file
Let's verify if the source files need this patch:
Let me generate another script to check if the Spring source code uses fixed-width integer types without cstdint
header.
Based on the search results, I can see that the codebase makes extensive use of fixed-width integer types like uint8_t, uint16_t, uint32_t, uint64_t, etc., but does not include header in most files. Let me verify if the header is included through some other means.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if source files already include cstdint
# or if they use fixed-width integer types without it
# First, find the source files
echo "Searching for bsc.h and util.h..."
fd -t f "bsc\.h|util\.h"
# Then, check for existing cstdint inclusion
echo -e "\nChecking for existing cstdint inclusion..."
rg "#include\s+[<\"]cstdint[>\"]" -l
# Finally, check for usage of fixed-width integer types
echo -e "\nChecking for fixed-width integer type usage..."
rg "(?:u?int(?:8|16|32|64)_t)" -l
Length of output: 1484
Script:
#!/bin/bash
# Download and extract the source to check the actual files
mkdir -p temp && cd temp
curl -L https://github.com/shubhamchandak94/Spring/archive/v1.1.1.tar.gz -o spring.tar.gz
tar xf spring.tar.gz
# Check if source files exist and contain fixed-width integer types
echo "Checking source files for fixed-width integer types..."
cd Spring-1.1.1
find . -type f -name "*.h" -o -name "*.cpp" | while read -r file; do
echo "=== $file ==="
# Check for fixed-width integer types
rg "(?:u?int(?:8|16|32|64)_t)" "$file" || true
# Check for cstdint inclusion
rg "#include\s+[<\"]cstdint[>\"]" "$file" || true
echo
done
Length of output: 226594
Script:
#!/bin/bash
# Check for indirect inclusion of cstdint through other headers
rg -l '#include\s+[<"]stdint\.h[>"]'
Length of output: 3184
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- recipes/spring/build.sh (1 hunks)
- recipes/spring/meta.yaml (1 hunks)
🧰 Additional context used
🪛 Shellcheck
recipes/spring/build.sh
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
🔇 Additional comments (2)
recipes/spring/build.sh (1)
11-15
: Verify ARM-specific build configuration.
The changes look good for supporting ARM architecture by removing the portability optimization flag. However, we should verify if any additional compiler flags or dependencies are needed based on the suggested patch from @pabloaledo regarding the <cstdint>
header.
Let's verify if the source files need patching:
Would you like me to help implement the patch for adding the <cstdint>
header as suggested in the PR comments?
🧰 Tools
🪛 Shellcheck
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
recipes/spring/meta.yaml (1)
8-8
: LGTM! Build number correctly incremented.
The build number has been incremented from 2 to 3 as requested, which is appropriate for tracking the ARM compatibility changes.
recipes/spring/build.sh
Outdated
if [ $(arch) == aarch64 ]; then | ||
cmake .. | ||
else | ||
cmake -Dspring_optimize_for_portability=ON .. | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix word splitting vulnerability in architecture detection.
The arch
command should be quoted to prevent word splitting issues.
Apply this fix:
-if [ $(arch) == aarch64 ]; then
+if [ "$(arch)" = "aarch64" ]; then
Also note the use of =
instead of ==
for better POSIX compatibility.
📝 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.
if [ $(arch) == aarch64 ]; then | |
cmake .. | |
else | |
cmake -Dspring_optimize_for_portability=ON .. | |
fi | |
if [ "$(arch)" = "aarch64" ]; then | |
cmake .. | |
else | |
cmake -Dspring_optimize_for_portability=ON .. | |
fi |
🧰 Tools
🪛 Shellcheck
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
recipes/spring/build.sh (2)
11-15
: Improve code style and documentation.
While the architecture-specific cmake configuration is a good approach, consider these improvements:
- Fix the inconsistent indentation between the if and else blocks
- Add a comment explaining why ARM64 requires different cmake flags
Apply this diff:
-if [ $(arch) == "aarch64" ]; then
- cmake ..
- else
- cmake -Dspring_optimize_for_portability=ON ..
-fi
+# ARM64 uses native optimization while other architectures require portability flags
+if [ $(arch) == "aarch64" ]; then
+ cmake ..
+else
+ cmake -Dspring_optimize_for_portability=ON ..
+fi
🧰 Tools
🪛 Shellcheck
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
Line range hint 1-18
: Implementation successfully adds ARM support.
The changes effectively implement ARM architecture support while maintaining compatibility with other architectures. The environment setup and build process are well-structured.
Consider adding this change to your package documentation to inform users about the architecture-specific optimizations.
🧰 Tools
🪛 Shellcheck
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- recipes/spring/Makefile.patch (1 hunks)
- recipes/spring/build.sh (1 hunks)
✅ Files skipped from review due to trivial changes (1)
- recipes/spring/Makefile.patch
🧰 Additional context used
🪛 Shellcheck
recipes/spring/build.sh
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
Describe your pull request here
Please read the guidelines for Bioconda recipes before opening a pull request (PR).
General instructions
@BiocondaBot please add label
command.@bioconda/core
in a comment.Instructions for avoiding API, ABI, and CLI breakage issues
Conda is able to record and lock (a.k.a. pin) dependency versions used at build time of other recipes.
This way, one can avoid that expectations of a downstream recipe with regards to API, ABI, or CLI are violated by later changes in the recipe.
If not already present in the meta.yaml, make sure to specify
run_exports
(see here for the rationale and comprehensive explanation).Add a
run_exports
section like this:with
...
being one of:{{ pin_subpackage("myrecipe", max_pin="x") }}
{{ pin_subpackage("myrecipe", max_pin="x.x") }}
{{ pin_subpackage("myrecipe", max_pin="x.x") }}
(in such a case, please add a note that shortly mentions your evidence for that){{ pin_subpackage("myrecipe", max_pin="x.x.x") }}
(in such a case, please add a note that shortly mentions your evidence for that){{ pin_subpackage("myrecipe", max_pin=None) }}
while replacing
"myrecipe"
with eithername
if aname|lower
variable is defined in your recipe or with the lowercase name of the package in quotes.Bot commands for PR management
Please use the following BiocondaBot commands:
Everyone has access to the following BiocondaBot commands, which can be given in a comment:
@BiocondaBot please update
@BiocondaBot please add label
please review & merge
label.@BiocondaBot please fetch artifacts
You can use this to test packages locally.
Note that the
@BiocondaBot please merge
command is now depreciated. Please just squash and merge instead.Also, the bot watches for comments from non-members that include
@bioconda/<team>
and will automatically re-post them to notify the addressed<team>
.