ยง2024-10-12

A freshly ubuntu Noble.

It looks like you can not do native comipling on odroid anymore. Failed!!

~$ which python3
/usr/bin/python3
alexlai@hc4Bookworm:~$ pip --version
-bash: pip: command not found
alexlai@hc4Bookworm:~$ python3 --version
Python 3.11.2
  1. install requirement for compiling your own pyhton
sudo  apt-get update && \
    sudo apt-get install -y build-essential checkinstall \
    libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev \
    libcurl4-openssl-dev liblzma-dev git wget zlib1g-dev libbz2-dev \
    libffi-dev tk-dev libgdbm-compat-dev libncurses5-dev libncursesw5-dev git \
    python-dev-is-python3 libssl-dev python3.12-venv 
    
2. compile your own python3 <-- skip 

mkdir -p build/src && cd $_ export PYTHON_VERSION=3.10.15 wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz cd .. tar xvf src/Python-$PYTHON_VERSION.tar.xz &&
cd Python-$PYTHON_VERSION ./configure --enable-optimizations --with-ensurepip=install &&
make -j 6 &&
sudo make altinstall


3. verifyy install  <-- skip

$ python3.13 --version Python 3.13.0 alexlai@hc4Bookworm:~/build/Python-3.13.0$ pip3.13 --version pip 24.2 from /usr/local/lib/python3.13/site-packages/pip (python 3.13)


4. git clone 

$ cd ~/build
git clone https://github.com/mongodb/mongo.git && cd mongo
  1. setup python control
alexlai@hc4Noble:~$ python3 --version
Python 3.12.3
$ sudo apt install python3.12-venv
$ python3 -m venv  ~/PYTHON-3.12.3
$ source ~/PYTHON-3.12.3/bin/activate
(PYTHON-3.12.3) alexlai@hc4Noble:~$ which python3
/home/alexlai/PYTHON-3.12.3/bin/python3
(PYTHON-3.12.3) alexlai@hc4Noble:~$ which pip pip3
/home/alexlai/PYTHON-3.12.3/bin/pip
/home/alexlai/PYTHON-3.12.3/bin/pip3
$ sudo apt install python-dev-is-python3 libssl-dev

$ export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring

$ python3.13 -m venv  ~/PYTHON-3.13.0
$ source ~/PYTHON-3.12.3/bin/activate
(PYTHON-3.12.3) alexlai@hc4Noble:~/build/mongo$ buildscripts/poetry_sync.sh

$ buildscripts/poetry_sync.sh
Using '/home/alexlai/PYTHON-3.11.2/bin/python3' based on VIRTUAL_ENV=/home/alexlai/PYTHON-3.11.2
/home/alexlai/PYTHON-3.11.2/bin/python3 -m pip install --require-virtualenv poetry==1.8.3
....
Installing collected packages: trove-classifiers, ptyprocess, fastjsonschema, distlib, zipp, urllib3, tomlkit, shellingham, rapidfuzz, pyproject-hooks, pycparser, poetry-core, platformdirs, pkginfo, pexpect, packaging, msgpack, more-itertools, jeepney, installer, idna, filelock, crashtest, charset-normalizer, certifi, virtualenv, requests, jaraco.classes, importlib-metadata, dulwich, cleo, cffi, build, requests-toolbelt, cryptography, cachecontrol, SecretStorage, keyring, poetry-plugin-export, poetry
Successfully installed SecretStorage-3.3.3 build-1.2.2.post1 cachecontrol-0.14.0 certifi-2024.8.30 cffi-1.17.1 charset-normalizer-3.4.0 cleo-2.1.0 crashtest-0.4.1 cryptography-43.0.1 distlib-0.3.9 dulwich-0.21.7 fastjsonschema-2.20.0 filelock-3.16.1 idna-3.10 importlib-metadata-8.5.0 installer-0.7.0 jaraco.classes-3.4.0 jeepney-0.8.0 keyring-24.3.1 more-itertools-10.5.0 msgpack-1.1.0 packaging-24.1 pexpect-4.9.0 pkginfo-1.11.2 platformdirs-4.3.6 poetry-1.8.3 poetry-core-1.9.0 poetry-plugin-export-1.8.0 ptyprocess-0.7.0 pycparser-2.22 pyproject-hooks-1.2.0 rapidfuzz-3.10.0 requests-2.32.3 requests-toolbelt-1.0.0 shellingham-1.5.4 tomlkit-0.13.2 trove-classifiers-2024.10.11 urllib3-2.2.3 virtualenv-20.26.6 zipp-3.20.2
env PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring /home/alexlai/PYTHON-3.11.2/bin/python3 -m poetry install --no-root --sync

(PYTHON-3.11.2) alexlai@hc4Bookworm:~/build/mongo$ time python3 buildscripts/scons.py install-core -j6 --ssl --linker=gold CFLAGS="-march=armv8-a+crc -mtune='cortex-a73.cortex-a53' " --disable-warnings-as-errors Checking required python packages... Requirements list: Installing dependencies from lock file

Package operations: 0 installs, 0 updates, 0 removals, 183 skipped

scons: Reading SConscript files ... ModuleNotFoundError: No module named 'mongo_tooling_metrics': File "/home/alexlai/build/mongo/SConstruct", line 23: from mongo_tooling_metrics.lib.top_level_metrics import SConsToolingMetrics

real 0m9.129s user 0m8.535s sys 0m0.515s


pip install mongo-tooling-metrics psutil

$ git checkout r6.3.0-alpha -b r6.3.0-alpha

$ pip install -r etc/pip/compile-requirements.txt


running "python3 buildscripts/scons.py install-mongod" to compile mongoDB from source, error is 
scons: Reading SConscript files ...
/home/alexlai/build/mongo/SConstruct:5598: SyntaxWarning: invalid escape sequence '\,'
  pattern = "exec\\(open\\(['\"](.*)['\"]\, ['\"][a-z]+['\"]\\).read\\(\\)\\)"
ModuleNotFoundError: No module named 'mongo_tooling_metrics':
  File "/home/alexlai/build/mongo/SConstruct", line 23:
    from mongo_tooling_metrics.lib.top_level_metrics import SConsToolingMetrics
ChatGPT said:
ChatGPT
The error message you're encountering indicates that the SConstruct file is trying to import a module called mongo_tooling_metrics, which is not found. This could happen for several reasons. Here are some steps to troubleshoot and resolve the issue:

Check Dependencies: Ensure that all dependencies required to build MongoDB from source are installed. The mongo_tooling_metrics module is likely part of a package that needs to be present. Check the MongoDB build documentation for any prerequisites.

Clone the Latest Source: If you cloned the MongoDB repository, ensure you're using the latest version. There might have been updates that include necessary modules:

bash
Copy code
git clone https://github.com/mongodb/mongo.git
cd mongo
git pull origin master
Install Missing Modules: If mongo_tooling_metrics is not included in your source, you may need to install it. Check the official MongoDB documentation for instructions on how to get this module or any related packages.

Set PYTHONPATH: If you have the mongo_tooling_metrics code in a different location, you can set your PYTHONPATH environment variable to include that directory:

bash
Copy code
export PYTHONPATH=/path/to/your/mongo_tooling_metrics:$PYTHONPATH
Verify Python Version: Ensure you're using a compatible version of Python. MongoDB often has specific version requirements. You can check your Python version with:

bash
Copy code
python3 --version
Clean Build Environment: Sometimes remnants from previous builds can cause issues. You can clean your build environment by running:

bash
Copy code
python3 buildscripts/scons.py --clean
Check for Open Issues: Look through the MongoDB GitHub repository's issues section for similar problems. Others may have encountered the same issue, and solutions or workarounds might be posted there.

If you've gone through these steps and are still encountering issues, please provide additional details about your environment (OS, Python version, etc.), and I'll help further!




ChatGPT can make mistakes. Check important info.