GermanAizek / mongodb-without-avx

⚠ mongodb core-dump illegal instruction ✔ Building without AVX instructions not supported by cpu's
GNU General Public License v3.0
48 stars 15 forks source link

Readme updates required, mongo has moved to (python) poetry dependency management #11

Open JedMeister opened 7 months ago

JedMeister commented 7 months ago

It looks like mongo has moved to (python) poetry packaging. So the notes in this project readme referring to installing deps via pip needs an update.

It looks like the upstream build docs have been updated to reflect this. But I didn't actually think to check there first so the below is me just "following my nose". It may not be best the approach but it worked for me (on Debian 12/Bookworm). (Note at this point it has only been building for an hour, so perhaps there are still issues?)

Despite the mongo build docs, poetry themselves recommend NOT installing poetry in the build venv. Installing via pipx is probably best in this case (at least IMO), so my initial (Debian 12/Bookworm) dependency list is:

# replace python3-venv and python3-pip with pipx (note python3-venv is a dep of pipx - so will still be installed)
pipx python-dev-is-python3 libssl-dev build-essential libcurl4-openssl-dev liblzma-dev

In my (somewhat limited) experience with poetry, I suspect that it would likely work with any recent version. Regardless, to minimise unexpected issues, I grepped the poetry.lock file in the mongo dir for the specific version upstream are using (I note that the version is explicitly mentioned in the build readme linked above - but IMO better to consult the actual source):

# clone repo ...
cd mongodb-without-avx/mongo
poetry_version=$(grep 'name = "poetry"' -A1 poetry.lock | sed -En '\|^version|s|.*"([0-9\.]+)".*|\1|p')
pipx install poetry=="$poetry_version"
# ensure poetry is in the PATH for this session (to make permanent add to ~/.bashrc)
which poetry || export PATH="~/.local/bin:$PATH"

Install python build deps via poetry:

poetry install

Then enter poetry shell (activate the poetry venv that was created for the deps):

poetry shell

Apply relevant patch and run build script

patch -p1 SConstruct < ../o2_patch.diff
python3 buildscripts/scons.py -j 2 --linker=gold --disable-warnings-as-errors install-mongod | tee build.log

I was going to open a PR to apply the changes myself, but I am only using Debian and aren't sure that my notes here are the best way. If you'd like me to suggest some specific changes, please give me a bit of guidance and I'll try to circle back some time soon.

scottmonster commented 7 months ago

@JedMeister after reading through the issues and finding this I've got it building right now. Many thanks! Any way I can get a quick explanation on what exactly "--linker=gold" does? I tried googling but came up short.

JedMeister commented 7 months ago

@scottmonster Glad to hear my post was useful! :grin:

Any way I can get a quick explanation on what exactly "--linker=gold" does?

Here is some reading re Gold linker: