lavadsp icon indicating copy to clipboard operation
lavadsp copied to clipboard

Add M1 support to build

Open Stonedestroyer opened this issue 1 year ago • 2 comments

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:

  • [x] Solve the native folder for darwin creating several files

Stonedestroyer avatar Aug 10 '22 06:08 Stonedestroyer

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.

Stonedestroyer avatar Aug 11 '22 01:08 Stonedestroyer

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

natanbc avatar Aug 21 '22 05:08 natanbc