natanbc / lavadsp

A bunch of lavaplayer audio filters
Apache License 2.0
60 stars 22 forks source link

Add M1 support to build #90

Open Stonedestroyer opened 2 years ago

Stonedestroyer commented 2 years ago

Depends on #88, thanks @Walkyst for your work there!

This adds M1 as a target compilation from x86_x64 mac runner, in addition min deployment target with the default XCode supplied is 10.12.6, as Lavalink will only run on 10.12, re @aikaterna.

Thanks to @aikaterna and @jack1142 for assisting with this PR.

Some improvements, we could ditch Java 15 and use the built-in Github runner java versions https://github.com/actions/runner-images/blob/main/images/macos/macos-11-Readme.md#java but it's not really needed, unless you want me to do that @natanbc

TODO:

Stonedestroyer commented 2 years ago

This is blocked by the native lib loader not supporting mac m1,

Per tests by @aikaterna loading natives on mac m1 would load the avx2 one, as aarch64 does not contain support for avx2 it will crash.

The issue to my understanding the upstream library cpu_features for native lib detector does not support m1. The support is pending on the upstream library, see https://github.com/natanbc/native-loader/issues/1.

A solution would be to do something smilar to , https://github.com/aikaterna/lavadsp/blob/f6fce3c9d3c630a77061780f2902c551416c5a12/src/main/java/com/github/natanbc/lavadsp/natives/TimescaleNativeLibLoader.java#L35. This would ensure we do not load avx2 on Mac m1 arm, and would work until cpu_features gets updated or we get a better solution.

The solution above is tested and works.

natanbc commented 2 years ago

Started working on a rewrite of native-loader, which will also support M1 https://github.com/natanbc/native-loader/tree/native-rewrite