Yikai-Liao / symusic

A cross platform note level midi decoding library with lightening speed, based on minimidi.
https://yikai-liao.github.io/symusic/
MIT License
108 stars 8 forks source link

Unable to build on linux #26

Closed JLenzy closed 4 months ago

JLenzy commented 4 months ago

pip install symusic worked fine on my local system, but isn't building on a linux google VM.

Python: Python 3.9.18

PyPy: Python 3.7.10 (7.3.5+dfsg-2+deb11u2, Nov 01 2022, 20:16:36) [PyPy 7.3.5 with GCC 10.2.1 20210110

It seems to fail during the CMake build process. Pasting just the end of the error log:

tor<unsigned char, std::allocator<unsigned char> >]’
      /var/tmp/pip-install-bk3m82wb/symusic_80be9b57712b46c19076677986767473/src/io/zpp.cpp:130:1:   required from here
      /var/tmp/pip-install-bk3m82wb/symusic_80be9b57712b46c19076677986767473/3rdparty/zpp_bits/zpp_bits.h:80:30: 
error: ‘__builtin_bit_cast’ was not declared in this scope; did you mean ‘__builtin_strcat’?
         80 |     return __builtin_bit_cast(ToType, from);
            |            ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
            |            __builtin_strcat
      [6/63] Building CXX object CMakeFiles/symusic.dir/src/utils.cpp.o
      [7/63] Building CXX object CMakeFiles/symusic.dir/src/score.cpp.o
      [8/63] Building CXX object CMakeFiles/symusic.dir/src/io/midi.cpp.o
      [9/63] Building CXX object CMakeFiles/symusic.dir/src/conversion.cpp.o
      [10/63] Building CXX object CMakeFiles/symusic.dir/src/track.cpp.o
      ninja: build stopped: subcommand failed.

      *** CMake build failed

Any help would be greatly appreciated! This is also preventing me from updating my Miditok installation.

JLenzy commented 4 months ago

Small update, I just tried manually download a different PyPy build and installing it and I'm still getting the error. But here is my new PyPy version:

pypy --version
Python 3.9.18 (9c4f8ef178b6, Jan 14 2024, 11:28:13)
[PyPy 7.3.15 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)]
Yikai-Liao commented 4 months ago

It's because zpp_bits, serialization library we use, breaks compatibility with anything lower than C++20. And you should use at least gcc11.

Yikai-Liao commented 4 months ago

I remember that symusic do offer pre-compiled wheels for pypy. I don't quite get why you need to compile it manually. Is there anything special on google VM? Or we just missed some versions?

JLenzy commented 4 months ago

Initially I haven't tried to compile anything manually. I just did pip install symusic which is what produced the initial error message you see at the top. This is Debian 11 FYI

Yikai-Liao commented 4 months ago

I understand. It's my fault. There is something wrong with the github actions, and it failed to upload all the pre-compiled wheels.

Sorry for that, and you could try pip install symusic==0.3.4 first. I will find a way to upload them as soon as possible.

image

JLenzy commented 4 months ago

Perfect - I just tried with 0.3.2 and it worked perfectly. Thank you for your prompt fix!

Natooz commented 4 months ago

Hi 👋 @JLenzy just pinged me for this (@Yikai-Liao thanks for your reactivity as always! 💪) Just wanted to add that we could maybe add the --prefer-binary flag somewhere in the install doc? It is not enabled by default, and pip3.9 will install and build from source https://github.com/pypa/pip/issues/9140

Yikai-Liao commented 4 months ago

Well, I think it is a temporary issue. --prefer-binary flag means you will install the lastest pre-compiled wheel, and we would pre-compile for almost all the supported platforms (except for windows arm). Therefore, for most of the time, you don't need to take of this flag.

This time, the cibuildwheel image of pypa used in the github acitons had an update that was not forward-compatible and in the runtime we got a warning that the upload-artifact v3 version was too low. So then, we switch to upload-artifact v4, which is still not forward-compatible.

Now it seems that we are not using upload-artifact v4 correctly, and we failed to upload the new pre-compiled wheels. Since for 0.3.5, only source code was successfully uploaded to pypi, any installation of this version will lead to local compilation.

Yikai-Liao commented 4 months ago

@JLenzy precompiled wheels for 0.3.5 have been successfully uploaded now🎉

Also thanks for the help of @lzqlzzq

JLenzy commented 4 months ago

Brilliant, thanks again for the prompt fix and excellent library