Skip to content

Commit fa82033

Browse files
mszabo-wikiameta-codesync[bot]
authored andcommitted
Fix OPAM build for Arm (#9644)
Summary: Fetch the arm64 version of opam for installing deps, and disable the `ocaml-option-fp` flag which is not supported on aarch64. The pinned versions of `dune` and `landmarks-ppx` still need updating to work on aarch64. This will be done as a followup since it seems to be causing issues in internal CI at the moment. Pull Request resolved: #9644 Reviewed By: Wilfred Differential Revision: D84053694 fbshipit-source-id: 7a2b9f746a613c55366992dbea0832b8bbf10523
1 parent 352dd1d commit fa82033

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

hphp/hack/ocaml_deps_data.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ export OCAML_BASE_NAME=ocaml-variants
4949
export OCAML_COMPILER_NAME="${OCAML_BASE_NAME}.${HACK_OCAML_VERSION}"
5050

5151
UNAME=$(uname -s)
52-
if [ "$UNAME" != "Linux" ]; then
52+
ARCH=$(uname -m)
53+
if [ "$UNAME" != "Linux" ] || [ "$ARCH" == "aarch64" ]; then
5354
# Some variants are not supported on other platforms, so we use the base
5455
# version instead.
55-
# +fp is known not to work on Macs, but other combinations have not been
56+
# +fp is known not to work on Macs or on arm64, but other combinations have not been
5657
# tested.
57-
echo 'Non linux platform detected, skipping +fp'
58+
echo 'Platform is not Linux or is arm64, skipping +fp'
5859
else
5960
HACK_OPAM_DEPS+=(ocaml-option-fp)
6061
export HACK_OPAM_DEPS

third-party/opam/CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,26 @@
1010
# This also avoids the need to depend on gpg in the installation.
1111
include(HPHPFunctions)
1212

13+
if (IS_X64)
14+
set(OPAM_ARCH "x86_64")
15+
set(OPAM_LINUX_HASH "03c6a85f13a452749fdb2271731f3624a3993498ff2b304123231a8f2b26ccf1182d12119466e9a85f4de370fca51bd61d0eefe6280d3ca087cf4620fdc59a22")
16+
set(OPAM_DARWIN_HASH "1c9acee545c851dd3701229e3a6aa7b5650620e37e01400d797a4b1fbeeb614adc459411283684e223a72fda8b14ba6c6e5482661485f888819f6a2a02e4d279")
17+
elseif (IS_AARCH64)
18+
set(OPAM_ARCH "arm64")
19+
set(OPAM_LINUX_HASH "216185106deb81db0e9cb329dd7f01d097173e1e7a055a1af8525cdb4dde6d443e4bf4ef8377f1cbd4c9fecdc7ea03e6f294dad30b10a0e83959476018e24972")
20+
set(OPAM_DARWIN_HASH "c8a46b2d554e4b2a68d5004ad4cee24425c75a6957c40af49d21e05875925e59d29ef3c9f0d7703f9c209b3f50107959fa853b32143f9e7deb7b4cc54006d668")
21+
endif()
22+
1323
SET_HHVM_THIRD_PARTY_SOURCE_ARGS(
1424
OPAM_DOWNLOAD_ARGS
1525
Linux_URL
16-
"https://github.com/ocaml/opam/releases/download/2.1.0/opam-2.1.0-x86_64-linux"
26+
"https://github.com/ocaml/opam/releases/download/2.1.0/opam-2.1.0-${OPAM_ARCH}-linux"
1727
Darwin_URL
18-
"https://github.com/ocaml/opam/releases/download/2.1.0/opam-2.1.0-x86_64-macos"
28+
"https://github.com/ocaml/opam/releases/download/2.1.0/opam-2.1.0-${OPAM_ARCH}-macos"
1929
Linux_HASH
20-
"SHA512=03c6a85f13a452749fdb2271731f3624a3993498ff2b304123231a8f2b26ccf1182d12119466e9a85f4de370fca51bd61d0eefe6280d3ca087cf4620fdc59a22"
30+
"SHA512=${OPAM_LINUX_HASH}"
2131
Darwin_HASH
22-
"SHA512=1c9acee545c851dd3701229e3a6aa7b5650620e37e01400d797a4b1fbeeb614adc459411283684e223a72fda8b14ba6c6e5482661485f888819f6a2a02e4d279"
32+
"SHA512=${OPAM_DARWIN_HASH}"
2333
)
2434

2535
include(ExternalProject)

0 commit comments

Comments
 (0)