Open kamulchik opened 2 months ago
This seems to be a problem with you compiler installation. What is the output of c++ -Wl,--version
?
I am so sorry. Yes, it is compiler depends problem. Resolved.
No problem. Glad you could get it working.
No problem. Glad you could get it working.
Not yet. I resolve a problem compiler installation. But can't install python-rtmidi. I have opkg packet manager, and i not have a package libasound2-dev or jack. But i have libasound.so.2. And i have a alsactl. Path: find / -name "libasound*" /storage/.opt/lib/libasound.so.2.0.0 /storage/.opt/lib/libasound.so.2 /usr/lib/libasound.so /usr/lib/libasound.so.2 /usr/lib/libasound.so.2.0.0
find / -name "alsactl" /storage/.opt/sbin/alsactl /usr/sbin/alsactl
Any workaround for install python-rtmidi. Current ERROR:
The Meson build system
Version: 1.4.0
Source dir: /storage/.opt/tmp/pip-install-ulrymfrh/python-rtmidi_48551eea4ac547c49751fab94fe43eda
Build dir: /storage/.opt/tmp/pip-install-ulrymfrh/python-rtmidi_48551eea4ac547c49751fab94fe43eda/.mesonpy-jx9dyk5p
Build type: native build
Project name: python-rtmidi
Project version: 1.5.8
C++ compiler for the host machine: c++ (gcc 8.4.0 "c++ (OpenWrt GCC 8.4.0) 8.4.0")
C++ linker for the host machine: c++ ld.bfd 2.41
Host machine cpu family: aarch64
Host machine cpu: aarch64
Found pkg-config: YES (/opt/bin/pkg-config) 0.29.2
Found CMake: /opt/bin/cmake (3.28.1)
Run-time dependency jack found: NO (tried pkgconfig and cmake)
Run-time dependency jack found: NO (tried pkgconfig and cmake)
../meson.build:24: WARNING: No version of JACK found, which is recent enough (jack2>=1.9.11 or jack1>=0.125.0)
Run-time dependency alsa found: NO (tried pkgconfig and cmake)
../meson.build:66:15: ERROR: Dependency "alsa" not found, tried pkgconfig and cmake
You need not only the ALSA libraries, but also the header files, which are usually installed in /usr/include/alsa
adn included via /usr/include/asoundlib.h
.
In don't know which package on your distro (openwrt?) provides these files. Maybe alsa-lib?
You need not only the ALSA libraries, but also the header files, which are usually installed in
/usr/include/alsa
adn included via/usr/include/asoundlib.h
.In don't know which package on your distro (openwrt?) provides these files. Maybe alsa-lib?
Distro: CoreElec. find / -name "asound*" /proc/asound /storage/.opt/include/sound/asound.h /storage/.opt/include/sound/asound_fm.h /storage/.opt/var/lock/asound.state.lock /storage/.opt/var/lib/alsa/asound.state
opkg install alsa-lib Package alsa-lib (1.2.9-1) installed in root is up to date.
Nope, these are not the droids...err...headers we're looking for.
It seems the header files are not included in the alsa-lib
package:
https://github.com/openwrt/packages/blob/openwrt-22.03/libs/alsa-lib/Makefile#L71
So, if you want to compile python-rtmidi on this system, you need to find way to provide these headers and an alsa.pc
pkgconfig file in a location where pkgconfig
can find it, which returns the correct cflags and ldflags for the alsa lib.
@SpotlightKid i built alsa libs from sources and copy to directory files to "include" dir such as asoundlib.h, asoundef.h etc... I got a new error. Please, tell me what i can investigation for this error:
The Meson build system
Version: 1.4.0
Source dir: /storage/.opt/tmp/pip-install-ch7rxvyw/python-rtmidi_519048ea503a43a9806511eb3a383d87
Build dir: /storage/.opt/tmp/pip-install-ch7rxvyw/python-rtmidi_519048ea503a43a9806511eb3a383d87/.mesonpy-_fdhi9hs
Build type: native build
Project name: python-rtmidi
Project version: 1.5.8
C++ compiler for the host machine: c++ (gcc 8.4.0 "c++ (OpenWrt GCC 8.4.0) 8.4.0")
C++ linker for the host machine: c++ ld.bfd 2.41
Host machine cpu family: aarch64
Host machine cpu: aarch64
Found pkg-config: YES (/opt/bin/pkg-config) 0.29.2
Found CMake: /opt/bin/cmake (3.28.1)
Run-time dependency jack found: NO (tried pkgconfig and cmake)
Run-time dependency jack found: NO (tried pkgconfig and cmake)
../meson.build:24: WARNING: No version of JACK found, which is recent enough (jack2>=1.9.11 or jack1>=0.125.0)
Run-time dependency alsa found: YES 1.2.9
Run-time dependency threads found: YES
Has header "semaphore.h" : YES
Program python3 found: YES (/opt/bin/python3)
Program cython found: YES (/storage/.opt/tmp/pip-build-env-rkzmieo_/overlay/bin/cython)
Run-time dependency python found: YES 3.11
Configuring version.py using configuration
Build targets in project: 1
Exact:
python-rtmidi 1.5.8
Configuration
Host machine system : linux
Python version : 3.11
Debug messages (verbose): false
Build for wheel : true
JACK support : false
ALSA support : true
CoreMIDI support : false
Window MM support : false
User defined options
Native files : /storage/.opt/tmp/pip-install-ch7rxvyw/python-rtmidi_519048ea503a43a9806511eb3a383d87/.mesonpy-_fdhi9hs/meson-python-native-file.ini
buildtype : plain
b_ndebug : if-release
b_vscrt : md
verbose : false
wheel : true
Found ninja-1.11.1.git.kitware.jobserver-1 at /storage/.opt/tmp/pip-build-env-rkzmieo_/overlay/bin/ninja
+ /storage/.opt/tmp/pip-build-env-rkzmieo_/overlay/bin/ninja
[1/3] Compiling C++ object rtmidi/_rtmidi.cpython-311-aarch64-linux-gnu.so.p/.._src_rtmidi_RtMidi.cpp.o
[2/3] Compiling C++ object rtmidi/_rtmidi.cpython-311-aarch64-linux-gnu.so.p/.._src__rtmidi.cpp.o
FAILED: rtmidi/_rtmidi.cpython-311-aarch64-linux-gnu.so.p/.._src__rtmidi.cpp.o
c++ -Irtmidi/_rtmidi.cpython-311-aarch64-linux-gnu.so.p -Irtmidi -I../rtmidi -Isrc -I../src -I../src/rtmidi -I/opt/include/python3.11 -fvisibility=hidden -fvisibility-inlines-hidden -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c++11 -fPIC -pthread -D__LINUX_ALSA__ -D__RTMIDI_SILENCE_WARNINGS__ -MD -MQ rtmidi/_rtmidi.cpython-311-aarch64-linux-gnu.so.p/.._src__rtmidi.cpp.o -MF rtmidi/_rtmidi.cpython-311-aarch64-linux-gnu.so.p/.._src__rtmidi.cpp.o.d -o rtmidi/_rtmidi.cpython-311-aarch64-linux-gnu.so.p/.._src__rtmidi.cpp.o -c ../src/_rtmidi.cpp
In file included from /opt/include/python3.11/Python.h:38,
from ../src/_rtmidi.cpp:16:
../src/_rtmidi.cpp: In function 'PyObject* __pyx_pf_7_rtmidi_2get_api_display_name(PyObject*, PyObject*)':
/opt/include/python3.11/pyport.h:132:27: error: 'SSIZE_MAX' was not declared in this scope
# define PY_SSIZE_T_MAX SSIZE_MAX
^~~~~~~~~
../src/_rtmidi.cpp:5572:80: note: in expansion of macro 'PY_SSIZE_T_MAX'
__pyx_t_2 = __Pyx_decode_cpp_string(RtMidi::getApiDisplayName(__pyx_t_1), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error)
^~~~~~~~~~~~~~
/opt/include/python3.11/pyport.h:132:27: note: suggested alternative: 'SIZE_MAX'
# define PY_SSIZE_T_MAX SSIZE_MAX
^~~~~~~~~
../src/_rtmidi.cpp:5572:80: note: in expansion of macro 'PY_SSIZE_T_MAX'
__pyx_t_2 = __Pyx_decode_cpp_string(RtMidi::getApiDisplayName(__pyx_t_1), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error)
^~~~~~~~~~~~~~
../src/_rtmidi.cpp: In function 'PyObject* __pyx_pf_7_rtmidi_4get_api_name(PyObject*, PyObject*)':
/opt/include/python3.11/pyport.h:132:27: error: 'SSIZE_MAX' was not declared in this scope
# define PY_SSIZE_T_MAX SSIZE_MAX
^~~~~~~~~
../src/_rtmidi.cpp:5721:73: note: in expansion of macro 'PY_SSIZE_T_MAX'
__pyx_t_2 = __Pyx_decode_cpp_string(RtMidi::getApiName(__pyx_t_1), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
^~~~~~~~~~~~~~
/opt/include/python3.11/pyport.h:132:27: note: suggested alternative: 'SIZE_MAX'
# define PY_SSIZE_T_MAX SSIZE_MAX
^~~~~~~~~
../src/_rtmidi.cpp:5721:73: note: in expansion of macro 'PY_SSIZE_T_MAX'
__pyx_t_2 = __Pyx_decode_cpp_string(RtMidi::getApiName(__pyx_t_1), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
^~~~~~~~~~~~~~
../src/_rtmidi.cpp: In function 'PyObject* __pyx_pf_7_rtmidi_10get_rtmidi_version(PyObject*)':
/opt/include/python3.11/pyport.h:132:27: error: 'SSIZE_MAX' was not declared in this scope
# define PY_SSIZE_T_MAX SSIZE_MAX
^~~~~~~~~
../src/_rtmidi.cpp:6061:64: note: in expansion of macro 'PY_SSIZE_T_MAX'
__pyx_t_1 = __Pyx_decode_cpp_string(RtMidi::getVersion(), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 394, __pyx_L1_error)
^~~~~~~~~~~~~~
/opt/include/python3.11/pyport.h:132:27: note: suggested alternative: 'SIZE_MAX'
# define PY_SSIZE_T_MAX SSIZE_MAX
^~~~~~~~~
../src/_rtmidi.cpp:6061:64: note: in expansion of macro 'PY_SSIZE_T_MAX'
__pyx_t_1 = __Pyx_decode_cpp_string(RtMidi::getVersion(), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 394, __pyx_L1_error)
^~~~~~~~~~~~~~
../src/_rtmidi.cpp: In function 'PyObject* __pyx_f_7_rtmidi___pyx_unpickle_MidiBase__set_state(__pyx_obj_7_rtmidi_MidiBase*, PyObject*)':
/opt/include/python3.11/pyport.h:132:27: error: 'SSIZE_MAX' was not declared in this scope
# define PY_SSIZE_T_MAX SSIZE_MAX
^~~~~~~~~
../src/_rtmidi.cpp:1453:43: note: in definition of macro 'likely'
#define likely(x) __builtin_expect(!!(x), 1)
^
../src/_rtmidi.cpp:1229:28: note: in expansion of macro 'PY_SSIZE_T_MAX'
likely(v < (type)PY_SSIZE_T_MAX ||\
^~~~~~~~~~~~~~
../src/_rtmidi.cpp:2091:6: note: in expansion of macro '__Pyx_fits_Py_ssize_t'
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
^~~~~~~~~~~~~~~~~~~~~
../src/_rtmidi.cpp:14540:15: note: in expansion of macro '__Pyx_GetItemInt_Tuple'
__pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
^~~~~~~~~~~~~~~~~~~~~~
/opt/include/python3.11/pyport.h:132:27: note: suggested alternative: 'SIZE_MAX'
# define PY_SSIZE_T_MAX SSIZE_MAX
^~~~~~~~~
../src/_rtmidi.cpp:1453:43: note: in definition of macro 'likely'
#define likely(x) __builtin_expect(!!(x), 1)
^
../src/_rtmidi.cpp:1229:28: note: in expansion of macro 'PY_SSIZE_T_MAX'
likely(v < (type)PY_SSIZE_T_MAX ||\
^~~~~~~~~~~~~~
../src/_rtmidi.cpp:2091:6: note: in expansion of macro '__Pyx_fits_Py_ssize_t'
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
^~~~~~~~~~~~~~~~~~~~~
../src/_rtmidi.cpp:14540:15: note: in expansion of macro '__Pyx_GetItemInt_Tuple'
__pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
^~~~~~~~~~~~~~~~~~~~~~
../src/_rtmidi.cpp: In function 'PyObject* __Pyx_PyUnicode_Join(PyObject*, Py_ssize_t, Py_ssize_t, Py_UCS4)':
/opt/include/python3.11/pyport.h:132:27: error: 'SSIZE_MAX' was not declared in this scope
# define PY_SSIZE_T_MAX SSIZE_MAX
^~~~~~~~~
../src/_rtmidi.cpp:1454:43: note: in definition of macro 'unlikely'
#define unlikely(x) __builtin_expect(!!(x), 0)
^
../src/_rtmidi.cpp:19049:23: note: in expansion of macro 'PY_SSIZE_T_MAX'
if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos))
^~~~~~~~~~~~~~
/opt/include/python3.11/pyport.h:132:27: note: suggested alternative: 'SIZE_MAX'
# define PY_SSIZE_T_MAX SSIZE_MAX
^~~~~~~~~
../src/_rtmidi.cpp:1454:43: note: in definition of macro 'unlikely'
#define unlikely(x) __builtin_expect(!!(x), 0)
^
../src/_rtmidi.cpp:19049:23: note: in expansion of macro 'PY_SSIZE_T_MAX'
if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos))
^~~~~~~~~~~~~~
../src/_rtmidi.cpp: In function 'Py_ssize_t __Pyx_ssize_strlen(const char*)':
/opt/include/python3.11/pyport.h:132:27: error: 'SSIZE_MAX' was not declared in this scope
# define PY_SSIZE_T_MAX SSIZE_MAX
^~~~~~~~~
../src/_rtmidi.cpp:1454:43: note: in definition of macro 'unlikely'
#define unlikely(x) __builtin_expect(!!(x), 0)
^
../src/_rtmidi.cpp:24451:33: note: in expansion of macro 'PY_SSIZE_T_MAX'
if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
^~~~~~~~~~~~~~
/opt/include/python3.11/pyport.h:132:27: note: suggested alternative: 'SIZE_MAX'
# define PY_SSIZE_T_MAX SSIZE_MAX
^~~~~~~~~
../src/_rtmidi.cpp:1454:43: note: in definition of macro 'unlikely'
#define unlikely(x) __builtin_expect(!!(x), 0)
^
../src/_rtmidi.cpp:24451:33: note: in expansion of macro 'PY_SSIZE_T_MAX'
if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
^~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
P.s. i now, that this hardest method for install rtmidi, but i don't know other...
You also need the Python header files, so Python.h
etc. in the directory returned by pkgconfig --cflags python3
.
I thought that meson would detect this when checking for Python's presence, but obviously it doesn't and I should have included a more thorough check that the Python headers are present. I will add this in future python-rtmidi versions.
I think your distro is not really meant for building software directly on the device. In the long run, you're probably better off setting up a cross-compilation build environment on your PC.
You also need the Python header files, so
Python.h
etc. in the directory returned bypkgconfig --cflags python3
.
How i can check it? Because directory have a Python header files:
CoreELEC:~ # pkg-config --cflags python3
-I/opt/include/python3.11
ls -la /opt/include/python3.11/Py*
-rw-r--r-- 1 root root 2854 Feb 22 21:13 /opt/include/python3.11/Python.h
CoreELEC:~ # ls -la /opt/include/python3.11/py*
-rw-r--r-- 1 root root 2471 Feb 22 21:13 /opt/include/python3.11/py_curses.h
-rw-r--r-- 1 root root 5115 Feb 22 21:13 /opt/include/python3.11/pybuffer.h
-rw-r--r-- 1 root root 1725 Feb 22 21:13 /opt/include/python3.11/pycapsule.h
-rw-r--r-- 1 root root 55428 Feb 22 21:13 /opt/include/python3.11/pyconfig.h
-rw-r--r-- 1 root root 2413 Feb 22 21:13 /opt/include/python3.11/pydtrace.h
-rw-r--r-- 1 root root 12782 Feb 22 21:13 /opt/include/python3.11/pyerrors.h
-rw-r--r-- 1 root root 2450 Feb 22 21:13 /opt/include/python3.11/pyexpat.h
-rw-r--r-- 1 root root 551 Feb 22 21:13 /opt/include/python3.11/pyframe.h
-rw-r--r-- 1 root root 4154 Feb 22 21:13 /opt/include/python3.11/pyhash.h
-rw-r--r-- 1 root root 2249 Feb 22 21:13 /opt/include/python3.11/pylifecycle.h
-rw-r--r-- 1 root root 2989 Feb 22 21:13 /opt/include/python3.11/pymacconfig.h
-rw-r--r-- 1 root root 6064 Feb 22 21:13 /opt/include/python3.11/pymacro.h
-rw-r--r-- 1 root root 1979 Feb 22 21:13 /opt/include/python3.11/pymath.h
-rw-r--r-- 1 root root 3890 Feb 22 21:13 /opt/include/python3.11/pymem.h
-rw-r--r-- 1 root root 24452 Feb 22 21:13 /opt/include/python3.11/pyport.h
-rw-r--r-- 1 root root 4635 Feb 22 21:13 /opt/include/python3.11/pystate.h
-rw-r--r-- 1 root root 436 Feb 22 21:13 /opt/include/python3.11/pystrcmp.h
-rw-r--r-- 1 root root 1557 Feb 22 21:13 /opt/include/python3.11/pystrtod.h
-rw-r--r-- 1 root root 1189 Feb 22 21:13 /opt/include/python3.11/pythonrun.h
-rw-r--r-- 1 root root 4833 Feb 22 21:13 /opt/include/python3.11/pythread.h
-rw-r--r-- 1 root root 851 Feb 22 21:13 /opt/include/python3.11/pytypedefs.h
Sorry, my assessment was a bit hasty. It seems that your system has the Python headers installed after all.
So it is probably a problem with the C++ code generated by Cython.
I'm not sure if it is using the generated C++ code from the source distribution or if it is generating it on your system.
Are you compiling from the source distribution (e.g. by using pip install
) or from the git repo?
Sorry, my assessment was a bit hasty. It seems that your system has the Python headers installed after all.
So it is probably a problem with the C++ code generated by Cython.
I'm not sure if it is using the generated C++ code from the source distribution or if it is generating it on your system.
Are you compiling from the source distribution (e.g. by using
pip install
) or from the git repo?
From PyPi, like a manual. https://spotlightkid.github.io/python-rtmidi/installation.html Section "From PyPI"
Can you try installing from the git repo as described here?
git clone --recursive https://github.com/SpotlightKid/python-rtmidi.git
cd python-rtmidi
[sudo] python -m pip install build installer
python -m build --wheel
[sudo] python -m installer dist/*.whl
@kamulchik Any luck compiling python-rtmidi on CoreElec yet?
Any luck compiling python-rtmidi on CoreElec yet
I think your distro is not really meant for building software directly on the device. In the long run, you're probably better off setting up a cross-compilation build environment on your PC.
You are right. So I lost a lot of time for tries. At now, i have beautiful error: module 'venv' has no attribute 'EnvBuilder'. When envvuilder installed : ^) I need more time....
Python version: Python 3.10.7
Binutils info:
Error when trying pip install python-rtmidi