Skip to content

Support M1 macOS #172

@vjpr

Description

@vjpr
│ gyp: name 'mpg123_cpu' is not defined while evaluating condition 'mpg123_cpu=="arm_nofpu"' in deps/mpg123/mpg123.gyp while loading dependencies of binding.gyp while trying to load binding.gyp
.../speaker@0.5.4/node_modules/speaker install$ node-gyp rebuild
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@8.4.1
│ gyp info using node@18.0.0 | darwin | arm64
│ gyp info find Python using Python version 3.10.2 found at "/Users/Vaughan/.pyenv/versions/3.10.2/bin/python3"
│ gyp info spawn /Users/Vaughan/.pyenv/versions/3.10.2/bin/python3
│ gyp info spawn args [
│ gyp info spawn args   '/Users/Vaughan/Library/pnpm/global/5/.pnpm/pnpm@7.0.1/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py',
│ gyp info spawn args   'binding.gyp',
│ gyp info spawn args   '-f',
│ gyp info spawn args   'make',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/Vaughan/dev-mono/thirtyfive/node_modules/.pnpm/speaker@0.5.4/node_modules/speaker/build/config.gypi',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/Vaughan/Library/pnpm/global/5/.pnpm/pnpm@7.0.1/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/Vaughan/Library/Caches/node-gyp/18.0.0/include/node/common.gypi',
│ gyp info spawn args   '-Dlibrary=shared_library',
│ gyp info spawn args   '-Dvisibility=default',
│ gyp info spawn args   '-Dnode_root_dir=/Users/Vaughan/Library/Caches/node-gyp/18.0.0',
│ gyp info spawn args   '-Dnode_gyp_dir=/Users/Vaughan/Library/pnpm/global/5/.pnpm/pnpm@7.0.1/node_modules/pnpm/dist/node_modules/node-gyp',
│ gyp info spawn args   '-Dnode_lib_file=/Users/Vaughan/Library/Caches/node-gyp/18.0.0/<(target_arch)/node.lib',
│ gyp info spawn args   '-Dmodule_root_dir=/Users/Vaughan/dev-mono/thirtyfive/node_modules/.pnpm/speaker@0.5.4/node_modules/speaker',
│ gyp info spawn args   '-Dnode_engine=v8',
│ gyp info spawn args   '--depth=.',
│ gyp info spawn args   '--no-parallel',
│ gyp info spawn args   '--generator-output',
│ gyp info spawn args   'build',
│ gyp info spawn args   '-Goutput_dir=.'
│ gyp info spawn args ]
│ gyp: name 'mpg123_cpu' is not defined while evaluating condition 'mpg123_cpu=="arm_nofpu"' in deps/mpg123/mpg123.gyp while loading dependencies of binding.gyp while trying to load binding.gyp
│ gyp ERR! configure error
│ gyp ERR! stack Error: `gyp` failed with exit code: 1
│ gyp ERR! stack     at ChildProcess.onCpExit (/Users/Vaughan/Library/pnpm/global/5/.pnpm/pnpm@7.0.1/node_modules/pnpm/dist/node_modules/node-gyp/lib/configure.js:259:16)
│ gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
│ gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
│ gyp ERR! System Darwin 21.2.0
│ gyp ERR! command "/Users/Vaughan/Library/pnpm/nodejs/18.0.0/bin/node" "/Users/Vaughan/Library/pnpm/global/5/.pnpm/pnpm@7.0.1/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
│ gyp ERR! cwd /Users/Vaughan/dev-mono/thirtyfive/node_modules/.pnpm/speaker@0.5.4/node_modules/speaker
│ gyp ERR! node -v v18.0.0
│ gyp ERR! node-gyp -v v8.4.1
│ gyp ERR! not ok

Here is the condition that is failing:

'conditions': [
['mpg123_cpu=="arm_nofpu"', {
'defines': [
'OPT_ARM',
'REAL_IS_FIXED',
'NEWOLD_WRITE_SAMPLE',
],
'sources': [
'src/libmpg123/synth_arm.S',
],
}],

mpg123_cpu is not defined.

Here is where it is defined:

{
'target_name': 'mpg123',
'product_prefix': 'lib',
'type': 'static_library',
'variables': {
'conditions': [
# "mpg123_cpu" is the cpu optimization to use
# Windows uses "i386_fpu" even on x64 to avoid compiling .S asm files
# (I don't think the 64-bit ASM files are compatible with `ml`/`ml64`...)
['OS=="win"', { 'mpg123_cpu%': 'i386_fpu' },
{ 'conditions': [
['target_arch=="arm"', { 'mpg123_cpu%': 'arm_nofpu' }],
['target_arch=="ia32"', { 'mpg123_cpu%': 'i386_fpu' }],
['target_arch=="x64"', { 'mpg123_cpu%': 'x86-64' }],
]}],
]
},

FIX: Change arm to arm64.


pnpm dlx node-gyp rebuild --verbose

gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
  cc -o Release/obj.target/output/deps/mpg123/src/output/coreaudio.o ../deps/mpg123/src/output/coreaudio.c '-DNODE_GYP_MODULE_NAME=output' '-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' '-DPIC' '-DNOXFERMEM' '-DREAL_IS_FLOAT' '-DHAVE_CONFIG_H' '-DBUILDING_OUTPUT_MODULES=1' '-DNDEBUG' -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 -I../deps/mpg123/src -I../deps/mpg123/src/output -I../deps/mpg123/src/libmpg123 -I../deps/mpg123/config/mac/arm64  -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/output/deps/mpg123/src/output/coreaudio.o.d.raw   -c
In file included from ../deps/mpg123/src/output/coreaudio.c:12:
../deps/mpg123/src/mpg123app.h:14:10: fatal error: 'config.h' file not found
#include "config.h"

If you look in deps/mpg123/config/arm64 it doesn't exist. Only arm does.


Let's reconfigure.

$ ./configure
 
configure: error: cannot find sources (doc) in . or ..

As mentioned in deps/mpg123/INSTALL, we re-create the configure script.

$ autoreconf -iv

configure.ac:2084: error: required file 'doc/Makefile.in' not found
Makefile.am:8: error: required directory ./doc does not exist
Makefile.am:9: error: required directory ./doc does not exist

doc is included by these lines in configure.ac:

AC_CONFIG_SRCDIR(doc)

So we just get rid of that and run autoreconf.

autoreconf -iv
./configure
cd ..
pnpm dlx node-gyp rebuild --verbose

Set package.json#dependencies to

 "speaker": "link:///path/to/node-speaker"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions