Skip to content

Commit 610f878

Browse files
committed
fix(arm): improve ARM build process and compatibility
Signed-off-by: Max Newcomer <[email protected]> fix: echo string formating Signed-off-by: Max Newcomer <[email protected]> fix: remove neon flag Signed-off-by: Max Newcomer <[email protected]> fix(wip): compile with gcc Signed-off-by: Max Newcomer <[email protected]>
1 parent 93d0d20 commit 610f878

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

Diff for: nix/pkgs/libspdk/default.nix

+6-10
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
, libtool
3232
, liburing
3333
, libuuid
34-
, llvmPackages
3534
, meson
3635
, nasm
3736
, ncurses
@@ -69,6 +68,8 @@ let
6968
else
7069
"--without-fio";
7170

71+
# Only set crossPrefix if we're actually cross-compiling
72+
# (which we aren't, but let's keep the logic).
7273
crossPrefix =
7374
if targetPlatform.config != buildPlatform.config then
7475
"--crossPrefix=${targetPlatform.config}"
@@ -90,13 +91,13 @@ let
9091
version = "24.05-${lib.substring 0 7 rev}";
9192
name = "${pname}-${version}";
9293
};
94+
9395
drvAttrs = rec {
9496
pname = spdk.pname;
9597
version = spdk.version;
9698

9799
src = [
98100
(fetchFromGitHub {
99-
# Note that this would only rebuild if the first 7 chars differ, but in practice should be fine
100101
name = spdk.name;
101102
owner = "openebs";
102103
repo = "spdk";
@@ -113,16 +114,13 @@ let
113114
cmake
114115
gcc
115116
help2man
116-
llvmPackages.bintools
117-
llvmPackages.clang
118-
llvmPackages.libclang
119117
meson
120118
ninja
121119
pkg-config
122120
procps
123121
udev
124122
utillinux
125-
(python3.withPackages (ps: with ps; [ pyelftools ]))
123+
pkgs.python3Packages.pyelftools
126124
] ++ extraBuildInputs;
127125

128126
buildInputs = [
@@ -158,9 +156,7 @@ let
158156
enableParallelBuilding = true;
159157
hardeningDisable = [ "all" ];
160158

161-
#
162-
# Phases.
163-
#
159+
# Our phases
164160
prePatch = ''
165161
pushd ..
166162
chmod -R u+w build_scripts
@@ -181,4 +177,4 @@ let
181177
'';
182178
};
183179
in
184-
llvmPackages.stdenv.mkDerivation drvAttrs
180+
pkgs.stdenv.mkDerivation drvAttrs

Diff for: nix/shell/spdk.nix

+10-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ let
1818
echo "FIO path : $FIO"
1919
'';
2020

21+
# Determine the system architecture
22+
system = builtins.currentSystem;
23+
24+
# Define CFLAGS based on the architecture
25+
cflagsValue = if system == "aarch64-linux"
26+
then "-march=armv8-a"
27+
else "-msse4";
28+
2129
# spdk-path argument overrides spdk argument.
2230
spdkCfg = if spdk-path != null then "none" else spdk;
2331

@@ -63,14 +71,14 @@ let
6371
};
6472

6573
# Do not use Nix libspdk. User must provide SPDK.
66-
# Build environment for development libspdk packahe is provided.
74+
# Build environment for development libspdk package is provided.
6775
none = {
6876
drv = null;
6977

7078
buildInputs = with pkgs; libspdk-dev.nativeBuildInputs ++ libspdk-dev.buildInputs;
7179

7280
shellEnv = {
73-
CFLAGS = "-msse4";
81+
CFLAGS = cflagsValue;
7482
SPDK_RS_BUILD_USE_LOGS = "yes"; # Tells spdk-rs build.rs script to rerun when build_logs dir is updated.
7583
};
7684

0 commit comments

Comments
 (0)