chrisstaite / lameenc

Python bindings around the LAME encoder
GNU Lesser General Public License v3.0
51 stars 8 forks source link

No builds for apple silicon #13

Closed lminer closed 2 years ago

lminer commented 3 years ago

Are there any plans to release apple silicon builds to pypi? Would be nice to be able to pip install this!

chrisstaite commented 2 years ago

There's currently no support for M1 builds on GitHub Actions. If that changes, I'll update the build to use it. Poke me here if you notice support has been added or there's another way to create the builds. You should be able to build them locally pretty easily, which is beside the point of this project, but I don't see another option at the moment.

nils-werner commented 2 years ago

Why don't you also publish sdist releases?

chrisstaite commented 2 years ago

Because the setup.py isn't able to build the lame library.

nils-werner commented 2 years ago

Can't I link against my OS'es libraries?

chrisstaite commented 2 years ago

LAME is not distributed with macOS

nils-werner commented 2 years ago

It is available through homebrew (or your Linux package manager).

chrisstaite commented 2 years ago

If you'd like to build it yourself it's very easy to just clone the repo and build the cmake.

hanton2222 commented 2 years ago

Forgive my ignorance, but I've successfully cloned and built this, and now I'm trying to install using "python3 setup.py install ". However, I need to provide "--libdir=" and a "--incdir=". What is it exactly I should input here?

chrisstaite commented 2 years ago

Once built you install the wheel by using python3 -m pip install *.whl

hanton2222 commented 2 years ago

I get this error: "ERROR: lameenc-1.4.0-cp38-cp38-macosx_10_14_6_arm64.whl is not a supported wheel on this platform."

Do I need to provide some arguments to cmake to build for a Mac M1 running macOS 12?

chrisstaite commented 2 years ago

Sounds like you didn't build it for your Python version. I don't have an M1 mac, so I can't debug it unfortunately. It sounds like you've got two versions of Python installed, one through Rosetta2 and another that isn't and the build is using one and your install is using the other.

hanton2222 commented 2 years ago

That makes sense. I've got both the default Pyhton2.7 installation and 3.8.9. Thanks!

*Edit: Just in case other rookies using a M1 Mac are having the same issues as me: I think the issue was that Python 3.8.9 didn't support build for the M1 architecture. This was however added in 3.8.10. Updating to the latest 3.8 release, 3.8.12 fixed it for me.

hanton2222 commented 2 years ago

So, seems like I wasn't really finished after all. The build is successful, but when trying to import it in a .py file containing only the line import lameenc I get this error:

Traceback (most recent call last): File "/Users/USERNAME/lameenc/lameenctest.py", line 1, in <module> import lameenc ImportError: dlopen(/Users/USERNAME/.pyenv/versions/3.9.10/lib/python3.9/site-packages/lameenc.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_lame_close'

(I'm using Python 3.9.10 here, but this happens with 3.8.12 and 3.10.2 as well)

chrisstaite commented 2 years ago

Sounds like you're dynamically linking to liblame rather than statically. Did libmp3lame.a build?

chrisstaite commented 2 years ago

Managed to figure out how to cross-compile this evening, so builds are currently uploading to PyPi for Apple Silicon for Python 3.7-3.10 under the tag 1.4.1.