TooTallNate / node-lame

Node.js native bindings to libmp3lame & libmpg123
MIT License
567 stars 113 forks source link

Support M1 macOS #105

Open vjpr opened 2 years ago

vjpr commented 2 years ago

libmpg123

See: https://github.com/TooTallNate/node-speaker/issues/172

We need to patch deps/mpg123/mpg123.gyp in same way.


autoreconf -iv
./configure

libmp3lame

make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
deps/mpg123/test.target.mk:177: warning: overriding commands for target `Release/test'
deps/lame/test.target.mk:185: warning: ignoring old commands for target `Release/test'
  cc -o Release/obj.target/mp3lame/deps/lame/libmp3lame/VbrTag.o ../deps/lame/libmp3lame/VbrTag.c '-DPIC' '-DHAVE_CONFIG_H' '-DNODE_GYP_MODULE_NAME=mp3lame' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNDEBUG' -I../deps/lame/include -I../deps/lame/libmp3lame -I../deps/lame/libmp3lame/vector -I../deps/lame/config/mac/arm64 -I/Users/Vaughan/Library/Caches/node-gyp/18.0.0/include/node -I/Users/Vaughan/Library/Caches/node-gyp/18.0.0/src -I/Users/Vaughan/Library/Caches/node-gyp/18.0.0/deps/openssl/config -I/Users/Vaughan/Library/Caches/node-gyp/18.0.0/deps/openssl/openssl/include -I/Users/Vaughan/Library/Caches/node-gyp/18.0.0/deps/uv/include -I/Users/Vaughan/Library/Caches/node-gyp/18.0.0/deps/zlib -I/Users/Vaughan/Library/Caches/node-gyp/18.0.0/deps/v8/include  -O3 -gdwarf-2 -mmacosx-version-min=10.15 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/mp3lame/deps/lame/libmp3lame/VbrTag.o.d.raw   -c
../deps/lame/libmp3lame/VbrTag.c:26:11: fatal error: 'config.h' file not found
# include <config.h>
          ^~~~~~~~~~
1 error generated.

autoreconf -iv
configure.in:81: error: automatic de-ANSI-fication support has been removed

FIX: Just remove the packages from configure.in for now.

See also: https://github.com/chokkan/crfsuite/issues/30


./configure
checking build system type... configure: error: /bin/sh ./config.sub -apple-darwin21.2.0 failed
configure: WARNING: cache variable ac_cv_build contains a newline

./config.sub -apple-darwin21.2.0 should be /config.sub arm-apple-darwin21.2.0. (or maybe arm64???)

See also: https://github.com/pyca/pynacl/issues/657

Manually patch config.sub

1.

build_alias=arm-apple-darwin21.2.0 ./configure --verbose

Add arm64-* | next to arm-*.


Had to copy deps/lame/config.h to deps/lame/config/mac/arm64/config.h because gyp uses that include dir.


Bunch of macro errors relating to mpg123...we should just use the build from node-speaker...or try out https://github.com/devowlio/node-lame