Cannot build cffi on Pico Ultra W "/usr/bin/ld: cannot find -lgcc"

  • Hello, based on the log you provided, it seems that the corresponding library files are missing. Please try executing the following commands to resolve the issue:

    Code: Select all

    sudo apt-get install gcc
    sudo apt-get install gcc-multilib
    
    When setting up a Python virtual environment, you might need various development tool packages (*-dev). Compiling these packages can be time-consuming. In the future, we plan to introduce a Docker-based rootfs image building method, allowing some of these time-consuming tasks to be executed on a PC.
  • GCC was installed from the start (as well as the needed *-dev packages).

    As I wrote in my question, GCC is missing gcc-multilink package, which is not available in default "ports" repository for ARM.

    Can you please provide further info on how to install gcc-multilink package?

    Code: Select all

    master@pico:~$ sudo apt install gcc-multilib
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    Package gcc-multilib is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
  • We haven't conducted related tests, and there are too many Python packages for us to check each one individually. Previously, when I was porting Home Assistant to Alpine, I also encountered issues with installing the cffi dependency. Unfortunately, I didn't document how I resolved it, so I've forgotten the solution. If there's any progress later, I'll inform you immediately.

    If it's convenient, could you let me know the project you plan to validate? Perhaps I can suggest a better alternative.
  • Please try to remember if possible.

    Project we're trying to deploy is our internal project.
    And cffi is dependency of poetry which we cannot install currently.
    Yes, using the plain pip for dependency management is an alternative, but having this also working would be perfect.
  • Crocodile wrote: 2024-09-02 13:33 We haven't conducted related tests, and there are too many Python packages for us to check each one individually. Previously, when I was porting Home Assistant to Alpine, I also encountered issues with installing the cffi dependency. Unfortunately, I didn't document how I resolved it, so I've forgotten the solution. If there's any progress later, I'll inform you immediately.

    If it's convenient, could you let me know the project you plan to validate? Perhaps I can suggest a better alternative.
    No, I try to set up HomeAssistant on luckfox pro max, and can't do nothing. cffi 1.17.1 needed, but default older version. build not possible. How can I resolve this? Thank you.
  • When porting Home Assistant, I chose not to use Ubuntu as the root filesystem (Ubuntu consumes too many memory resources). Instead, I used armv7l/Alpine in a Docker container on a PC to execute the build, which eventually ran successfully (even though it took a lot of time on the PC). On Ubuntu, I'm unsure how to verify if CFFI is working correctly (I don't have the time to spend significant effort trying to port Home Assistant on Ubuntu again). Therefore, for now, the CFFI issue on Ubuntu will remain a pending task. I will inform you as soon as there is progress.
  • Thank's for an answer.
    Do you have instructions, how to install HA on Alpine ?
    And correct way to install alpine on sd card for Luckfox?
    I kill a week, to try install gcc with multilab :(
    Thank you.
  • I will update this article to the wiki in the future, and I will let you know in this topic when it is updated
  • I'm running in the same issue trying to install a python module that requires compilation:

    Code: Select all

    root@luckfox:~/gas-index-algorithm/python-wrapper# pip install sensirion-gas-index-algorithm
    Collecting sensirion-gas-index-algorithm
      Using cached sensirion-gas-index-algorithm-3.2.2.tar.gz (49 kB)
      Preparing metadata (setup.py) ... done
    Building wheels for collected packages: sensirion-gas-index-algorithm
      Building wheel for sensirion-gas-index-algorithm (setup.py) ... error
      error: subprocess-exited-with-error
      
      × python setup.py bdist_wheel did not run successfully.
      │ exit code: 1
      ╰─> [23 lines of output]
          running bdist_wheel
          running build
          running build_py
          creating build
          creating build/lib.linux-armv7l-3.10
          creating build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          copying sensirion_gas_index_algorithm/sensirion_gas_index_algorithm_wrap.py -> build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          copying sensirion_gas_index_algorithm/version.py -> build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          copying sensirion_gas_index_algorithm/gas_index_algorithm.py -> build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          copying sensirion_gas_index_algorithm/nox_algorithm.py -> build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          copying sensirion_gas_index_algorithm/voc_algorithm.py -> build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          copying sensirion_gas_index_algorithm/__init__.py -> build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          running build_ext
          building 'sensirion_gas_index_algorithm._sensirion_gas_index_algorithm_wrap' extension
          creating build/temp.linux-armv7l-3.10
          creating build/temp.linux-armv7l-3.10/swig
          arm-linux-gnueabihf-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iswig -I/usr/include/python3.10 -c swig/sensirion_gas_index_algorithm.c -o build/temp.linux-armv7l-3.10/swig/sensirion_gas_index_algorithm.o
          arm-linux-gnueabihf-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iswig -I/usr/include/python3.10 -c swig/sensirion_gas_index_algorithm_wrap.c -o build/temp.linux-armv7l-3.10/swig/sensirion_gas_index_algorithm_wrap.o
          arm-linux-gnueabihf-gcc -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -g -fwrapv -O2 -Wl,-Bsymbolic-functions -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-armv7l-3.10/swig/sensirion_gas_index_algorithm.o build/temp.linux-armv7l-3.10/swig/sensirion_gas_index_algorithm_wrap.o -Lswig -o build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm/_sensirion_gas_index_algorithm_wrap.cpython-310-arm-linux-gnueabihf.so
          /usr/bin/ld: cannot find -lgcc: No such file or directory
          /usr/bin/ld: cannot find -lgcc: No such file or directory
          collect2: error: ld returned 1 exit status
          error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1
          [end of output]
      
      note: This error originates from a subprocess, and is likely not a problem with pip.
      ERROR: Failed building wheel for sensirion-gas-index-algorithm
      Running setup.py clean for sensirion-gas-index-algorithm
    Failed to build sensirion-gas-index-algorithm
    Installing collected packages: sensirion-gas-index-algorithm
      Running setup.py install for sensirion-gas-index-algorithm ... error
      error: subprocess-exited-with-error
      
      × Running setup.py install for sensirion-gas-index-algorithm did not run successfully.
      │ exit code: 1
      ╰─> [25 lines of output]
          running install
          /usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
            warnings.warn(
          running build
          running build_py
          creating build
          creating build/lib.linux-armv7l-3.10
          creating build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          copying sensirion_gas_index_algorithm/sensirion_gas_index_algorithm_wrap.py -> build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          copying sensirion_gas_index_algorithm/version.py -> build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          copying sensirion_gas_index_algorithm/gas_index_algorithm.py -> build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          copying sensirion_gas_index_algorithm/nox_algorithm.py -> build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          copying sensirion_gas_index_algorithm/voc_algorithm.py -> build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          copying sensirion_gas_index_algorithm/__init__.py -> build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm
          running build_ext
          building 'sensirion_gas_index_algorithm._sensirion_gas_index_algorithm_wrap' extension
          creating build/temp.linux-armv7l-3.10
          creating build/temp.linux-armv7l-3.10/swig
          arm-linux-gnueabihf-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iswig -I/usr/include/python3.10 -c swig/sensirion_gas_index_algorithm.c -o build/temp.linux-armv7l-3.10/swig/sensirion_gas_index_algorithm.o
          arm-linux-gnueabihf-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iswig -I/usr/include/python3.10 -c swig/sensirion_gas_index_algorithm_wrap.c -o build/temp.linux-armv7l-3.10/swig/sensirion_gas_index_algorithm_wrap.o
          arm-linux-gnueabihf-gcc -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -g -fwrapv -O2 -Wl,-Bsymbolic-functions -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-armv7l-3.10/swig/sensirion_gas_index_algorithm.o build/temp.linux-armv7l-3.10/swig/sensirion_gas_index_algorithm_wrap.o -Lswig -o build/lib.linux-armv7l-3.10/sensirion_gas_index_algorithm/_sensirion_gas_index_algorithm_wrap.cpython-310-arm-linux-gnueabihf.so
          /usr/bin/ld: cannot find -lgcc: No such file or directory
          /usr/bin/ld: cannot find -lgcc: No such file or directory
          collect2: error: ld returned 1 exit status
          error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1
          [end of output]
      
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: legacy-install-failure
    
    × Encountered error while trying to install package.
    ╰─> sensirion-gas-index-algorithm
    
    note: This is an issue with the package mentioned above, not pip.
    hint: See above for output from the failure.
    Any ways to solve this ?

    I tried building from source, and I'm getting the same error.

    Thanks.