diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c9d5dd..305f0ad 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,6 +4,7 @@ repos: rev: v4.4.0 hooks: - id: end-of-file-fixer + exclude: \.patch$ - id: trailing-whitespace - repo: https://github.com/hadolint/hadolint rev: v2.12.0 diff --git a/julia/Makefile b/julia/Makefile index 85d416e..126ced5 100644 --- a/julia/Makefile +++ b/julia/Makefile @@ -1,3 +1,7 @@ .PHONY: build build: docker build -t parca-demo:julia . + +build-patched: + docker run --interactive --rm --volume="${PWD}:/build" --workdir=/build \ + docker.io/nixos/nix:2.11.1 sh -c '$$(nix-build --no-out-link)' | docker load diff --git a/julia/default.nix b/julia/default.nix new file mode 100644 index 0000000..d88aaa1 --- /dev/null +++ b/julia/default.nix @@ -0,0 +1,25 @@ +{ pkgs ? import + (builtins.fetchTarball + "https://github.com/NixOS/nixpkgs/archive/nixos-22.11.tar.gz" + ) + { } +}: + +pkgs.dockerTools.streamLayeredImage { + name = "parca-demo"; + tag = "julia"; + contents = [ + (pkgs.julia.overrideAttrs (current: { + patches = current.patches ++ [ + ./patches/0001-disable-frame-pointer-omission.patch + ]; + doInstallCheck = false; + })) + (pkgs.writeTextDir "app/main.jl" (builtins.readFile ./main.jl)) + ]; + config = { + Cmd = [ "julia" "main.jl" ]; + Env = [ "ENABLE_JITPROFILING=1" ]; + WorkingDir = "/app"; + }; +} diff --git a/julia/patches/0001-disable-frame-pointer-omission.patch b/julia/patches/0001-disable-frame-pointer-omission.patch new file mode 100644 index 0000000..9aaa423 --- /dev/null +++ b/julia/patches/0001-disable-frame-pointer-omission.patch @@ -0,0 +1,20 @@ +commit 1d5a4168933d19df4784aa6c73a5a7653610cf04 +Author: Maxime Brunet +Date: Sat Feb 11 11:37:06 2023 -0800 + + Disable Frame Pointer Omission on Linux + +diff --git a/src/codegen.cpp b/src/codegen.cpp +index 104f77f8d6..5a1284be6d 100644 +--- a/src/codegen.cpp ++++ b/src/codegen.cpp +@@ -10,7 +10,7 @@ + #if defined(_CPU_X86_) + #define JL_NEED_FLOATTEMP_VAR 1 + #endif +-#if defined(_OS_WINDOWS_) || defined(_OS_FREEBSD_) ++#if defined(_OS_WINDOWS_) || defined(_OS_LINUX_) || defined(_OS_FREEBSD_) + #define JL_DISABLE_FPO + #endif + +