Skip to content
Merged
Changes from 2 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
25 changes: 20 additions & 5 deletions Q/Qiskit/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

const YGGDRASIL_DIR = "../.."
include(joinpath(YGGDRASIL_DIR, "platforms", "macos_sdks.jl"))

name = "Qiskit"
version = v"2.2.3"
version = v"2.3.0"

# Collection of sources required to complete build
sources = [
GitSource("https://github.com/Qiskit/qiskit.git", "8f33595f5b9e9c99b7aa81002655d13f48c8ac1b")
GitSource("https://github.com/Qiskit/qiskit.git", "1619be07b9cc3c14832fe8f946e22fbee400ef38")
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/qiskit
export PYO3_PYTHON=/usr/bin/python3
export PYO3_PYTHON=${host_bindir}/python3
export PYO3_CROSS_LIB_DIR=$WORKSPACE/destdir/lib
export RUSTFLAGS="-L ${libdir}"

Expand All @@ -24,6 +27,11 @@ if [[ "${target}" == *-musl* ]]; then
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=-crt-static"
fi

if [[ "${target}" == x86_64-apple-darwin* ]]; then
# Qiskit requires macOS 10.12 or higher on this platform.
export MACOSX_DEPLOYMENT_TARGET=10.12
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note that the function require_macos_sdk already sets the environment variable:

export MACOSX_DEPLOYMENT_TARGET=${macosx_deployment_target}

# The current Qiskit C API build instructions say to use a Makefile that is
# improperly formed and not suitable for cross compilation. So, instead,
# we invoke Cargo directly and copy the handful of files that result to their
Expand All @@ -32,10 +40,14 @@ cargo rustc --release --crate-type cdylib -p qiskit-cext
install -Dvm 755 "target/${rust_target}/release/libqiskit_cext.${dlext}" "${libdir}/libqiskit.${dlext}"
mkdir -p "${includedir}/qiskit"
cp -v target/qiskit.h "${includedir}"
cp -v crates/cext/include/complex.h "${includedir}/qiskit"
cp -vr crates/cext/include/qiskit/* "${includedir}/qiskit"
install_license LICENSE.txt
"""

# Install a newer SDK which contains `__ZNSt3__120__libcpp_atomic_waitEPVKvx`
# and related symbols on x86_64-apple-darwin
sources, script = require_macos_sdk("11.0", sources, script)

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = [
Expand All @@ -58,8 +70,11 @@ dependencies = [
BuildDependency(PackageSpec(name="cbindgen_jll", uuid="a52b955f-5256-5bb0-8795-313e28591558"))
# libpython is required at run time until
# https://github.com/Qiskit/qiskit/issues/14240 is fixed, which is
# currently targeted for Qiskit 2.3.0.
# currently targeted for Qiskit 2.4.0.
Dependency(PackageSpec(name="Python_jll", uuid="93d3a430-8e7c-50da-8e8d-3dfcfb3baf05"))
# Python 3.10 or higher is required by the build process, but at the moment
# only Python 3.9 is available in the base image, hence the following requirement.
HostBuildDependency(PackageSpec(name="Python_jll", uuid="93d3a430-8e7c-50da-8e8d-3dfcfb3baf05"))
]

# Build the tarballs, and possibly a `build.jl` as well.
Expand Down