Skip to content

build-unix.sh failes in Ubuntu 22.04 #1710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
relativisticelectron opened this issue May 9, 2022 · 7 comments · Fixed by #1807
Closed

build-unix.sh failes in Ubuntu 22.04 #1710

relativisticelectron opened this issue May 9, 2022 · 7 comments · Fixed by #1807

Comments

@relativisticelectron
Copy link
Collaborator

relativisticelectron commented May 9, 2022

Describe the bug
Running cd pyinstaller and ./build-unix.sh gives the error message:

Traceback (most recent call last):
  File "/home/<user>/programs/anaconda3/envs/specter/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 464, in assemble
    ctypes_binaries = scan_code_for_ctypes(co)
  File "/home/<user>/programs/anaconda3/envs/specter/lib/python3.8/site-packages/PyInstaller/depend/utils.py", line 110, in scan_code_for_ctypes
    binaries = __recursively_scan_code_objects_for_ctypes(co)
  File "/home/<user>/programs/anaconda3/envs/specter/lib/python3.8/site-packages/PyInstaller/depend/utils.py", line 172, in __recursively_scan_code_objects_for_ctypes
    libname = ctypes.util.find_library(libname)
  File "/home/<user>/programs/anaconda3/envs/specter/lib/python3.8/ctypes/util.py", line 351, in find_library
    _get_soname(_findLib_gcc(name) or _findLib_ld(name))
  File "/home/<user>/programs/anaconda3/envs/specter/lib/python3.8/ctypes/util.py", line 148, in _findLib_gcc
    if not _is_elf(file):
  File "/home/<user>/programs/anaconda3/envs/specter/lib/python3.8/ctypes/util.py", line 100, in _is_elf
    with open(filename, 'br') as thefile:
FileNotFoundError: [Errno 2] No such file or directory: b'liblibsecp256k1.a'

Expected behavior
It should find the library and continue with building a binary. In Ubuntu 20.04 it builds fine.

If I go into "/home//programs/anaconda3/envs/specter/lib/python3.8/ctypes/util.py" and catch the library name and change it to b'libsecp256k1.a' it can find it and continues flawlessly with the built.

Could this be a Pyinstaller bug? Or embit?

Desktop (please complete the following information):

  • Ubuntu 22.04, Pyinstaller 4.9
  • Specter Version: current master
@relativisticelectron relativisticelectron changed the title build-unix.sh failes build-unix.sh failes in Ubuntu 22.04 May 9, 2022
@relativisticelectron
Copy link
Collaborator Author

relativisticelectron commented May 23, 2022

In Ubuntu 20.04
image
in https://github.com/pyinstaller/pyinstaller/blob/dc093332c49da0a1693384e0f2fd7e37ad2324d4/PyInstaller/depend/utils.py#L162 gets me
image

In Ubuntu 22.04 I get the error mentioned above.... sooo.. that means the 'liblib' is not the problem. It should just return that it doesn't find the lib.

@relativisticelectron
Copy link
Collaborator Author

relativisticelectron commented May 28, 2022

Hmm... https://github.com/cryptoadvance/specter-desktop/blob/v1.9.4/pyinstaller/build-unix.sh was removed... ok. Trying https://github.com/cryptoadvance/specter-desktop/tree/master/pyinstaller#readme but getting another error.....

  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/<user>/programs/specter-desktop/pyinstaller/hooks/hook-cryptoadvance.specter.services.py", line 9, in <module>
    for service_dir in ServiceManager.get_service_x_dirs("templates")
  File "/home/<user>/programs/specter-desktop/src/cryptoadvance/specter/managers/service_manager.py", line 324, in get_service_x_dirs
    src_org_specterext_exts = search_dirs_in_path(
  File "/home/<user>/programs/specter-desktop/src/cryptoadvance/specter/util/reflection_fs.py", line 61, in search_dirs_in_path
    raise Exception(f"Search path does not exist: {path}")
Exception: Search path does not exist: ../.buildenv/lib/python3.8

site_package = Path("..", ".buildenv", *(Path(site_package).parts[-3:-1]))

Why does it look in a specific env folder? Shouldnt there be something like os.environ['VIRTUAL_ENV'] ... I am using anaconda and the envs are in a completely different folder...

After trial end error, https://github.com/cryptoadvance/specter-desktop/tree/master/pyinstaller#readme should include the setup steps:

virtualenv --python=python3 .buildenv
source .buildenv/bin/activate 
cd pyinstaller

@relativisticelectron
Copy link
Collaborator Author

@relativisticelectron
Copy link
Collaborator Author

relativisticelectron commented May 29, 2022

The issue arises too when I locally run the same script the ci pipeline does:

- ./utils/build-unix.sh --version $CI_COMMIT_TAG make-hash specterd electron-linux electron-win

However I can build fine with python 3.8 and python3.10 in Ubuntu 22.04, when I patch https://github.com/pyinstaller/pyinstaller/blob/8ba83fecc10b8bacade776432af991dcdc54e75f/PyInstaller/depend/utils.py#L163 by

                    try:
                        libname = ctypes.util.find_library(libname)
                    except:
                        libname = None
                        logger.warn('ctypes.util.find_library raised an exception. Supressing.')

@relativisticelectron
Copy link
Collaborator Author

relativisticelectron commented Jun 2, 2022

The cpython bug is being taken care of in pyinstaller/pyinstaller#6864
So we could migrate to the coming pyinstaller version, when it is out.

EDIT: pypi release available !!!

@k9ert
Copy link
Contributor

k9ert commented Jul 15, 2022

If i get this right, than we need to upgrade pyinstaller from 4.9 to 5.2 in order to fix this issue. That's not too bad.
I've created a branch on my fork and created a pre-release here:
https://github.com/k9ert/specter-desktop/releases/tag/v1.10.4-pre4

@relativisticelectron
Copy link
Collaborator Author

Yes, on Python 3.8 and Ubuntu 22.04 the build works :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants