Unable to build edk2 sources

I’m trying to compile an edk2 build to flash on my AGX Orin, but have hit a blocker. I am compiling an Ubuntu 18.04 Docker image (https://github.com/makinbacon21/nvidia-edk2-docker) following each official step up to the build script (edk2-nvidia/Platform/NVIDIA/Jetson/build.sh), which I run manually. The script fails on “Loading Plugins”:

SECTION - Loading Plugins
ERROR - Failed to import plugin: /home/nvidia/edkrepo/nvidia-uefi/edk2/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
Traceback (most recent call last):
  File "/home/nvidia/edkrepo/nvidia-uefi/venv/lib/python3.6/site-packages/edk2toolext/environment/plugin_manager.py", line 83, in _load
    ("py", "r", imp.PY_SOURCE))
  File "/home/nvidia/edkrepo/nvidia-uefi/venv/lib/python3.6/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/home/nvidia/edkrepo/nvidia-uefi/venv/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 674, in exec_module
  File "<frozen importlib._bootstrap_external>", line 780, in get_code
  File "/home/nvidia/edkrepo/nvidia-uefi/venv/lib/python3.6/imp.py", line 156, in get_data
    return file.read()
  File "/home/nvidia/edkrepo/nvidia-uefi/venv/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 3620: ordinal not in range(128)
CRITICAL - One or more plugins failed to load. Halting build.
ERROR - Failed Plugin: Linux GCC5 Tool Chain Support
Traceback (most recent call last):
  File "/home/nvidia/edkrepo/nvidia-uefi/venv/bin/stuart_update", line 8, in <module>
    sys.exit(main())
  File "/home/nvidia/edkrepo/nvidia-uefi/venv/lib/python3.6/site-packages/edk2toolext/invocables/edk2_update.py", line 100, in main
    Edk2Update().Invoke()
  File "/home/nvidia/edkrepo/nvidia-uefi/venv/lib/python3.6/site-packages/edk2toolext/base_abstract_invocable.py", line 134, in Invoke
    raise Exception("One or more plugins failed to load.")
Exception: One or more plugins failed to load.

On my Fedora 36 Server (natively, not in docker), I get much further, but several issues arise (presumably due to newer toolchain):

SECTION - Start Invocable Tool
Traceback (most recent call last):
  File "/home/tmakin/edkrepo/nvidia-uefi/edk2/BaseTools/Edk2ToolsBuild.py", line 177, in <module>
    main()
  File "/home/tmakin/edkrepo/nvidia-uefi/edk2/BaseTools/Edk2ToolsBuild.py", line 173, in main
    Edk2ToolsBuild().Invoke()
  File "/home/tmakin/edkrepo/nvidia-uefi/venv/lib/python3.10/site-packages/edk2toolext/base_abstract_invocable.py", line 141, in Invoke
    retcode = self.Go()
  File "/home/tmakin/edkrepo/nvidia-uefi/edk2/BaseTools/Edk2ToolsBuild.py", line 148, in Go
    raise Exception("Failed to build.")
Exception: Failed to build.

^ Context: the error returned is 2 (from make), due to a bunch of build errors

Hi,

Please noted that Orin uses Ubuntu 20.04.

Based on the error, the failure is caused by some missing libraries for python 3.6.
However, the default python version of Ubuntu 20.04 should be python 3.8.10.

Could you check with the edk2 team to see if they support JetPack 5 first?

Thanks.

Ah I could have sworn it specifically stated to use 18.04…possibly the instructions were updated as they now read 20.04. Allow me to try.

Also fwiw I’m using nvidia’s edk2, not stock, and am cross compiling from a docker container rather than compiling directly on JetPack.

Thanks for the help!

@AastaLLL re: last comment, r34.1 branch instructions still say to use 18.04 but the main branch was updated to recommend 20.04. Clearly 20.04 is needed on either. Thanks!

Well if anyone is interested, here is my now-fully-functional container:

Hi,

Sorry that the statement is confusing.
For Orin, which uses r34 or 35, it is Ubuntu 20.04.
The desktop, which is used for cross-compiling, can be Ubuntu 18.04. Need to be Ubuntu 20.04 as well.

Based on the GitHub, does everything work well already?
Thanks.

That actually seems to be incorrect. As it turns out (and the GitHub has been updated to verify), cross-compiling edk2 needs Ubuntu 20.04 for its python version. 18.04, as you had said correctly before, doesn’t have the right version of python. Now everything seems to work well.

Hi,

Thanks for correcting this.
Will update the previous comment as well.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.