andygrundman / Audio-Scan

Audio::Scan - Fast Perl XS metadata and tag reader for all common audio file formats
GNU General Public License v2.0
3 stars 13 forks source link

Building on Apple M1 #8

Closed michaelherger closed 2 years ago

michaelherger commented 3 years ago

Hi @andygrundman - I'm trying to build Audio::Scan on a new Apple M1 based system, using the good old buildme.sh script. Unfortunately it doesn't get far:

build_module run tests:1 clean:1 hints 1 Audio-Scan-1.02 
Adding -arch arm64 -arch x86_64 -mmacosx-version-min=11.0
Warning (mostly harmless): No library found for -lz
Generating a Unix-style Makefile
Writing Makefile for Audio::Scan
Writing MYMETA.yml and MYMETA.json
Running Mkbootstrap for Scan ()
chmod 644 "Scan.bs"
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Scan.bs blib/arch/auto/Audio/Scan/Scan.bs 644
cc -c  -Iinclude -Isrc -arch arm64 -arch x86_64 -mmacosx-version-min=11.0 -I/usr/include  -g -pipe -fno-strict-aliasing -fstack-protector-strong -DPERL_USE_SAFE_PUTENV -Os   -DVERSION=\"1.02\" -DXS_VERSION=\"1.02\"  -iwithsysroot "/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE"   Scan.c
rm -f blib/arch/auto/Audio/Scan/Scan.bundle
cc  -arch arm64 -arch x86_64 -mmacosx-version-min=11.0 -L/usr/lib  -bundle -undefined dynamic_lookup -fstack-protector-strong  Scan.o  -o blib/arch/auto/Audio/Scan/Scan.bundle  \
          \

chmod 755 blib/arch/auto/Audio/Scan/Scan.bundle
Skip blib/lib/Audio/Scan.pm (unchanged)
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01use.t .......... 1/1 
#   Failed test 'use Audio::Scan;'
#   at t/01use.t line 3.
#     Tried to use 'Audio::Scan'.
#     Error:  Can't load '/Users/mh/SynologyDrive/git/slimserver-vendor/CPAN/Audio-Scan-1.02/blib/arch/auto/Audio/Scan/Scan.bundle' for module Audio::Scan: dlopen(/Users/mh/SynologyDrive/git/slimserver-vendor/CPAN/Audio-Scan-1.02/blib/arch/auto/Audio/Scan/Scan.bundle, 0x0002): symbol '_uncompress' not found, expected in flat namespace by '/Users/mh/SynologyDrive/git/slimserver-vendor/CPAN/Audio-Scan-1.02/blib/arch/auto/Audio/Scan/Scan.bundle' at /System/Library/Perl/5.28/darwin-thread-multi-2level/DynaLoader.pm line 197.
#  at t/01use.t line 3.
# Compilation failed in require at t/01use.t line 3.
# BEGIN failed--compilation aborted at t/01use.t line 3.
# Looks like you failed 1 test of 1.

(and a lot more test failures thereafter, of course)

Not much info there. Any hints where I could start digging?

andygrundman commented 3 years ago

lz is zlib, which I guess you now need to build yourself? You could add it to buildme.sh as another library and statically link it in like we do for other libs. I had just assumed it would be available everywhere to avoid statically linking it.

M1 looks awesome, I'm jealous that you get to play with Universal Binaries again! Looks like buildme.sh still has some UB code that hopefully is still useful.

michaelherger commented 3 years ago

I'm not so enthusiastic about this task 😃. I thought I'd give it a try, but I fear it's way beyond me. Most of the dependencies compiled ok so far. But the important ones (yours!) prove to be difficult (eg. assembly code in https://github.com/libjpeg-turbo/libjpeg-turbo). I'd be happy to grant you access to my little box if you could help me out here... I'm currently using it for nothing but this attempt to get LMS running natively on Apple Silicon...

michaelherger commented 2 years ago

Never mind. I think I got the build params wrong in my first attempts. Audio::Scan seems to compile just fine. There are a few places where we hard-coded x86_64 in the build script for other modules. But that doesn't belong here.