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

cuttlefish: add arm64 build #51956

Merged
merged 6 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions recipes/cuttlefish/build.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/bin/bash

mkdir build
cd build
export INCLUDES="-I${PREFIX}/include"
export LIBPATH="-L${PREFIX}/lib"
export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib"
export CXXFLAGS="${CXXFLAGS} -O3 -fcommon -I${PREFIX}/include"
Comment on lines +3 to +6
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

Optimize environment variable configuration

Several suggestions to improve the build configuration:

  1. INCLUDES and LIBPATH appear redundant as they're already covered by CXXFLAGS and LDFLAGS
  2. The -fcommon flag suggests potential symbol collision issues. Consider fixing the multiple symbol definitions instead
  3. Consider adding architecture-specific optimizations for ARM64 builds
-export INCLUDES="-I${PREFIX}/include"
-export LIBPATH="-L${PREFIX}/lib"
 export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib"
-export CXXFLAGS="${CXXFLAGS} -O3 -fcommon -I${PREFIX}/include"
+export CXXFLAGS="${CXXFLAGS} -O3 -I${PREFIX}/include"
+if [[ "${target_platform}" == "osx-arm64" ]]; then
+    export CXXFLAGS="${CXXFLAGS} -mcpu=apple-m1"
+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
export INCLUDES="-I${PREFIX}/include"
export LIBPATH="-L${PREFIX}/lib"
export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib"
export CXXFLAGS="${CXXFLAGS} -O3 -fcommon -I${PREFIX}/include"
export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib"
export CXXFLAGS="${CXXFLAGS} -O3 -I${PREFIX}/include"
if [[ "${target_platform}" == "osx-arm64" ]]; then
export CXXFLAGS="${CXXFLAGS} -mcpu=apple-m1"
fi


unamestr=`uname`

if [ "$unamestr" == 'Darwin' ];
then
export MACOSX_DEPLOYMENT_TARGET=10.15
export CFLAGS="${CFLAGS} -fcommon -D_LIBCPP_DISABLE_AVAILABILITY"
export CXXFLAGS="${CXXFLAGS} -fcommon -D_LIBCPP_DISABLE_AVAILABILITY"
else
# It's dumb and absurd that the KMC build can't find the bzip2 header <bzlib.h>
export C_INCLUDE_PATH="$PREFIX/include"
export CPLUS_INCLUDE_PATH="$PREFIX/include"
if [[ `uname` == 'Darwin' ]]; then
export MACOSX_DEPLOYMENT_TARGET=10.11
export CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY"
export CONFIG_ARGS="-DCMAKE_FIND_FRAMEWORK=NEVER -DCMAKE_FIND_APPBUNDLE=NEVER"
Comment on lines +8 to +11
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Review macOS deployment target for ARM64 compatibility

Setting MACOSX_DEPLOYMENT_TARGET=10.11 might be too old for ARM64 support, as Apple Silicon requires at least macOS 11.0 (Big Sur).

 if [[ `uname` == 'Darwin' ]]; then
-    export MACOSX_DEPLOYMENT_TARGET=10.11
+    if [[ "${target_platform}" == "osx-arm64" ]]; then
+        export MACOSX_DEPLOYMENT_TARGET=11.0
+    else
+        export MACOSX_DEPLOYMENT_TARGET=10.11
+    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
if [[ `uname` == 'Darwin' ]]; then
export MACOSX_DEPLOYMENT_TARGET=10.11
export CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY"
export CONFIG_ARGS="-DCMAKE_FIND_FRAMEWORK=NEVER -DCMAKE_FIND_APPBUNDLE=NEVER"
if [[ `uname` == 'Darwin' ]]; then
if [[ "${target_platform}" == "osx-arm64" ]]; then
export MACOSX_DEPLOYMENT_TARGET=11.0
else
export MACOSX_DEPLOYMENT_TARGET=10.11
fi
export CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY"
export CONFIG_ARGS="-DCMAKE_FIND_FRAMEWORK=NEVER -DCMAKE_FIND_APPBUNDLE=NEVER"

else
# It's dumb and absurd that the KMC build can't find the bzip2 header <bzlib.h>
export C_INCLUDE_PATH="$PREFIX/include"
export CPLUS_INCLUDE_PATH="$PREFIX/include"
export CONFIG_ARGS=""
fi

cmake \
-DINSTANCE_COUNT=64 \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCONDA_BUILD=ON \
..
make install
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
-DINSTANCE_COUNT=64 \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
"${CONFIG_ARGS}"
cmake --build build/ --target install -j "${CPU_COUNT}" -v
104 changes: 0 additions & 104 deletions recipes/cuttlefish/build_failure.osx-64.yaml

This file was deleted.

24 changes: 12 additions & 12 deletions recipes/cuttlefish/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,24 @@ package:
version: {{ version }}

build:
number: 2
number: 3
run_exports:
- {{ pin_subpackage('cuttlefish', max_pin="x") }}

source:
url: https://github.com/COMBINE-lab/cuttlefish/archive/refs/tags/v{{ version }}.tar.gz
sha256: d524aaeed5dd86ce256c5540661eda388cecbfad2ce4dde86e52539b2b1d6ed5

requirements:
build:
- autoconf
- cmake >=3.14.0
- make
- {{ compiler('cxx') }}
- {{ compiler('c') }}
- zlib
- bzip2
host:
- jemalloc >=5.1.0
- zlib
- bzip2
run:
- bzip2
- zlib

test:
commands:
Expand All @@ -36,17 +32,21 @@ test:
- cuttlefish version

about:
home: https://github.com/COMBINE-lab/cuttlefish
license: BSD-3-Clause
home: "https://github.com/COMBINE-lab/cuttlefish"
license: "BSD-3-Clause"
license_family: BSD
license_file: LICENSE
summary: Construction of the compacted de Bruijn graph efficiently
dev_url: https://github.com/COMBINE-lab/cuttlefish
doc_url: https://github.com/COMBINE-lab/cuttlefish#readme
summary: "Construction of the compacted de Bruijn graph efficiently."
dev_url: "https://github.com/COMBINE-lab/cuttlefish"
doc_url: "https://github.com/COMBINE-lab/cuttlefish/blob/v{{ version }}/README.md"

extra:
additional-platforms:
- osx-arm64
recipe-maintainers:
- jamshed
- rob-p
identifiers:
- doi:10.1093/bioinformatics/btab309
- doi:10.1186/s13059-022-02743-6
- biotools:cuttlefish