First successful build of Xilinx XRT
What an absolute nightmare, and we are far from the end.
This commit is contained in:
parent
c5400955c7
commit
df8b5b2d67
25
pkgs/aiebu.patch
Normal file
25
pkgs/aiebu.patch
Normal file
@ -0,0 +1,25 @@
|
||||
--- a/src/runtime_src/core/common/aiebu/src/cpp/aiebu/utils/asm/CMakeLists.txt
|
||||
+++ b/src/runtime_src/core/common/aiebu/src/cpp/aiebu/utils/asm/CMakeLists.txt
|
||||
@@ -23,8 +23,6 @@ add_executable(aiebu-asm $<TARGET_OBJECTS:aiebu_asm_objects>)
|
||||
target_link_libraries(aiebu-asm PRIVATE aiebu_static)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
- target_link_options(aiebu-asm PRIVATE "-static")
|
||||
- set_target_properties(aiebu-asm PROPERTIES INSTALL_RPATH "" BUILD_RPATH "")
|
||||
|
||||
# Create a dynamically linked executable. aiebu-asm-dyn, on Linux for running
|
||||
# valgrind, etc. This binary is not released for deployment but only used for
|
||||
@@ -35,13 +33,6 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
target_link_libraries(aiebu-asm-dyn PRIVATE aiebu_static)
|
||||
endif()
|
||||
|
||||
-# This custom target fails if aiebu-asm has any dynamic dependencies
|
||||
-add_custom_target(check_dynamic_deps ALL
|
||||
- COMMAND ${CMAKE_COMMAND} -E echo "Checking for dynamic dependencies ..."
|
||||
- COMMAND ${CMAKE_COMMAND} -P "${AIEBU_SOURCE_DIR}/cmake/depends.cmake" $<TARGET_FILE:aiebu-asm> aiebu-asm_depends.txt
|
||||
- DEPENDS aiebu-asm
|
||||
- )
|
||||
-
|
||||
install(TARGETS aiebu-asm
|
||||
RUNTIME DESTINATION ${AIEBU_INSTALL_BIN_DIR}
|
||||
CONFIGURATIONS Debug Release COMPONENT Runtime
|
@ -42,4 +42,5 @@ final: prev:
|
||||
});
|
||||
|
||||
prometheus-slurm-exporter = prev.callPackage ./slurm-exporter.nix { };
|
||||
xilinx-xrt = prev.callPackage ./xilinx-xrt.nix { };
|
||||
}
|
||||
|
13
pkgs/xilinx-xrt-icd.patch
Normal file
13
pkgs/xilinx-xrt-icd.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/src/CMake/icd.cmake b/src/CMake/icd.cmake
|
||||
index 255a2e3d8..460a6d4c7 100644
|
||||
--- a/src/CMake/icd.cmake
|
||||
+++ b/src/CMake/icd.cmake
|
||||
@@ -10,7 +10,7 @@ configure_file (
|
||||
${ICD_FILE_NAME}
|
||||
)
|
||||
|
||||
-set(OCL_ICD_INSTALL_PREFIX "/etc/OpenCL/vendors")
|
||||
+set(OCL_ICD_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/etc/OpenCL/vendors")
|
||||
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${ICD_FILE_NAME}
|
||||
DESTINATION ${OCL_ICD_INSTALL_PREFIX}
|
84
pkgs/xilinx-xrt.nix
Normal file
84
pkgs/xilinx-xrt.nix
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
stdenv
|
||||
, fetchFromGitHub
|
||||
, enableDebug ? false
|
||||
, lib
|
||||
, cmake
|
||||
, pkg-config
|
||||
, libdrm
|
||||
, libelf
|
||||
, opencl-headers
|
||||
, ocl-icd
|
||||
, git
|
||||
, boost
|
||||
, ncurses
|
||||
, openssl
|
||||
, rapidjson
|
||||
, protobuf
|
||||
, python3
|
||||
, libuuid
|
||||
, curl
|
||||
, libsystemtap
|
||||
, libxcrypt
|
||||
, udev
|
||||
#, glibc
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "xilinx-xrt";
|
||||
version = "dc81a9cc";
|
||||
src = fetchFromGitHub {
|
||||
owner = "Xilinx";
|
||||
repo = "XRT";
|
||||
rev = "dc81a9cc852bf44e71aa3edde7c8f7d54f355eab";
|
||||
hash = "sha256-SG1gIO8Bvgs5XQ7HswjWNavPH+m8xHXqauztuJa6aEo=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
dontStrip = true;
|
||||
patches = [
|
||||
./aiebu.patch
|
||||
./xilinx-xrt-icd.patch
|
||||
];
|
||||
cmakeFlags = [
|
||||
#"--trace-expand"
|
||||
#"--debug-find-pkg=OpenCL"
|
||||
"-DXRT_INSTALL_PREFIX=${placeholder "out"}"
|
||||
"-DXRT_INSTALL_DIR=${placeholder "out"}"
|
||||
"-DXRT_NATIVE_BUILD=yes"
|
||||
"-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON"
|
||||
];
|
||||
# A directory named "build" already exists
|
||||
cmakeBuildDir = "the-build";
|
||||
|
||||
# Replace all occurences of /usr to $out, although some are not correct. By
|
||||
# default they are replaced by /var/empty
|
||||
dontFixCmake = true;
|
||||
preConfigure = ''
|
||||
find "." -type f \( -name "*.cmake" -o -name "*.cmake.in" -o -name CMakeLists.txt \) -print |
|
||||
while read fn; do
|
||||
sed -e 's^/usr\([ /]\|$\)^'$out'\1^g' -e 's^/opt\([ /]\|$\)^'$out'\1^g' < "$fn" > "$fn.tmp"
|
||||
mv "$fn.tmp" "$fn"
|
||||
done
|
||||
'';
|
||||
# preBuild = ''
|
||||
# set -x
|
||||
# cat CMakeCache.txt
|
||||
# echo --------------------------------------
|
||||
# grep -R '/var/empty' .
|
||||
# echo --------------------------------------
|
||||
# set +x
|
||||
# exit 1
|
||||
# '';
|
||||
buildFlags = [
|
||||
#"VERBOSE=1"
|
||||
];
|
||||
nativeBuildInputs = [ cmake pkg-config git ];
|
||||
buildInputs = [ libdrm.dev opencl-headers ocl-icd boost.dev ncurses
|
||||
openssl.dev rapidjson protobuf python3 libelf libuuid.dev curl.dev libsystemtap
|
||||
libxcrypt udev.out udev.dev
|
||||
#glibc.static
|
||||
];
|
||||
hardeningDisable = [ "all" ];
|
||||
}
|
Loading…
Reference in New Issue
Block a user