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

Build script improvements #34

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

bemoody
Copy link

@bemoody bemoody commented Jul 17, 2024

A few small changes to make the build scripts behave more predictably.

  • set the script interpreter

  • if any command fails, the script should fail

  • don't assume pkg-config is installed

Benjamin Moody added 3 commits July 17, 2024 18:19
Ensure that these scripts are executed by the standard 'sh', rather
than whatever your current shell happens to be.
If pkg-config is installed, then libsndfile's configure will try to
use pkg-config to check whether the optional dependencies (flac, ogg,
vorbis, opus, mpg123) are present.  (It will conclude that the
packages are present because the appropriate *_CFLAGS and *_LIBS are
set.)

If pkg-config isn't installed, then --enable-external-libs and
--enable-mpeg must be set explicitly in order to use these packages.
Remove the old workflow using CentOS 7 (which is unsupported and
broken) and replace it with one using a newer (glibc 2.28 based)
container from pypa.
@bemoody
Copy link
Author

bemoody commented Jul 25, 2024

I don't really know what I'm doing, but I've tried to update the workflow to use the "manylinux_2_28" container from https://github.com/pypa/manylinux in place of the old CentOS 7 one.

Let's see if it works?

Note that GitHub's "macos-13" runners are x86-64 whereas "macos-14"
runners are arm64.
@bemoody
Copy link
Author

bemoody commented Jul 25, 2024

It looks like the manylinux_2_28 build is okay.

But it sounds like macos-11 is no longer available:
https://github.blog/changelog/2024-05-20-actions-upcoming-changes-to-github-hosted-macos-runners/#macos-11-deprecation-and-removal

It probably makes sense to switch Intel builds to use macos-13 and arm64 to macos-14. (I'm guessing since mac_build.sh sets MACOSX_DEPLOYMENT_TARGET, that means the binaries should be backward-compatible?)

It looks like there are some other build problems on Windows, unfortunately.

The libvorbis configure script will try multiple methods to find the
libogg headers and library.  Using the pkg-config variables is the
newer and probably-more-stable method.
@bemoody
Copy link
Author

bemoody commented Jul 25, 2024

Problem in libvorbis: xiph/vorbis#107

Benjamin Moody added 3 commits July 26, 2024 12:48
Instead of using an arm64 native compiler and everything else running
inside an emulator, use the aarch64-linux-gnu cross compiler provided
by Debian 10 (glibc 2.28).
In libsndfile 1.2.1 and 1.2.2, the spelling of "mpg123" in the cmake
variable names was changed to lowercase.
@bemoody
Copy link
Author

bemoody commented Jul 26, 2024

So, this pull request has expanded greatly in scope.

The darwin.cmake was broken by the latest libsndfile. It was apparently passing builds for MacOS Intel because it was erroneously linking to some libmpg123.dylib that it found lying around the build environment.

Additionally, I've added a workaround for the vorbis issue.

Meanwhile, on the Linux side: I switched the workflow to building the arm64 library using a cross-compiler on Debian 10 (amd64), rather than running a native compiler on an emulated CPU. This should be much faster! I haven't yet tested the resulting binary, and it should be checked (using auditwheel?) to make sure it's using the correct ABI for manylinux_2_28.

Something is still broken in Windows and I have not begun to dig into that. My personal inclination would be to use cross-compilation there too.

@bastibe
Copy link
Owner

bastibe commented Jul 27, 2024

Wow, that's an extensive set of changes! Thank you so much for looking into this!

@bastibe
Copy link
Owner

bastibe commented Jul 27, 2024

Regrettably, cross-compilation doesn't work for Windows, as Python is built with the MSVC compiler, and all linked libraries are required to use the MSVC compiler as well. Clang and GCC can be made to work in some narrow circumstances, but it's just a recipe for headaches.

I'd guess that, either, there's a bug in the VCPKG build file that will resort itself, or that something about the "-custom" triplet is no longer appropriate.

@bastibe
Copy link
Owner

bastibe commented Jul 28, 2024

Do you want to take a stab at the Windows compilation issue as well? No problem at all if not. I'm absolutely grateful for what you have done and achieved so far!

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

Successfully merging this pull request may close these issues.

2 participants