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

Bug: usearch@2.10.x nodejs installation fails #377

Open
2 tasks done
jlarmstrongiv opened this issue Apr 1, 2024 · 78 comments
Open
2 tasks done

Bug: usearch@2.10.x nodejs installation fails #377

jlarmstrongiv opened this issue Apr 1, 2024 · 78 comments
Labels
bug Something isn't working released

Comments

@jlarmstrongiv
Copy link
Contributor

jlarmstrongiv commented Apr 1, 2024

Describe the bug

NPM install fails on arm64 linux. I presume it couldn’t find a new prebuilt binary (exciting new feature from @sroussey), and fell back to compiling from scratch, which it can no longer do because the source and gyp files have been removed from the npm package.

Run npm ci
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN deprecated @aws-sdk/middleware-retry@3.374.0: This package has moved to @smithy/middleware-retry
npm WARN deprecated @aws-sdk/config-resolver@3.374.0: This package has moved to @smithy/config-resolver
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated @aws-sdk/smithy-client@3.374.0: This package has moved to @smithy/smithy-client
npm WARN deprecated @astrojs/webapi@3.0.0: This package is not used by Astro any more and is no longer maintained. In Astro 3.0 polyfills are part of a core module.
npm ERR! code 1
npm ERR! path /home/runner/actions-runner/_work/project/project/node_modules/usearch
npm ERR! command failed
npm ERR! command sh -c node-gyp-build
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.1.0
npm ERR! gyp info using node@20.11.1 | linux | arm64
npm ERR! gyp info find Python using Python version 3.10.12 found at "/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v20.11.1/node-v20.11.1-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v20.11.1/node-v20.11.1-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v20.11.1/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v20.11.1/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/home/runner/actions-runner/_work/project/project/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/runner/actions-runner/_work/project/project/node_modules/usearch/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/runner/actions-runner/_work/project/project/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/runner/.cache/node-gyp/20.11.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/home/runner/.cache/node-gyp/20.11.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/runner/actions-runner/_work/project/project/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/runner/.cache/node-gyp/20.11.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/runner/actions-runner/_work/project/project/node_modules/usearch',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp: binding.gyp not found (cwd: /home/runner/actions-runner/_work/project/project/node_modules/usearch) while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/home/runner/actions-runner/_work/project/project/node_modules/node-gyp/lib/configure.js:297:18)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:518:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Linux 5.15.0-84-generic
npm ERR! gyp ERR! command "/opt/hostedtoolcache/node/20.11.1/arm64/bin/node" "/home/runner/actions-runner/_work/project/project/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/runner/actions-runner/_work/project/project/node_modules/usearch
npm ERR! gyp ERR! node -v v20.11.1
npm ERR! gyp ERR! node-gyp -v v10.1.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/2024-04-01T21_50_25_304Z-debug-0.log
Error: Process completed with exit code 1.

Steps to reproduce

On an arm64 machine, run

docker run -it --entrypoint /bin/bash --rm public.ecr.aws/lambda/nodejs:20-arm64

Inside the container, run

dnf install -y python3 make gcc-c++
npm init -y
npm i usearch

View the error:

npm ERR! code 1
npm ERR! path /var/task/node_modules/usearch
npm ERR! command failed
npm ERR! command sh -c node-gyp-build
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@20.9.0 | linux | arm64
npm ERR! gyp info find Python using Python version 3.9.16 found at "/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v20.9.0/node-v20.9.0-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v20.9.0/node-v20.9.0-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v20.9.0/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v20.9.0/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/var/lang/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/var/task/node_modules/usearch/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/var/lang/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/root/.cache/node-gyp/20.9.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/20.9.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/var/lang/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/20.9.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/var/task/node_modules/usearch',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp: binding.gyp not found (cwd: /var/task/node_modules/usearch) while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/var/lang/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:325:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Linux 6.6.12-linuxkit
npm ERR! gyp ERR! command "/var/lang/bin/node" "/var/lang/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /var/task/node_modules/usearch
npm ERR! gyp ERR! node -v v20.9.0
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-04-01T23_50_47_987Z-debug-0.log

Expected behavior

NPM install to work with the linux-arm64 prebuilds

Regardless, it’s important for falling back to compiling from scratch with node-gyp to continue to work.

USearch version

2.10.x

Operating System

Amazon Linux 2023

Hardware architecture

Arm

Which interface are you using?

Other bindings

Contact Details

Ping me in Discord

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jlarmstrongiv jlarmstrongiv added the bug Something isn't working label Apr 1, 2024
@ashvardanian
Copy link
Contributor

That's good to know! Another related issue I am solving is the lack of Doxygen support for TypeScript. Maybe we should provide both binding.gyp and prebuilt, as well as TypeScript + JavaScript?

@sroussey
Copy link
Contributor

sroussey commented Apr 2, 2024

I guess I was overzealous on files[] part of the package.json. Will fix.

@sroussey
Copy link
Contributor

sroussey commented Apr 2, 2024

It is odd since there should be a pre-built binary for linux-arm64

https://www.npmjs.com/package/usearch?activeTab=code

image

@sroussey
Copy link
Contributor

sroussey commented Apr 2, 2024

I did cross compile it so maybe i did something wrong

@sroussey
Copy link
Contributor

sroussey commented Apr 2, 2024

Oh, they are the same size, so definitely not right.

@sroussey
Copy link
Contributor

sroussey commented Apr 2, 2024

See #379

@ashvardanian
Copy link
Contributor

🎉 This issue has been resolved in version 2.10.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@jlarmstrongiv
Copy link
Contributor Author

I will try it as soon as 2.10.4 is released on npm 😄

@ashvardanian
Copy link
Contributor

ashvardanian commented Apr 2, 2024

@jlarmstrongiv, sadly, the build fails. @sroussey, would you be able to double-check the cross-compilation commands? I am also looking to extend cross-compilation in Rust as well (for #378).

@sroussey
Copy link
Contributor

sroussey commented Apr 2, 2024

I will try it as soon as 2.10.4 is released on npm 😄

Try npm install @sroussey/usearch

as a test.

@jlarmstrongiv
Copy link
Contributor Author

bash-5.2# npm install @sroussey/usearch

added 5 packages, and audited 6 packages in 6s

found 0 vulnerabilities

The install passed! Haven’t tried running sample code yet though

@sroussey
Copy link
Contributor

sroussey commented Apr 2, 2024

@jlarmstrongiv, sadly, the build fails. @sroussey, would you be able to double-check the cross-compilation commands? I am also looking to extend cross-compilation in Rust as well (for #378).

Might remove the cross compile for now while I do more investigation.

@ashvardanian
Copy link
Contributor

How is it going, @sroussey? How should I change the CI for builds to pass?

@sroussey
Copy link
Contributor

sroussey commented Apr 3, 2024

I’m home a bit today, so I’ll comment out that section until I have a working version.

@sroussey
Copy link
Contributor

sroussey commented Apr 3, 2024

See c6fb875

It has what i think is the fix, but I am not setup to test it.

So farther down I have it skip the cross compiling.

@sroussey
Copy link
Contributor

sroussey commented Apr 3, 2024

I have a docker setup on x86_64 but I can't get it to compile normally, so I can't test cross compiling.

image

@ashvardanian Have any idea how i set things up wrong?

@sroussey
Copy link
Contributor

sroussey commented Apr 3, 2024

image

@sroussey
Copy link
Contributor

sroussey commented Apr 3, 2024

root@6a1e9ab171d0:/usr/usearch# uname -a 
Linux 6a1e9ab171d0 6.4.16-linuxkit #1 SMP PREEMPT Thu Nov 16 10:49:20 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
apt install -y cmake build-essential libjemalloc-dev libomp-dev gcc-12 g++-12 
apt install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-aarch64-linux-gnu
root@6a1e9ab171d0:/usr/usearch# git submodule
 0a92994d729ff76a58f692d3028ca1b64b145d91 fp16 (heads/master)
 127ead1da7c39957b30a50dd85e74814edb022d6 simsimd (v4.2.2)
 c2848c1ba777c541af2903501f3d6344d711638b stringzilla (v3.7.0)

@sroussey
Copy link
Contributor

sroussey commented Apr 3, 2024

Works fine on MacOS though.

@ashvardanian
Copy link
Contributor

The _ph suffixes are for half-precision. GCC 12 must support it. You download it, but seems like you are not using it, @sroussey 🤷

@sroussey
Copy link
Contributor

sroussey commented Apr 3, 2024

update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 60 --slave /usr/bin/g++ g++ /usr/bin/g++-12 fixed it, thanks.

@sroussey
Copy link
Contributor

sroussey commented Apr 3, 2024

cross compile says it goes fine, but it doesn't contain a build

image

@sroussey
Copy link
Contributor

sroussey commented Apr 3, 2024

Oh, it did build it:

root@6a1e9ab171d0:/usr/usearch# file build/Release/obj.target/usearch.node
build/Release/obj.target/usearch.node: ELF 64-bit LSB shared object, ARM aarch64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=c0650f24bd82a89cca3a4a773455913f2477a789, not stripped

It just didn't get moved over. I wonder if a strip issue.

@sroussey
Copy link
Contributor

sroussey commented Apr 3, 2024

Indeed, something went wrong with strip. Manually works though. I can work around this...

@sroussey
Copy link
Contributor

sroussey commented Apr 3, 2024

See #383

@ashvardanian
Copy link
Contributor

@jlarmstrongiv is the issue resolved now?

@jlarmstrongiv
Copy link
Contributor Author

Hmm, I get errors that:

Error: src/usearch.ts(11,5): error TS2322: Type '"cos"' is not assignable to type 'MetricKind'.
Error: src/usearch.ts(13,5): error TS2322: Type '"f32"' is not assignable to type 'ScalarKind'.

Did the types change?

@sroussey
Copy link
Contributor

sroussey commented Apr 12, 2024

BTW: ncc uses webpack-asset-relocator-loader.

So, some such around here:
https://github.com/vercel/webpack-asset-relocator-loader/blob/bda4108a3aeb672fe42da85650349ded73fba6e1/src/asset-relocator.js#L207-L215

and https://github.com/vercel/webpack-asset-relocator-loader/blob/bda4108a3aeb672fe42da85650349ded73fba6e1/src/asset-relocator.js#L907-L952

My thinking at the moment is that I don't use the prebuildify library, but instead create my own. Instead of using variables to figure out the path, I will switch on them and have hard coded paths that the code scanner will find. I think this will work across build tools.

I don't think it will be hard, but it will have to wait until tomorrow.

@sroussey
Copy link
Contributor

BTW: have you tried this?

npx --yes @vercel/ncc build test.js -o ncc-usearch-bundled --debug --external usearch
cd ncc-usearch-bundled
npm init -y
npm i usearch

That should work. At least to get you through the weekend. Also you see how external works and helps in tricky situations.

@jlarmstrongiv
Copy link
Contributor Author

I asked them what I can do on my side. I don't expect them to write any code, and would likely take too long anyhow.

My apologies. I’m sorry I didn’t fully read the linked issue. You’re entirely right.

My thinking at the moment is that I don't use the prebuildify library, but instead create my own. Instead of using variables to figure out the path, I will switch on them and have hard coded paths that the code scanner will find. I think this will work across build tools.

That should work. If the paths can be analyzed, they can be bundled.

In previous js bundlers, a partial dynamic syntax was supported, but esbuild, vite, and others have not implemented it evanw/esbuild#700 so I think your method is best.

If I do find a folder and require combo that works, we may have to rename all the .node files since they all have the same name. Then I can collapse the folder structure. Github actions doesn't like that though. It likes assets to have their own folder. Maybe I can add another step after the builds are done but before the packaging.

I’ve done the same thing where I add another build step to move the assets before the publishing. It’s good to do if needed.

BTW: have you tried this?

I like your code examples! (especially the last one with --external flag) But, the main package I’m trying to bundle is usearch. I’ve already excluded it from the build, and I just need to bundle the package together into a single js + single .node file.

@sroussey
Copy link
Contributor

So, if I add this dummy code, it will work in ncc. But unfortunately, not esbuild:

if (process.uptime() < 0) {
    require(__dirname + "/../../../prebuilds/darwin-arm64+x64/usearch.node");
    require(__dirname + "/../../../prebuilds/linux-arm64/usearch.node");
    require(__dirname + "/../../../prebuilds/linux-x64/usearch.node");
    require(__dirname + "/../../../prebuilds/win32-ia32/usearch.node");
    require(__dirname + "/../../../prebuilds/win32-x64/usearch.node");
}

@sroussey
Copy link
Contributor

sroussey commented Apr 14, 2024

and maybe something like

require(__dirname + "/../../../build/Release/usearch.node");

in case people did their own build.

@sroussey
Copy link
Contributor

Sadly

require(__dirname + `/../../../build/${os.platform}-${os.arch}/usearch.node`);

did not work.

@sroussey
Copy link
Contributor

BTW: did you try just copying over the prebuilds folder in your adventures?

@sroussey
Copy link
Contributor

#397

@sroussey
Copy link
Contributor

cosmetic changes

Maybe a red herring? It uses windows-latest so maybe that changed instead?

@ashvardanian -- I did a force push of the last commit had a good windows build.

Both of these are the same commit:

https://github.com/unum-cloud/usearch/actions/runs/8625104966/job/23641178068

https://github.com/sroussey/usearch/actions/runs/8681208236/job/23803506624

This is a good reason to pin your dependencies and not use -latest etc.

@ashvardanian
Copy link
Contributor

@sroussey I am not sure I understand correctly.
The diff between our versions is ubuntu-latest vs ubuntu-22.04.
But in our case only the Windows runner is failing, Ubuntu is fine.
Moreover, ubuntu-latest and ubuntu-22.04 should map to the same config.

ashvardanian added a commit that referenced this issue Apr 15, 2024
ashvardanian pushed a commit that referenced this issue Apr 15, 2024
## [2.11.7](v2.11.6...v2.11.7) (2024-04-15)

### Docs

* Mention checkbox in issue request ([3a33d9d](3a33d9d))

### Make

* Formatting Swift ([4af6d2d](4af6d2d))
* Revert CI version ([28520e5](28520e5)), closes [#377](#377)
* Upgrade deps & list extensions ([04b39ed](04b39ed))
@jlarmstrongiv
Copy link
Contributor Author

jlarmstrongiv commented Apr 15, 2024

and maybe something like require(__dirname + "/../../../build/Release/usearch.node"); in case people did their own build.

That’s smart

Sadly require(__dirname + /../../../build/${os.platform}-${os.arch}/usearch.node);` did not work.

Still waiting to support variables in dynamic imports for esbuild evanw/esbuild#700

Would using relative paths allow esbuild to bundle correctly?

BTW: did you try just copying over the prebuilds folder in your adventures?

I try to let the bundlers do that, because I’ve had problems with other libraries where the paths change due to bundling and it’s better just to let them handle it.

@sroussey
Copy link
Contributor

But in our case only the Windows runner is failing, Ubuntu is fine.

My guess is that they changed something in the windows runner.

@sroussey
Copy link
Contributor

sroussey commented Apr 15, 2024

I try to let the bundlers do that, because I’ve had problems with other libraries where the paths change due to bundling and it’s better just to let them handle it.

Yeah, looks like ncc will change it to be relative to the combined js file. So the copy of the prebuilds folder is adjacent to the index.js file (which just happens to be where we expect it to be).

ashvardanian added a commit that referenced this issue Apr 29, 2024
Relates to the #377 and the comment:
#377 (comment)

This temporarily disables the failing CI pipeline to generate
and update docs.
@ashvardanian
Copy link
Contributor

Seems like you are right, all of our Windows prebuild pipelines fail across repos. @sroussey whats the downside of disabling prebuild pipeline?

@sroussey
Copy link
Contributor

sroussey commented May 3, 2024

You could disable for windows which should cause everyone to rebuild on their machine on that platform.

If they don't allow lifecycle scripts it will fail, same with bun, etc. They will need to make changes to accommodate.

I'm not a big windows build expert but I'll have another look this weekend. I'm curious if other people are having windows build issues on GitHub actions in 2024. What was the date it started failing? Might be a clue.

@ashvardanian
Copy link
Contributor

@sroussey started failing about a month ago, same in SimSIMD. Thank you!

ashvardanian added a commit to ashvardanian/SimSIMD that referenced this issue May 5, 2024
Relates to unum-cloud/usearch#377

This temporarily disables the failing CI pipeline
to generate and update docs.
@jlarmstrongiv
Copy link
Contributor Author

jlarmstrongiv commented Jun 7, 2024

Did the paths to the output binaries change? It seems the require added for the bundler no longer work

@ashvardanian
Copy link
Contributor

Are you using main or main-dev?

@jlarmstrongiv
Copy link
Contributor Author

I’m using the latest npm package 2.11.1. I will investigate further

@jlarmstrongiv
Copy link
Contributor Author

jlarmstrongiv commented Jun 7, 2024

I tried uploading all usearch.node prebuilds, and I get invalid ELF header, which means it’s not selecting the right binary either

@ashvardanian
Copy link
Contributor

Using TypeScript and prebuilt binaries was a mistake IMHO. It’s an extremely complicated pipeline. I have absolutely no clue about how it works. Would it be better if we switch back to pure JS and let everyone build locally from sources? Our build time should be pretty low.

@sroussey
Copy link
Contributor

sroussey commented Jun 7, 2024 via email

@jlarmstrongiv
Copy link
Contributor Author

jlarmstrongiv commented Jun 7, 2024

I tried switching from arm64 to x86_64 and it did pick the right binary that time, so I’m not sure why it isn’t selecting arm64

I usually have a good experience with prebuilds, and they definitely save time with npm install and heartache dealing with all those SIMSIMD_TARGET environment variables.

I’d love for prebuilds + usearch to work together. Is it possible to have an escape hatch for users to select the path to the prebuilt usearch.node file? Would that be the best of both worlds?

Here’s an example of that option from better-sqlite3:

`options.nativeBinding`: if you're using a complicated build system 
that moves, transforms, or concatenates your JS files, 
better-sqlite3 might have trouble locating its native C++ addon (`better_sqlite3.node`). 
If you get an error that looks like [#534](https://github.com/JoshuaWise/better-sqlite3/issues/534#issuecomment-757907190), 
you can solve it by using this option to provide the file path of `better_sqlite3.node` 
(relative to the current working directory).

It’s also very common for wasm libraries to offer that option as well.

It would also allow me to select the right arm64 architecture and allow us to ignore bundling altogether.

I just feel like @sroussey put a lot of effort into the high value feature of prebuilds, and it’d be a shame to remove it when it’s so close. Adding this escape hatch will mean that the current code will work in many cases, and advanced cases will always have a workaround to get their binary.

@sroussey
Copy link
Contributor

sroussey commented Jun 8, 2024

You can always just build, it is not automatic if it thinks it has a prebuild though.

Tests on builds don't catch anything wrong since this is a cross-build as Github doesn't have arm64 for actions. Otherwise it should get caught.

@sroussey
Copy link
Contributor

sroussey commented Jun 8, 2024

I am packing my life into boxes at the moment, but I should be in a hotel next week and able to use more than an ipad... i will check on things then.

BTW: you can do something hacky... like (npm install && cd node_modules/usearch && npm run prebuild-arm64)

ashvardanian added a commit that referenced this issue Aug 6, 2024
* Improve: Swift test for issue #399 (#400)

* Fix: Integer overflow in aligned-alloc

Fixes ClickHouse/ClickHouse#61780

Co-authored-by: Antonio Andelic <antonio2368@users.noreply.github.com>

* Make: Disable Windows NPM builds

Relates to the #377 and the comment:
#377 (comment)

This temporarily disables the failing CI pipeline to generate
and update docs.

* Fix: Going beyond level 0 in clustering

* Improve: Error handling in `index_dense_gt`

This commit drops `std::vector` dependency,
making compilation time shorter and error
handling universal across abstraction layers.

* Improve: Remove `std::function` calls

* Improve: Remove `std::thread` from `index_dense_gt`

* Improve: `std::vector` -> `buffer_gt` in plugins

* Add: `usearch_change_threads_search`

* Fix: `index_dense_t::make(path)`

* Fix: Exhastive Search

In the past, if we got "too lucky" traversing the graph,
we could exit early before accumulating K top matches,
even if the index had more than K entries. This patch
changes that behavior, making output more predicatable.

* Fix: Replacement leaves isolated nodes

This patch addresses the issue #399, originally
observed in the Swift layer. Reimplementing it in
C++ helped locate the issue and lead to refactoring
the `update` procedure in the lowest-layer `index_gt`.

Now, `add` and `update` share less code. The `add`
is one branch shorter (not that it would be noticeable),
and `update` brings additional logic to avoid spilling
`updated_slot` into top-results and consequently
introducing self-loops.

Closes #399

* Fix: Misc warnings & compilation issues

* Fix: Misc warnings & compilation issues

* Fix: Detect `ring_gt` being full

Relates to #355

* Fix: Re-init `available_threads_` after load

Both `view` and `load` would `reset` the thread contexts.
After that, the very first `search` and `add` would fail, as
no thread-local contexts are initialized. It would require
a `reserve` call with a non-zero second arcgument to
define the number of concurrent threads, for which the
queues & buffers need to be allocated.

That design is counter-intuitive, so this patch re-inits the
same number of threads as before the `load` & `view` or
one, if none existed.

* Fix: `uint32_t` to `uint40_t` cast (#404)

Co-authored-by: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>

* Docs: Mention `b1` in `README.md`

Co-authored-by: Adolfo Garcia <1250775+adolfogc@users.noreply.github.com>

* Docs: Cover new users

* Improve: Updates stability & catch bug

* Fix: Dereferencing `member_iterator_t`

* Add: Java `get` API (#407)

* Fix: Compilation with `uint40_t` keys

* Add: `AutoClosable` using `c_destroy` for Java (#408)

* Fix: Rare deadlock on tiny collections

* Improve: `enable_key_lookups=false` memory usage

As noted by Robert Schulze, we can avoid populating `slot_lookup_`
during insertions, if `enable_key_lookups` is not set. This would lead
to lower memory consumption for large indexes of tiny vectors,
particularly common in GIS.

Co-authored-by: Robert Schulze <robert@clickhouse.com>

* Fix: Preset `enable_key_lookups=true` in C

* Fix: `std::is_pod` deprecated in C++20

* Fix: Unused type aliases

* Improve: Avoid `#pragma region` pre GCC 13 (#386)

* Do not use #pragma region if not supported by the compiler
* `pragma region` supported by GCC 13+

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85487

---------

Co-authored-by: Mikhail Bautin <mbautin@users.noreply.github.com>
Co-authored-by: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>

* Fix: Capacity checks in C# tests

* Docs: Add doc-strings in C#

* Make: Verbose C# logging in debug builds

* Docs: Describe serialization in GoLang

* Make: Drop Java & JS API references

Compiling and introspecting docstrings in Sphinx
is extremely flaky. It's safer to simply describe the
usage patterns in the `README.md`.

* Add: Load from path in Java (#410)

* Improve: Avoid sorting on small "refines"

* Docs: Cover JIT-compiled Python examples

* Fix: `index.copy()` trying to `memcpy(*, NULL, *)`

* Docs: UB in C++ Example (#415)

Co-authored-by: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>

* Improve: Catch UB with tests

* Docs: Rearrange

* Fix: Reserving contexts post-reload

* Improve: Detect more failures in tests

* Improve: Log failing lines

* Fix: Clamp before down-casting to `i8_t` (#422)

Previously we were down-casting floats to the target type (e.g. int8_t), and then
clamping to [-100, 100] range. This means that e.g. 129 would be cast to -127 and
then converted to -100, in stead of becoming 100

The fix does clamping first, and then casts the resulting number
(which is guaranteed to be in range [-100, 100], due to clamping)
from source type to target int8_t. Given the clamping, this will never overflow.

---------

Co-authored-by: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>

* Fix: Concurrency bug in high-K search

When calling `index_dense_gt`, the thread lock was not propagating
with the `search_result_t`. That is a an error-prone API. When too many
threads are running in parallel (ideally, more than physical CPU cores)
another thread may start reusing the `context_t` before the original
caller finishes exporting entries with `dump_to`.

This solution is backwards compatible and passes the tests.

* Make: Manually bump version to 2.13.0

We can't yet rely on the SemVer tool
semantic-release/release-notes-generator#633 (comment)

* Improve: Attempt to implement batch-metrics

* Add: Batch-capable metrics

* Add: `misaligned_ptr_gt` comparators

* Improve: Separate `error_t` constructors

This makes debugging easier, as it's simpler to trace
where the error message is being set.

* Improve: Support `enum` slots

Tracing implicit conversions of `std::uint32_t` and other
primitive types isn't always easy in concurrent apps. This
commit adds support for `enum` types to be used for
safer implementation of `index_gt` specializations.

* Improve: Ranges-V3 compatibility

* Add: Preliminary support for batch metrics

* Add: Batch-parallel refinements

* Add: `MANIFEST.in` for `py.typed` (#425)

Adding type annotation for Python native modules
solves the `Skipping analyzing "usearch.index" module` 
warning due to `missing library stubs or py.typed marker`.

Closes #424

* Fix: Clear cast buffer before bitwise ORs for `b1x8_t` (#428)

When converting floating point arrays to binary, we use bitwise OR
operations to set the relevant bits in the output buffer to 1. We do
nothing if the bit is zero, so we assume that the bit is zero to start
with. The `memset` statement makes sure this assumption holds.

* Fix: `esm` duplicate import bug in `jest` (#420)

Closes #418
Closes #426

* Fix: build.gradle deprecations

* Fix: ESM build support (#433)

Closes #426
Relates to #420

* Fix: `capacity()` assertion in Rust (#436)

Closes #432

* Fix: Computing `stats(i).max_edges`

* Add: Returning `computed_distances_in_refines`

In high-connectivity graphs, the number of distance
computations can be dominated by the number of "refine"
heuristic computations performed by the core structure.
The extended `add_result_t` now includes both:

- `computed_distances_in_refines`
- `computed_distances_in_reverse_refines`

This commit also extends the documentation.

* Add: Profiling attributes for `index_gt`

* Fix: Preserve thread limits after `fork()`

* Improve: Benchmarks self-recall support and `.bbin`

This patch adds support for partial datasets, without
ground truth neighborhood data. It also adds support
for `.bbin` binary, `.hbin` half-precision, and `.dbin`
double-precision input vector files/

* Fix: Printing progress between exit

* Docs: Fix spelling

* Fix: Wolfram bindings (#437)

Co-authored-by: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>

* Fix: Pre-reserve enough threads for C users

This indirectly fixes the crash in C# layer

* Revert: Parallel metrics

* Fix: Updating the `entry_slot_` node

* Improve: Enable single-threaded update tests

* Make: Bump version

* Fix: `flat_hash_multi_set_gt::reset` double-free

* Fix: Not enough memory in `fork()`

* Make: Bump to SimSIMD v5

* Fix: Missing SimSIMD v5 capability names

* Improve: Detecting copy & move issues

* Fix: Compilation w. explicit `template class`

* Improve: Bypass UBSan NULL dereferencing warning

* Improve: Minimize alignment issues

* Make: Disable `bf16` on MacOS

* Make: Link to GitHub repo

* Fix: Conditional `call_key` compilation in MSVC

* Fix: Unary minus on unsigned distances

* Make: Disable `bf16` in JS

* Fix: Compatibility with pre-v2.10

Closes #423

* Improve: Test wrong number of dimensions in Rust (#413)

Closes #412

---------

Co-authored-by: Julius Brummack <juliusbrummack@icloud.com>

* Fix: Handle wrong dimensionality in Rust

* Fix: Overwriting `SIMSIMD_DYNAMIC_DISPATCH`

* Make: Upgrade Java version

* Fix: Spelling mistakes

* Fix: `sprintf` deprecated

* Fix: `-Wpass-failed=transform-warning`

* Fix: Memory pinning on `Add` in C#

* Make: Specify Java distribution

* Fix: Pin memory in gets (C#)

* Make: Skip `PersistAndRestore` in CI on MacOS

* Make: Upgrade Docker action

This fixes a GitHub CI warning about the
deprecated NodeJS version.

* Fix: `view_from_buffer` is unsafe in Rust

Closes #453

Co-authored-by: Andrew Dirksen <2702854+bddap@users.noreply.github.com>"

* Fix: `view_from_buffer` is unsafe in Rust

Closes #453

Co-authored-by: Andrew Dirksen <2702854+bddap@users.noreply.github.com>

* Make: Upgrade SimSIMD

* Docs: Index header has no capacity

The lack of capacity data is intended.
Reserving memory is a non-persistent operation
by nature, and we shouldn't save that metadata
on the disk.

Closes #452

Co-authored-by: Christopher Yim <4638193+GoodKnight@users.noreply.github.com>

* Fix: Aggressive neighborhood checks on updates

* Fix: `update()` bug detect with non-POD keys

This bug was tough to spot. Apple Clang was the only one
that caught it. The `-O0` flags were explicitly added to expose
more symbols for debugging. More `uint40_t` tests were added.

* Fix: Align vector type w index in C# (#456)

Co-authored-by: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>

* Make: Versioning in pre-release CI

* Make: Switch from SemanticRelease to TinySemVer

---------

Co-authored-by: Jaysen Marais <jaysen.marais@gmail.com>
Co-authored-by: Antonio Andelic <antonio2368@users.noreply.github.com>
Co-authored-by: Narek Galstyan <narekg@berkeley.edu>
Co-authored-by: Adolfo Garcia <1250775+adolfogc@users.noreply.github.com>
Co-authored-by: Trevor McCulloch <mccullocht@gmail.com>
Co-authored-by: Robert Schulze <robert@clickhouse.com>
Co-authored-by: Mikhail Bautin <552936+mbautin@users.noreply.github.com>
Co-authored-by: Mikhail Bautin <mbautin@users.noreply.github.com>
Co-authored-by: SheldonFung <88470100+SheldonFung98@users.noreply.github.com>
Co-authored-by: James Braza <jamesbraza@gmail.com>
Co-authored-by: cinchen <eryue0220@gmail.com>
Co-authored-by: Mark Reed <markreed99@gmail.com>
Co-authored-by: John <jjmace01@gmail.com>
Co-authored-by: batracos <giulio.a@gmail.com>
Co-authored-by: Ziyang Hu <2103823+zh217@users.noreply.github.com>
Co-authored-by: Julius Brummack <133630819+jbrummack@users.noreply.github.com>
Co-authored-by: Julius Brummack <juliusbrummack@icloud.com>
Co-authored-by: Andrew Dirksen <2702854+bddap@users.noreply.github.com>
Co-authored-by: Christopher Yim <4638193+GoodKnight@users.noreply.github.com>
Co-authored-by: Britt <brittlewis12@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

3 participants