Skip to content

Instantly share code, notes, and snippets.

@paschalis-mpeis
Last active October 22, 2024 10:37
Show Gist options
  • Save paschalis-mpeis/9eb878f73e18fb9d3f996ae7c59d4792 to your computer and use it in GitHub Desktop.
Save paschalis-mpeis/9eb878f73e18fb9d3f996ae7c59d4792 to your computer and use it in GitHub Desktop.
Reproducer files for ISSUE
FROM --platform=linux/aarch64 ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive
### Dependencies:
# for clang-18 installation (pre-compiled), pyenv, and mongodb
RUN apt-get update && \
apt-get install -y --no-install-recommends \
make build-essential wget curl llvm \
lsb-release software-properties-common gnupg git \
zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev \
libffi-dev libcurl4-openssl-dev liblzma-dev libssl-dev openjdk-21-jdk && \
apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /home/bolt
### Install clang-18 (precompiled)
# Ubuntu clang version 18.1.8 (++20240731024944+3b5b5c1ec4a3-1~exp1~20240731145000.144)
RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
RUN wget https://apt.llvm.org/llvm.sh && \
chmod +x llvm.sh && \
./llvm.sh 18
RUN which clang-18
### Prepare MongoDB sources:
RUN git clone --branch r7.0.5 https://github.com/mongodb/mongo.git
# Disable debug info for MongoDB
RUN cd mongo && \
sed -e '/-g2/ s/^#*/#/' -i SConstruct
# Apply patch that I attach in the issue:
RUN wget https://gist.githubusercontent.com/paschalis-mpeis/9eb878f73e18fb9d3f996ae7c59d4792/raw/e9de7728a517e153d4980225ecac92d2e0923498/mongo.patch && \
cd mongo && \
git config --global user.email "you@example.com" && \
git am ../mongo.patch
## Install MongoDB Dependencies and setup environment:
# Install pyenv (https://github.com/pyenv) and use it to set python to 3.10.12
RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
RUN export PYENV_ROOT="$HOME/.pyenv" && \
export PATH="$PYENV_ROOT/bin:$PATH" && \
eval "$(pyenv init -)" && \
pyenv install 3.10.12 && \
pyenv global 3.10.12 && \
echo "System Python : $(python3 --version) $(which python3)" && \
python3 -m venv mongo-db-venv --prompt mongo && \
. mongo-db-venv/bin/activate && \
cd mongo && \
python3 -m ensurepip --upgrade && \
python3 -m pip install --upgrade setuptools && \
pip install -r etc/pip/compile-requirements.txt
## Compile MongoDB Stage-0:
# Activates again the python venv and uses it to launch SCons build system.
# In separate directive from above so it's cacheable.
RUN echo "Compiling MongoDB:" && \
export PYENV_ROOT="$HOME/.pyenv" && \
export PATH="$PYENV_ROOT/bin:$PATH" && \
eval "$(pyenv init -)" && \
pyenv global 3.10.12 && \
echo "System Python : $(python3 --version) $(which python3)" && \
. mongo-db-venv/bin/activate && \
cd mongo && \
echo "Used Python : $(python3 --version) $(which python3)" && \
python3 buildscripts/scons.py install-mongod \
CC=clang-18 CXX=clang++-18 \
CCFLAGS="-fno-omit-frame-pointer -Wno-deprecated-non-prototype -Wno-enum-constexpr-conversion" \
LINKFLAGS="-Wl,-q"; exit 0
RUN echo "Binary at: mongo/build/install/bin/mongod " && \
ls -lh mongo/build/install/bin/mongod && \
echo "Has Relocations: " && \
llvm-readelf-18 --sections mongo/build/install/bin/mongod | grep .rela.text
BOLT-INFO: shared object or position-independent executable detected
BOLT-INFO: Target architecture: aarch64
BOLT-INFO: BOLT version: d78211912391b724a064ef017dbf239eff10380a
BOLT-INFO: first alloc address is 0x0
BOLT-INFO: creating new program header table at address 0x7e00000, offset 0x7e00000
BOLT-WARNING: debug info will be stripped from the binary. Use -update-debug-sections to keep it.
BOLT-INFO: enabling relocation mode
BOLT-INFO: disabling -align-macro-fusion on non-x86 platform
BOLT-INFO: enabling lite mode
BOLT-INFO: pre-processing profile using branch profile reader
BOLT-WARNING: 48 collisions detected while hashing binary objects. Use -v=1 to see the list.
BOLT-INFO: operating with basic samples profiling data (no LBR).
BOLT-INFO: normalizing samples by instruction count.
BOLT-INFO: number of removed linker-inserted veneers: 0
BOLT-INFO: 1617 out of 153847 functions in the binary (1.1%) have non-empty execution profile
BOLT-INFO: 79 functions with profile could not be optimized
BOLT-INFO: Starting stub-insertion pass
BOLT-INFO: Inserted 9008 stubs in the hot area and 11262 stubs in the cold area. Shared 781 times, iterated 3 times.
BOLT-INFO: patched build-id (flipped last bit)
From 6feb0b3640160bf0ab553d5e978a321720c8cdb8 Mon Sep 17 00:00:00 2001
From: Paschalis Mpeis <Paschalis.Mpeis@arm.com>
Date: Wed, 10 Jul 2024 09:14:06 +0100
Subject: [PATCH] PATCH
---
.../abseil-cpp/dist/absl/hash/internal/low_level_hash.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/third_party/abseil-cpp/dist/absl/hash/internal/low_level_hash.cc b/src/third_party/abseil-cpp/dist/absl/hash/internal/low_level_hash.cc
index 6f9cb9c7bff..d288f3ec94d 100644
--- a/src/third_party/abseil-cpp/dist/absl/hash/internal/low_level_hash.cc
+++ b/src/third_party/abseil-cpp/dist/absl/hash/internal/low_level_hash.cc
@@ -40,7 +40,7 @@ static uint64_t Mix(uint64_t v0, uint64_t v1) {
}
uint64_t LowLevelHash(const void* data, size_t len, uint64_t seed,
- const uint64_t salt[]) {
+ const uint64_t salt[5]) {
const uint8_t* ptr = static_cast<const uint8_t*>(data);
uint64_t starting_length = static_cast<uint64_t>(len);
uint64_t current_state = seed ^ salt[0];
--
2.42.0
This file has been truncated, but you can view the full file.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment