Skip to content
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

bluing and dbus-python problems while installing #32

Open
MKesenheimer opened this issue Apr 1, 2023 · 5 comments
Open

bluing and dbus-python problems while installing #32

MKesenheimer opened this issue Apr 1, 2023 · 5 comments

Comments

@MKesenheimer
Copy link

MKesenheimer commented Apr 1, 2023

bluing relies on the dbus-python package.
On kali linux I get an error, when the dbus-python package is being built:

$ pip install --user bluing
Requirement already satisfied: bluing in ./.local/lib/python3.10/site-packages (0.12.0)
Collecting bluepy>=1.3.0
  Using cached bluepy-1.3.0.tar.gz (217 kB)
  Preparing metadata (setup.py) ... done
Collecting PyGObject>=3.42.2
  Using cached PyGObject-3.44.1.tar.gz (720 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting btatt>=0.0.19
  Using cached btatt-0.0.19-py3-none-any.whl (934 kB)
Collecting dbus-python>=1.3.2
  Using cached dbus-python-1.3.2.tar.gz (605 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [197 lines of output]
      The Meson build system
      Version: 1.0.1
      Source dir: /tmp/pip-install-yylgmtd7/dbus-python_592d474a86014dad92eeceabe4e28c24
      Build dir: /tmp/pip-install-yylgmtd7/dbus-python_592d474a86014dad92eeceabe4e28c24/.mesonpy-uzwr8y0s/build
      Build type: native build
      Project name: dbus-python
      Project version: 1.3.2
      C compiler for the host machine: cc (gcc 12.2.0 "cc (Debian 12.2.0-14) 12.2.0")
      C linker for the host machine: cc ld.bfd 2.40
      Host machine cpu family: x86_64
      Host machine cpu: x86_64
      Compiler for C supports arguments -fno-common: YES
      Compiler for C supports arguments -Wno-missing-field-initializers: YES
      Compiler for C supports arguments -Wno-declaration-after-statement: YES
      Compiler for C supports arguments -Wno-inline: YES
      Compiler for C supports arguments -Wno-redundant-decls: YES
      Compiler for C supports arguments -Wno-switch-default: YES
      Compiler for C supports arguments -Wno-write-strings: YES
      Compiler for C supports arguments -Wcast-align: YES
      Compiler for C supports arguments -Wdouble-promotion: YES
      Compiler for C supports arguments -Wduplicated-cond: YES
      Compiler for C supports arguments -Wfloat-equal: YES
      Compiler for C supports arguments -Wformat-nonliteral: YES
      Compiler for C supports arguments -Wformat-security: YES
      Compiler for C supports arguments -Wformat=2: YES
      Compiler for C supports arguments -Winit-self: YES
      Compiler for C supports arguments -Wlogical-op: YES
      Compiler for C supports arguments -Wmissing-declarations: YES
      Compiler for C supports arguments -Wmissing-format-attribute: YES
      Compiler for C supports arguments -Wmissing-include-dirs: YES
      Compiler for C supports arguments -Wmissing-noreturn: YES
      Compiler for C supports arguments -Wnull-dereference: YES
      Compiler for C supports arguments -Wpacked: YES
      Compiler for C supports arguments -Wpointer-arith: YES
      Compiler for C supports arguments -Wshadow: YES
      Compiler for C supports arguments -Wswitch-enum: YES
      Compiler for C supports arguments -Wundef: YES
      Compiler for C supports arguments -Wunused-but-set-variable: YES
      Compiler for C supports arguments -Wjump-misses-init: YES
      Compiler for C supports arguments -Wmissing-prototypes: YES
      Compiler for C supports arguments -Wnested-externs: YES
      Compiler for C supports arguments -Wold-style-definition: YES
      Compiler for C supports arguments -Wpointer-sign: YES
      Compiler for C supports arguments -Wstrict-prototypes: YES
      Configuring _dbus-python-config.h using configuration

      Executing subproject dbus-gmain

      dbus-gmain| Project name: dbus-gmain
      dbus-gmain| Project version: undefined
      dbus-gmain| C compiler for the host machine: cc (gcc 12.2.0 "cc (Debian 12.2.0-14) 12.2.0")
      dbus-gmain| C linker for the host machine: cc ld.bfd 2.40
      dbus-gmain| Compiler for C supports arguments -fno-common: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wno-missing-field-initializers: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wcast-align: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wdouble-promotion: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wduplicated-branches: YES
      dbus-gmain| Compiler for C supports arguments -Wduplicated-cond: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wfloat-equal: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wformat-nonliteral: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wformat-security: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wformat=2: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Winit-self: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wlogical-op: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wmissing-declarations: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wmissing-format-attribute: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wmissing-include-dirs: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wmissing-noreturn: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wnull-dereference: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wpacked: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wpointer-arith: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wredundant-decls: YES
      dbus-gmain| Compiler for C supports arguments -Wshadow: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wswitch-default: YES
      dbus-gmain| Compiler for C supports arguments -Wswitch-enum: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wundef: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wunused-but-set-variable: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wwrite-strings: YES
      dbus-gmain| Compiler for C supports arguments -Wdeclaration-after-statement: YES
      dbus-gmain| Compiler for C supports arguments -Wjump-misses-init: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wmissing-prototypes: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wnested-externs: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wold-style-definition: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wpointer-sign: YES (cached)
      dbus-gmain| Compiler for C supports arguments -Wstrict-prototypes: YES (cached)
      dbus-gmain| Found pkg-config: /usr/bin/pkg-config (1.8.1)
      dbus-gmain| Run-time dependency dbus-1 found: YES 1.14.6
      dbus-gmain| Run-time dependency glib-2.0 found: YES 2.74.6
      dbus-gmain| Run-time dependency gthread-2.0 found: YES 2.74.6
      dbus-gmain| Program dbus-run-session found: YES (/usr/bin/dbus-run-session)
      dbus-gmain| Build targets in project: 1
      dbus-gmain| Subproject dbus-gmain finished.

      Program python found: YES (/usr/bin/python3)
      Dependency dbus-1 found: YES 1.14.6 (cached)
      Configuring TestSuitePythonService.service using configuration
      Configuring tmp-session-bus.conf using configuration
      Program dbus-run-session found: YES (/usr/bin/dbus-run-session)
      Build targets in project: 5

      dbus-python 1.3.2

        Subprojects
          dbus-gmain  : YES

        User defined options
          Native files: /tmp/pip-install-yylgmtd7/dbus-python_592d474a86014dad92eeceabe4e28c24/.mesonpy-native-file.ini
          debug       : false
          optimization: 2
          prefix      : /usr

      Found ninja-1.11.1.git.kitware.jobserver-1 at /tmp/pip-build-env-iunw7y4_/overlay/bin/ninja
      [1/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_bytes.c.o
      [2/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_bus.c.o
      [3/32] Compiling C object subprojects/dbus-gmain/libdbus-gmain.a.p/dbus-gmain.c.o
      [4/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_conn.c.o
      [5/32] Linking static target subprojects/dbus-gmain/libdbus-gmain.a
      [6/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_abstract.c.o
      [7/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_debug.c.o
      [8/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_exceptions.c.o
      [9/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_conn-methods.c.o
      [10/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_float.c.o
      [11/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_generic.c.o
      [12/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_containers.c.o
      [13/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_libdbusconn.c.o
      [14/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_unixfd.c.o
      [15/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_mainloop.c.o
      [16/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_int.c.o
      [17/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_pending-call.c.o
      [18/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_module.c.o
      [19/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_message-get-args.c.o
      [20/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_message.c.o
      [21/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_server.c.o
      [22/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_message-append.c.o
      [23/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_signature.c.o
      [24/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_string.c.o
      [25/32] Compiling C object test/test-import-repeatedly.p/import-repeatedly.c.o
      [26/32] Compiling C object _dbus_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_bindings_validation.c.o
      [27/32] Compiling C object test/dbus_py_test.cpython-310-x86_64-linux-gnu.so.p/dbus_py_test.c.o
      [28/32] Linking target test/dbus_py_test.cpython-310-x86_64-linux-gnu.so
      [29/32] Linking target _dbus_bindings.cpython-310-x86_64-linux-gnu.so
      [30/32] Compiling C object _dbus_glib_bindings.cpython-310-x86_64-linux-gnu.so.p/dbus_glib_bindings_module.c.o
      [31/32] Linking target _dbus_glib_bindings.cpython-310-x86_64-linux-gnu.so
      [32/32] Linking target test/test-import-repeatedly
      FAILED: test/test-import-repeatedly
      cc  -o test/test-import-repeatedly test/test-import-repeatedly.p/import-repeatedly.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group /usr/lib/libpython3.10.a -Wl,--end-group
      /usr/bin/ld: /usr/lib/libpython3.10.a(complexobject.o): in function `_Py_c_abs':
      /home/kali/tools/Python-3.10.10/Objects/complexobject.c:206: undefined reference to `hypot'
      /usr/bin/ld: /usr/lib/libpython3.10.a(complexobject.o): in function `complex_pow':
      /home/kali/tools/Python-3.10.10/Objects/complexobject.c:521: undefined reference to `floor'
      /usr/bin/ld: /usr/lib/libpython3.10.a(complexobject.o): in function `_Py_c_pow':
      /home/kali/tools/Python-3.10.10/Objects/complexobject.c:142: undefined reference to `hypot'
      /usr/bin/ld: /home/kali/tools/Python-3.10.10/Objects/complexobject.c:143: undefined reference to `pow'
      /usr/bin/ld: /home/kali/tools/Python-3.10.10/Objects/complexobject.c:144: undefined reference to `atan2'
      /usr/bin/ld: /home/kali/tools/Python-3.10.10/Objects/complexobject.c:146: undefined reference to `sincos'
      /usr/bin/ld: /home/kali/tools/Python-3.10.10/Objects/complexobject.c:147: undefined reference to `exp'
      /usr/bin/ld: /home/kali/tools/Python-3.10.10/Objects/complexobject.c:148: undefined reference to `log'
      /usr/bin/ld: /usr/lib/libpython3.10.a(floatobject.o): in function `float_rem':
      /home/kali/tools/Python-3.10.10/Objects/floatobject.c:626: undefined reference to `fmod'
      /usr/bin/ld: /usr/lib/libpython3.10.a(floatobject.o): in function `_float_div_mod':
      /home/kali/tools/Python-3.10.10/Objects/floatobject.c:646: undefined reference to `fmod'
      /usr/bin/ld: /home/kali/tools/Python-3.10.10/Objects/floatobject.c:669: undefined reference to `floor'
      /usr/bin/ld: /usr/lib/libpython3.10.a(floatobject.o): in function `float___ceil___impl':
      /home/kali/tools/Python-3.10.10/Objects/floatobject.c:920: undefined reference to `ceil'
      /usr/bin/ld: /usr/lib/libpython3.10.a(floatobject.o): in function `float___floor___impl':
      /home/kali/tools/Python-3.10.10/Objects/floatobject.c:906: undefined reference to `floor'
      /usr/bin/ld: /usr/lib/libpython3.10.a(floatobject.o): in function `float_is_integer_impl':
      /home/kali/tools/Python-3.10.10/Objects/floatobject.c:872: undefined reference to `floor'
      /usr/bin/ld: /usr/lib/libpython3.10.a(floatobject.o): in function `float_pow':
      /home/kali/tools/Python-3.10.10/Objects/floatobject.c:818: undefined reference to `pow'
      /usr/bin/ld: /home/kali/tools/Python-3.10.10/Objects/floatobject.c:795: undefined reference to `fmod'
      /usr/bin/ld: /home/kali/tools/Python-3.10.10/Objects/floatobject.c:818: undefined reference to `pow'
      /usr/bin/ld: /home/kali/tools/Python-3.10.10/Objects/floatobject.c:769: undefined reference to `fmod'
      /usr/bin/ld: /home/kali/tools/Python-3.10.10/Objects/floatobject.c:759: undefined reference to `fmod'
      /usr/bin/ld: /usr/lib/libpython3.10.a(floatobject.o): in function `float___round___impl':
      /home/kali/tools/Python-3.10.10/Objects/floatobject.c:1061: undefined reference to `round'
      /usr/bin/ld: /home/kali/tools/Python-3.10.10/Objects/floatobject.c:1064: undefined reference to `round'
      /usr/bin/ld: /usr/lib/libpython3.10.a(longobject.o): in function `PyLong_FromString':
      /home/kali/tools/Python-3.10.10/Objects/longobject.c:2319: undefined reference to `log'
      /usr/bin/ld: /usr/lib/libpython3.10.a(pytime.o): in function `_PyTime_Round':
      /home/kali/tools/Python-3.10.10/Python/pytime.c:128: undefined reference to `floor'
      /usr/bin/ld: /usr/lib/libpython3.10.a(pytime.o): in function `_PyTime_RoundHalfEven':
      /home/kali/tools/Python-3.10.10/Python/pytime.c:106: undefined reference to `round'
      /usr/bin/ld: /usr/lib/libpython3.10.a(pytime.o): in function `_PyTime_Round':
      /home/kali/tools/Python-3.10.10/Python/pytime.c:132: undefined reference to `ceil'
      /usr/bin/ld: /home/kali/tools/Python-3.10.10/Python/pytime.c:125: undefined reference to `ceil'
      /usr/bin/ld: /home/kali/tools/Python-3.10.10/Python/pytime.c:132: undefined reference to `floor'
      /usr/bin/ld: /usr/lib/libpython3.10.a(pytime.o): in function `_PyTime_RoundHalfEven':
      /home/kali/tools/Python-3.10.10/Python/pytime.c:109: undefined reference to `round'
      /usr/bin/ld: /usr/lib/libpython3.10.a(_threadmodule.o): in function `thread_module_exec':
      /home/kali/tools/Python-3.10.10/./Modules/_threadmodule.c:1658: undefined reference to `floor'
      collect2: error: ld returned 1 exit status
      ninja: build stopped: subcommand failed.
      INFO: autodetecting backend as ninja
      INFO: calculating backend command to run: /tmp/pip-build-env-iunw7y4_/overlay/bin/ninja
      + meson setup --prefix=/usr /tmp/pip-install-yylgmtd7/dbus-python_592d474a86014dad92eeceabe4e28c24 /tmp/pip-install-yylgmtd7/dbus-python_592d474a86014dad92eeceabe4e28c24/.mesonpy-uzwr8y0s/build --native-file=/tmp/pip-install-yylgmtd7/dbus-python_592d474a86014dad92eeceabe4e28c24/.mesonpy-native-file.ini -Ddebug=false -Doptimization=2
      + meson compile
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Why is this happening?

@fO-000
Copy link
Owner

fO-000 commented Apr 2, 2023

How did you install python 3.10 in the latest kali Linux, which now uses python 3.11 by default?

@MKesenheimer
Copy link
Author

Yeah that was a problem. I compiled python from source. I downloaded the official package, compiled that and installed it. Any chance bluing will work with python3.11 sometime?

@fO-000
Copy link
Owner

fO-000 commented Apr 2, 2023

The next version of bluing is planned to support python 3.11.

And if you compiled and installed python 3.10 from the source, you may have to deal with some so files, such as:

  • _dbus_bindings.cpython-3*-x86_64-linux-gnu.so
  • _dbus_glib_bindings.cpython-3*-x86_64-linux-gnu.so

Have you tried installing dbus-python using apt instead of pip?

sudo apt install libglib2.0-dev gir1.2-gtk-3.0 \
                 python3-dbus python3-gi python3-gi-cairo

@MKesenheimer
Copy link
Author

Yes, thank you. I tried, but pip wanted to install the dbus-python package nevertheless. In the end, I managed to install bluing by building dbus-python from source and requesting the pip install command with the --no-dependencies option:

sudo -H pip install --no-dependencies bluing PyGObject docopt btsm btatt bluepy configobj btl2cap pkginfo xpycommon halo pyserial bthci btgatt log_symbols colorama spinners six termcolor

I can now run bluing. But this is obviously not a clean solution.

@Sinkmanu
Copy link

Sinkmanu commented Jun 15, 2023

I am Debian user and I have found problems during the installation, but I have found a solution.

I have compiled and installed Python3.10, and got the dbus-python error after try pip3.10 install bluing. So,
I downloaded dbus-python 1.3.2 from sources and installed bluing with pip.

wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
tar -xvf Python-3.10.0.tgz
cd Python-3.10.0
./configure --enable-optimizations
make -j 4
sudo make altinstall
cd ..

tar -xvzf dbus-python-upstream-1.3.2.tar.gz
cd dbus-python-upstream-1.3.2
./configure
make
sudo make install
sudo python3.10 setup.py install
# for some reason, dbus-python does not perform the installation in site-packages well, so:
sudo cp -r dbus/ /usr/local/lib/python3.10/site-packages/

pip3.10 install bluing

# Extra: If you do not have glibc 2.34, you can compile glibc 2.34 and patch rfkill:
wget http://ftp.gnu.org/gnu/glibc/glibc-2.34.tar.xz
tar xf glibc-2.34.tar.xz
cd glibc-2.34
mkdir build
mkdir glibc-2.34-install
cd build
../configure --prefix=$HOME/Downloads/glibc-2.34/glibc-2.34-install
make -j
make install

cp /usr/sbin/rfkill /tmp/rfkill
cp /lib/x86_64-linux-gnu/libsmartcols.so.1.1.0 $HOME/Downloads/glibc-2.34/glibc-2.34-install/lib/
cd $HOME/Downloads/glibc-2.34/glibc-2.34-install/lib/
ln -s libsmartcols.so.1 libsmartcols.so.1.1.0
patchelf --set-interpreter $HOME/Downloads/glibc-2.34/glibc-2.34-install/lib/ld-linux-x86-64.so.2 --set-rpath $HOME/Downloads/glibc-2.34/glibc-2.34-install/lib/ rfkill
# If you want, replace this rfkill for the older
sudo cp /usr/sbin/rfkill /usr/sbin/rfkill_backup
sudo cp /tmp/rfkill /usr/sbin/

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

No branches or pull requests

3 participants