Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M1 support broken since v8.0.1 #127

Open
Kikobeats opened this issue Jan 17, 2022 · 15 comments · Fixed by #128
Open

M1 support broken since v8.0.1 #127

Kikobeats opened this issue Jan 17, 2022 · 15 comments · Fixed by #128

Comments

@Kikobeats
Copy link

Hello,

I'm using this library at https://github.com/microlinkhq/ffprobe

I noted some of the last versions are missing; also, the latest version published is broken in some way I not fully understand.

Here is the way to reproduce the problem:

npm i [email protected] && npm run postinstall

up to date in 874ms

> @microlink/[email protected] postinstall
> node scripts/postinstall.js

dyld[52834]: missing symbol called
fish: Job 1, 'npm run postinstall' terminated by signal SIGABRT (Abort)

~/Projects/microlink/ffprobe master*
❯ npm i [email protected] && npm run postinstall
npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kikobeats/.npm/_logs/2022-01-17T11_47_43_916Z-debug.log

~/Projects/microlink/ffprobe master*
❯ npm i [email protected] && npm run postinstall
npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kikobeats/.npm/_logs/2022-01-17T11_47_50_145Z-debug.log

~/Projects/microlink/ffprobe master*
❯ npm i [email protected] && npm run postinstall
npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kikobeats/.npm/_logs/2022-01-17T11_47_53_700Z-debug.log

~/Projects/microlink/ffprobe master*
❯ npm i [email protected] && npm run postinstall

changed 1 package in 19s

> @microlink/[email protected] postinstall
> node scripts/postinstall.js

# exit with 0 in this case, all fine
Kikobeats added a commit to microlinkhq/ffprobe that referenced this issue Jan 17, 2022
until the following issue is resolved:
addaleax/lzma-native#127
@addaleax
Copy link
Owner

@Kikobeats Which exact OS is this (platform + OS version + architecture)?

@Kikobeats
Copy link
Author

npx envinfo --binaries --system

  System:
    OS: macOS 12.0.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 477.34 MB / 32.00 GB
    Shell: 3.3.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 16.13.1 - ~/.local/share/nvm/v16.13.1/bin/node
    Yarn: 1.22.17 - /opt/homebrew/bin/yarn
    npm: 8.1.2 - ~/.local/share/nvm/v16.13.1/bin/npm

@addaleax
Copy link
Owner

@beorn @tylinux @malept any ideas? this is happening specifically on Apple Silicon, and I don’t have a local setup to test things out there

@beorn
Copy link

beorn commented Jan 17, 2022

Running yarn in ffprobe also doesn't work for me - the lzma.Decompressor() fails:

% yarn node scripts/postinstall.js
dyld[89886]: missing symbol called
error Command failed.
Exit signal: SIGABRT

Also:

% cd node_modules/lzma-native
% grep version package.json                         
  "version": "8.0.5",
% # copy test files into test
% yarn test
 yarn run v1.22.17
 $ mocha --expose-gc -s 1000 -t 5000


  Compressor/Decompressor
dyld[90388]: missing symbol called
error Command failed with signal "SIGABRT".

Maybe there's something weird about the prebuild?

@tylinux
Copy link
Contributor

tylinux commented Jan 18, 2022

Run yarn node-gyp-build and copy build/Release/lzma_native.node to demo project 's node_modules/lzma-native/prebuilds/darwin-arm64/node.napi.node, works good. Good file's size is 416KB, bad's is 228KB. Maybe there's something weird about the prebuild.

@addaleax
Copy link
Owner

Looks like this might not have fixed the issue entirely? #129 (comment)

@addaleax addaleax reopened this Jan 18, 2022
@Kikobeats
Copy link
Author

In case you want to replicate in your end, if you have a M1 laptop just:

  1. git clone https://github.com/microlinkhq/ffprobe
  2. npm install

and you can see the crash

@tylinux
Copy link
Contributor

tylinux commented Jan 19, 2022

I think the problem is ARM64's binary file is build from x86_64 host...

@malept
Copy link
Contributor

malept commented Jan 19, 2022

If cross compilation is a problem then that is extremely problematic, no CI provider I'm aware of currently has macOS/arm64 builders.

@Kikobeats Kikobeats changed the title broken since v8.0.1 M1 support broken since v8.0.1 Jan 19, 2022
@tmacwill
Copy link

First, thanks for all of your hard work on this library! I'm also trying to use this on an M1 Mac, and here's what I'm seeing.

When I clone this repo and just run yarn, everything builds without errors. When I try to build an x64 version (in order to ship a desktop application that's compatible on non-M1 Macs) via the command:

npm_config_arch=x64 yarn

I get the below:

ld: warning: ignoring file /Users/tmac/lzma-native/build/liblzma/build/lib/liblzma.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

The same occurs with --target_arch=x64. This suggests that the underlying liblzma build isn't using the npm_config_arch environment variable to set the architecture (maybe it's just using the host machine architecture instead?), and the errors here are due to mixing architectures.

I'm happy to help out with a fix here, just wasn't 100% sure where to start. Also happy to try things on my M1 machine if that'd be helpful as well.

Finally, here's my system:

  System:
    OS: macOS 11.4
    CPU: (8) arm64 Apple M1
    Memory: 119.73 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.1 - /opt/homebrew/Cellar/node@16/16.13.1/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.1.2 - /opt/homebrew/Cellar/node@16/16.13.1/bin/npm

@amatosov-rbx
Copy link

amatosov-rbx commented Apr 29, 2022

I am seeing the same issue and would like to help finding the solution

I see the commit 8af909b that added conditional patching to liblzma-config.sh
However the condition in it going to pass only for native builds if [ $(uname) = "Darwin" -a $(uname -m) = "arm64" ]; then and will be skipped for cross builds

Edit: Tried that in a fork, it did not fix the issue

@matafonoff
Copy link

Any updates on this issue?

@H4kt
Copy link

H4kt commented Sep 8, 2022

Is there any chance of this getting fixed?

@carlocorradini
Copy link

Any update? 😥

@meichthys
Copy link

I'm also seeing this on an M1 mac running Asahi Linux Fedora.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.