Giter Site home page Giter Site logo

node-metrohash's Introduction

node-metrohash

Wrapper around MetroHash.

Build Status Build status

Installation

$ npm install metrohash

API change!

Between v1 and v2, the API for this library has changed to allow for maximum hashing speed.

The biggest change is that a calculated hash is now returned as a (hex-encoded) string instead of a Buffer.

If a Buffer is still required, it's easy to convert the string:

let buffer = Buffer.from(metrohash64('input'), 'hex');

Also, the .hash() methods for the hasher classes have been removed in favor of standalone functions (see below).

Usage

The module exports 2 classes, MetroHash64 and MetroHash128, and two functions, metrohash64 and metrohash128.

The classes are meant for incremental hashing, the functions for standalone hash calculations.

The class constructors and functions accept an optional seed numerical argument, which defaults to 0.

Class interface

const MetroHash64 = require('metrohash').MetroHash64;

// Constructor.
MetroHash64(seed? : number) : this

// Update.
MetroHash64#update(input : String | Buffer) : this

// Finalize and get hash digest.
MetroHash64#digest() : String

(likewise for MetroHash128).

Function interface

const metrohash64 = require('metrohash').metrohash64;

metrohash64(input : String | Buffer, seed? : number) : String

(likewise for metrohash128).

Examples

//// Classes

const MetroHash64 = require('metrohash').MetroHash64;

// Instantiate using seed 123 (`new` is optional).
let hash = new MetroHash64(123);

// Update using a string as input.
hash.update('Hello, World!');

// The same as above:
// hash.update('Hello, ').update('World!');

// Finalize to get the digest as a hex string.
let digest = hash.digest();

//// Functions
const metrohash64 = require('metrohash').metrohash64;

let digest = metrohash64('Hello, World!', 123);

Speed

From v2.0 onwards, MetroHash is pretty fast.

node-metrohash's People

Contributors

laurence-myers avatar robertklep avatar trxcllnt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-metrohash's Issues

Installing metrohash on Windows fails at metrohash_wrapper.cpp

On my Windows 10 environment (Windows_NT 10.0.15063) install of metrohash fails during compilation with msbuild.exe:

Directory: C:\Users\{USER}\Git\{PROJECT}\runtime\node_modules\metrohash
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\\Users\\{USER}\\Git\\{PROJECT}\\runtime\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=2015',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\{USER}\\Git\\{PROJECT}\\runtime\\node_modules\\metrohash\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\{USER}\\Git\\{PROJECT}\\runtime\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\{USER}\\.node-gyp\\8.11.3\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\{USER}\\.node-gyp\\8.11.3',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\{USER}\\Git\\{PROJECT}\\runtime\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\{USER}\\.node-gyp\\8.11.3\\<(target_arch)\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\{USER}\\Git\\{PROJECT}\\runtime\\node_modules\\metrohash',
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   'C:\\Users\\{USER}\\Git\\{PROJECT}\\runtime\\node_modules\\metrohash\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  metrohash_wrapper.cpp
  metrohash128.cpp
  metrohash128crc.cpp
  metrohash64.cpp
  win_delay_load_hook.cc
..\src\metrohash_wrapper.cpp(140): error C2131: expression did not evaluate to a constant [C:\Users\{USER}\Git\{PROJECT}\runtime\node_modules\metrohash\build\metrohash.vcxproj]
  ..\src\metrohash_wrapper.cpp(140): note: a non-constant (sub-)expression was encountered
..\src\metrohash_wrapper.cpp(141): error C2131: expression did not evaluate to a constant [C:\Users\{USER}\Git\{PROJECT}\runtime\node_modules\metrohash\build\metrohash.vcxproj]
  ..\src\metrohash_wrapper.cpp(141): note: a non-constant (sub-)expression was encountered
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\{USER}\Git\{PROJECT}\runtime\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\{USER}\\Git\\{PROJECT}\\runtime\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\{USER}\Git\{PROJECT}\runtime\node_modules\metrohash
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
Process stalled

I've tried re-installing Windows Build Tools, Python, setting PATHS. Basically all that is mentioned here: https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules
But nothing seemed to change it. Any other suggestions? Glad about any directions

non-deterministic hash results

I was evaluating this library and one thing caught my eye, not sure if it's intentional or not. In short, given the same input, it appears to be relatively easy to generate inconsistent hashes. For example:

const MetroHash128 = require('metrohash').MetroHash128;

const now = Date.now();
const seen = new Set();

for (let i = 0; i < 1000000; i += 1) {
  const hash = new MetroHash128(now);

  hash.update('Hello/1.0 (World;)');

  seen.add(hash.digest());
}

console.log(seen.keys());

Produced the following output:

SetIterator {
  '7367f8e233ea5037d82d94faec311316',
  'f71ba7b069656149839479c5d1823129'
}

If this is expected, I think it might be useful to note in the docs that the hash result is not necessarily the same each run. Thanks!

Does not compile on machines without sse4.2

The latest version does not compile on our virtual machines anymore. It works with 2.3 but not with 2.4.

error /home/user/project/node_modules/metrohash: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /home/user/project/node_modules/metrohash
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python
                
gyp info spawn args [ '/home/user/project/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   '/home/user/project/node_modules/metrohash/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/user/project/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/user/.node-gyp/8.11.2/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
                
gyp info spawn args   '-Dnode_root_dir=/home/user/.node-gyp/8.11.2',
gyp info spawn args   '-Dnode_gyp_dir=/home/user/project/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/user/.node-gyp/8.11.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/user/project/node_modules/metrohash',
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 make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/home/user/project/node_modules/metrohash/build'
  CXX(target) Release/obj.target/metrohash/src/metrohash_wrapper.o
  CXX(target) Release/obj.target/metrohash/src/metrohash128.o
                
  CXX(target) Release/obj.target/metrohash/src/metrohash128crc.o
                
In file included from ../src/metrohash128crc.cpp:27:0:
/usr/lib/gcc/x86_64-linux-gnu/4.8/include/nmmintrin.h:31:3: error: #error "SSE4.2 instruction set not enabled"
 # error "SSE4.2 instruction set not enabled"
   ^
../src/metrohash128crc.cpp: In function ‘void metrohash128crc_1(const uint8_t*, uint64_t, uint32_t, uint8_t*)’:
../src/metrohash128crc.cpp:55:54: error: ‘_mm_crc32_u64’ was not declared in this scope
             v[0] ^= _mm_crc32_u64(v[0], read_u64(ptr)); ptr += 8;
                                                      ^
../src/metrohash128crc.cpp:84:50: error: ‘_mm_crc32_u64’ was not declared in this scope
         v[1] ^= _mm_crc32_u64(v[0], read_u32(ptr)); ptr += 4;
                                                  ^
../src/metrohash128crc.cpp:90:50: error: ‘_mm_crc32_u64’ was not declared in this scope
         v[0] ^= _mm_crc32_u64(v[1], read_u16(ptr)); ptr += 2;
                                                  ^
../src/metrohash128crc.cpp:96:50: error: ‘_mm_crc32_u64’ was not declared in this scope
         v[1] ^= _mm_crc32_u64(v[0], read_u8 (ptr));
                
                                                  ^
../src/metrohash128crc.cpp: In function ‘void metrohash128crc_2(const uint8_t*, uint64_t, uint32_t, uint8_t*)’:
../src/metrohash128crc.cpp:131:54: error: ‘_mm_crc32_u64’ was not declared in this scope
             v[0] ^= _mm_crc32_u64(v[0], read_u64(ptr)); ptr += 8;
                                                      ^
../src/metrohash128crc.cpp:160:50: error: ‘_mm_crc32_u64’ was not declared in this scope
         v[1] ^= _mm_crc32_u64(v[0], read_u32(ptr)); ptr += 4;
                                                  ^
../src/metrohash128crc.cpp:166:50: error: ‘_mm_crc32_u64’ was not declared in this scope
         v[0] ^= _mm_crc32_u64(v[1], read_u16(ptr)); ptr += 2;
                                                  ^
../src/metrohash128crc.cpp:172:50: error: ‘_mm_crc32_u64’ was not declared in this scope
         v[1] ^= _mm_crc32_u64(v[0], read_u8 (ptr));
                                                  ^
make: *** [Release/obj.target/metrohash/src/metrohash128crc.o] Error 1
make: Leaving directory `/home/user/project/node_modules/metrohash/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/user/project/node_modules/node-gyp/lib/build.js:258:23)
                
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
                
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.4.0-96-generic
gyp ERR! command "/home/user/project/vendor/composer/nodejs/bin/node" "/home/user/project/node_modules/metrohash/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/user/project/node_modules/metrohash
gyp ERR! node -v v8.11.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Error installing dependencies

cat /proc/cpuinfo:

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 6
model name	: QEMU Virtual CPU version 2.0.0
stepping	: 3
microcode	: 0x1
cpu MHz		: 2499.998
cache size	: 4096 KB
physical id	: 0
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 4
wp		: yes
flags		: fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm rep_good nopl pni vmx cx16 x2apic popcnt hypervisor lahf_lm abm tpr_shadow vnmi flexpriority ept vpid
bugs		:
bogomips	: 4999.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 40 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 6
model name	: QEMU Virtual CPU version 2.0.0
stepping	: 3
microcode	: 0x1
cpu MHz		: 2499.998
cache size	: 4096 KB
physical id	: 1
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 4
wp		: yes
flags		: fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm rep_good nopl pni vmx cx16 x2apic popcnt hypervisor lahf_lm abm tpr_shadow vnmi flexpriority ept vpid
bugs		:
bogomips	: 4999.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 40 bits physical, 48 bits virtual
power management:

g++ flag -march=native makes native library non-portable

We have kubernetes cluster running in the cloud, and we were caught out by "illegal instruction" crash, when a new node with older CPU arch was added to the cluster.

The library was compiled on a machine with haswell architecture, and crashed on sandybridge. Both support sse2 and after a bit of gdb and comparing assembler, it turned out that gcc on haswell would output BMI2 instructions, and sandybridge does not support those.

I would suggest to drop march from default cflags or replace it with -mtune=generic.

I have not tested mtune=generic, but dropping march resolved our crash issue.

Suggestion: Add AppVeyor test suite to check for Windows support

I am the author of asset hash where I chose metrohash as the default hashing algorithm. Right now I experience some issues in my package as it does not seem to correctly compile on appveyor. This seems to be related to Metrohash. This is the output I am currently seeing:

..\src\metrohash128crc.cpp(55): error C3861: '_mm_crc32_u64': identifier not found [C:\projects\rollup-plugin-rebase\node_modules\metrohash\build\metrohash.vcxproj]
...

Full log output: https://ci.appveyor.com/project/swernerx/rollup-plugin-rebase/build/136/job/rw5qlf48amcmb9s9

Do have any hint of fixing this? Would it be feasible for you to add appveyor testing?

A good initial appveyor.yml could be this one:

# http://www.appveyor.com/docs/appveyor-yml

clone_depth: 10

environment:
  matrix:
    - nodejs_version: 6
    - nodejs_version: 8
    - nodejs_version: 10

version: "{build}"
build: off
deploy: off

install:
  - ps: Install-Product node $env:nodejs_version
  - npm install

test_script:
  - npm test

cache:
  # global npm cache
  - '%APPDATA%\npm-cache'

Error while installing with Node 10 on Windows

I get the following output while running npm install metrohash on Windows with Node.js 10.0.0:

if not defined npm_config_node_gyp (node "C:\Users\Thomas\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\Thomas\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  metrohash_wrapper.cpp
  metrohash128.cpp
  metrohash128crc.cpp
  metrohash64.cpp
  win_delay_load_hook.cc
..\src\metrohash_wrapper.cpp(24): warning C4244: 'argument': conversion from 'double' to 'uint64_t', possible loss of data [D:\Documenten\a\node_modules\metrohash\build\metrohash.vcxproj]
  ..\src\metrohash_wrapper.cpp(20): note: while compiling class template member function 'Nan::NAN_METHOD_RETURN_TYPE NodeMetroHash<MetroHash128,16>::New(Nan::NAN_METHOD_ARGS_TYPE)'
  ..\src\metrohash_wrapper.cpp(85): note: see reference to function template instantiation 'Nan::NAN_METHOD_RETURN_TYPE NodeMetroHash<MetroHash128,16>::New(Nan::NAN_METHOD_ARGS_TYPE)' being compiled
  ..\src\metrohash_wrapper.cpp(147): note: see reference to class template instantiation 'NodeMetroHash<MetroHash128,16>' being compiled
..\src\metrohash_wrapper.cpp(31): error C2661: 'v8::Function::NewInstance': no overloaded function takes 2 arguments [D:\Documenten\a\node_modules\metrohash\build\metrohash.vcxproj]

The command does work with Node 8.11.1.

gyp build error on Windows 10

Hi, I'm getting a build error on both Node 10 LTS and 11 (latest), Windows 10 Pro.

I have Python 3.7.0 installed on my system, could the install script be conflicting with the "new" version of Python that I have installed?

I thought this might be related to #5, but the error is different if somewhat related. Should I raise this issue with node-gyp or is this related to the build script of node-metrohash?

λ npm i metrohash

> [email protected] install C:\Users\Marcus\Development\responsive-image-builder\node_modules\metrohash
> node-gyp rebuild


C:\Users\Marcus\Development\responsive-image-builder\node_modules\metrohash>if not defined npm_config_node_gyp (node "C:\Users\Marcus\AppData\Roaming\nvm\v11.12.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\Marcus\AppData\Roaming\nvm\v11.12.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\Marcus\AppData\Local\Programs\Python\Python37-32\python.EXE -c
import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:297:12)
gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:988:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Marcus\\AppData\\Roaming\\nvm\\v11.12.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Marcus\Development\responsive-image-builder\node_modules\metrohash
gyp ERR! node -v v11.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Many thanks!

NodeJS v16 compilation error: `no template named 'remove_cv_t' in namespace 'std'`

On macOS Catalina 10.15.7. Xcode CLT installed on 26/05/21 (AEDT)

gyp info spawn /usr/bin/python2
gyp info spawn args [
gyp info spawn args   '/Users/lmyers/code/foo-project/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/lmyers/code/foo-project/node_modules/metrohash/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/lmyers/code/foo-project/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/lmyers/.node-gyp/16.1.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/lmyers/.node-gyp/16.1.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/lmyers/code/foo-project/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/lmyers/.node-gyp/16.1.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/lmyers/code/foo-project/node_modules/metrohash',
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 info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/metrohash/src/metrohash_wrapper.o
In file included from ../src/metrohash_wrapper.cpp:2:
In file included from ../../nan/nan.h:56:
In file included from /Users/lmyers/.node-gyp/16.1.0/include/node/node.h:63:
In file included from /Users/lmyers/.node-gyp/16.1.0/include/node/v8.h:30:
/Users/lmyers/.node-gyp/16.1.0/include/node/v8-internal.h:452:38: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?
            !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
                                ~~~~~^~~~~~~~~~~
                                     remove_cv
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits:697:50: note: 'remove_cv' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
                                                 ^
1 error generated.
make: *** [Release/obj.target/metrohash/src/metrohash_wrapper.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2

gcc version:

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Doesn't work in a mono repo

I have moved my project to a monorepo. I cannot start my project anymore. I get the following error:

✔ success server compiled in 34s 802ms
Could not locate the bindings file. Tried:
 → /Users/me/development/projects/project/packages/server/build/metrohash.node
 → /Users/me/development/projects/project/packages/server/build/Debug/metrohash.node
 → /Users/me/development/projects/project/packages/server/build/Release/metrohash.node
 → /Users/me/development/projects/project/packages/server/out/Debug/metrohash.node
 → /Users/me/development/projects/project/packages/server/Debug/metrohash.node
 → /Users/me/development/projects/project/packages/server/out/Release/metrohash.node
 → /Users/me/development/projects/project/packages/server/Release/metrohash.node
 → /Users/me/development/projects/project/packages/server/build/default/metrohash.node
 → /Users/me/development/projects/project/packages/server/compiled/10.15.1/darwin/x64/metrohash.node
 → /Users/me/development/projects/project/packages/server/addon-build/release/install-root/metrohash.node
 → /Users/me/development/projects/project/packages/server/addon-build/debug/install-root/metrohash.node
 → /Users/me/development/projects/project/packages/server/addon-build/default/install-root/metrohash.node
 → /Users/me/development/projects/project/packages/server/lib/binding/node-v64-darwin-x64/metrohash.node
    at bindings (/Users/me/development/projects/project/packages/server/Users/me/development/projects/project/node_modules/bindings/bindings.js:126:1)
    at Object.../../node_modules/metrohash/index.js (/Users/me/development/projects/project/packages/server/build/webpack:/Users/me/development/projects/project/node_modules/metrohash/index.js:1:1)

I'm using version 2.5.1, Mac OS. I've tried removing all the node_modules directories in the project.

Library is not behave same as i used with python

This is small python code snippet:
import metrohash
uuid = b'E7A636A9-6ACC-5D83-ABD7-53B8B6DFEF3B'
h = metrohash.metrohash64(uuid)

as result i got bytes b'm\x85\xee%L1\xe2\x89

But when I used the javascript package

const metrohash64 = require('metrohash').metrohash64;
let digest = metrohash64('E7A636A9-6ACC-5D83-ABD7-53B8B6DFEF3B');
console.log(digest) // 6d85ee254c31e289
i got hex value.
Looks like we skip the step where the initial value converts to bytes, which is very important for me.

Do you know how can I get that?

Error installing on Apple M1 (Big Sur)

I'm using yarn to install packages including asset-hash, which depends on metrohash.

I constantly run in the following error:

yarn install v1.22.10
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
[-/11] ⠠ waiting...
[10/11] ⠠ metrohash
error /Users/johndoe/Projects/my-project/node_modules/metrohash: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /Users/johndoe/Projects/my-project/node_modules/metrohash
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info spawn /usr/bin/python2
gyp info spawn args [
gyp info spawn args   '/Users/johndoe/Projects/my-project/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/johndoe/Projects/my-project/node_modules/metrohash/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/johndoe/Projects/my-project/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/johndoe/.node-gyp/15.10.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/johndoe/.node-gyp/15.10.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/johndoe/Projects/my-project/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/johndoe/.node-gyp/15.10.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/johndoe/Projects/my-project/node_modules/metrohash',
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 info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
clang: warning: argument unused during compilation: '-msse4.2' [-Wunused-command-line-argument]
  CXX(target) Release/obj.target/metrohash/src/metrohash_wrapper.o
  CXX(target) Release/obj.target/metrohash/src/metrohash128.o
clang: warning: argument unused during compilation: '-msse4.2' [-Wunused-command-line-argument]
  CXX(target) Release/obj.target/metrohash/src/metrohash128crc.o
clang: warning: argument unused during compilation: '-msse4.2' [-Wunused-command-line-argument]
In file included from ../src/metrohash128crc.cpp:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/nmmintrin.h:15:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/smmintrin.h:13:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/tmmintrin.h:13:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/pmmintrin.h:13:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/emmintrin.h:13:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/xmmintrin.h:13:
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:33:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
    __builtin_ia32_emms();
    ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:33:5: note: '__builtin_isless' declared here
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:33:25: error: too few arguments to function call, expected 2, have 0
    __builtin_ia32_emms();
                        ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:67:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
           ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:129:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:159:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:189:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:216:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:239:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:260:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:287:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:310:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:331:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:352:19: error: use of undeclared identifier '__builtin_ia32_paddb'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:352:19: error: first argument of MTE builtin function must be a pointer ('__v8qi' (vector of 8 'char' values) invalid)
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^                    ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:373:19: error: use of undeclared identifier '__builtin_ia32_paddw'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:373:19: error: first argument of MTE builtin function must be a pointer ('__v4hi' (vector of 4 'short' values) invalid)
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^                    ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:394:19: error: use of undeclared identifier '__builtin_ia32_paddd'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:394:19: error: first argument of MTE builtin function must be a pointer ('__v2si' (vector of 2 'int' values) invalid)
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                  ^                    ~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/metrohash/src/metrohash128crc.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/johndoe/Projects/my-project/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (node:events:378:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 20.3.0
gyp ERR! command "/Users/johndoe/.nvm/versions/node/v15.10.0/bin/node" "/Users/johndoe/Projects/my-project/node_modules/metrohash/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/johndoe/Projects/my-project/node_modules/metrohash

I'm using

  • MacBook Pro, Apple M1
  • macOS Big Sur, 11.2.2
  • node 15.10.0
  • yarn 1.22.10

What I've tried so far

  • tried other node versions 12 and 14
  • ran xcode-select --install, removed the tool and reinstalled it
  • ran brew update and brew upgrade
  • executed the Terminal using Rosetta

See also the question on StackOverflow.

Build fails on arm64 OSX 12.6 M1

With node 18.12.1 on OSX 12.6.3 (21G419)

code/BoundriMainCode(upgrade-node♺ ) ☸ yarn add metrohash --dev
yarn add v1.22.19
warning package.json: No license field
warning No license field
[1/5] 🔍  Validating package.json...
warning No license field
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
warning " > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/plugin-transform-react-jsx > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > @bigbinary/[email protected]" has incorrect peer dependency "[email protected]".
warning " > @bigbinary/[email protected]" has incorrect peer dependency "[email protected]".
warning " > [email protected]" has incorrect peer dependency "react@^16.13.1".
warning " > @babel/[email protected]" has unmet peer dependency "@babel/core@>=7.11.0".
warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "webpack-dev-server > [email protected]" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
[5/5] 🔨  Building fresh packages...
[1/6] ⠠ fsevents
[6/6] ⠠ metrohash
[-/6] ⠠ waiting...
[-/6] ⠠ waiting...
error /Users/ayule/code/BoundriMainCode/node_modules/metrohash: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /Users/ayule/code/BoundriMainCode/node_modules/metrohash
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 3.8.13 found at "/Users/ayule/miniconda3/bin/python3"
gyp info spawn /Users/ayule/miniconda3/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/ayule/code/BoundriMainCode/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/ayule/code/BoundriMainCode/node_modules/metrohash/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ayule/code/BoundriMainCode/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ayule/Library/Caches/node-gyp/18.12.1/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/ayule/Library/Caches/node-gyp/18.12.1',
gyp info spawn args   '-Dnode_gyp_dir=/Users/ayule/code/BoundriMainCode/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/ayule/Library/Caches/node-gyp/18.12.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/ayule/code/BoundriMainCode/node_modules/metrohash',
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 info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/metrohash/src/metrohash_wrapper.o
clang: warning: argument unused during compilation: '-msse4.2' [-Wunused-command-line-argument]
  CXX(target) Release/obj.target/metrohash/src/metrohash128.o
clang: warning: argument unused during compilation: '-msse4.2' [-Wunused-command-line-argument]
  CXX(target) Release/obj.target/metrohash/src/metrohash128crc.o
clang: warning: argument unused during compilation: '-msse4.2' [-Wunused-command-line-argument]
In file included from ../src/metrohash128crc.cpp:27:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/nmmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
In file included from ../src/metrohash128crc.cpp:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/nmmintrin.h:19:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/smmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
In file included from ../src/metrohash128crc.cpp:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/nmmintrin.h:19:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/smmintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/tmmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
In file included from ../src/metrohash128crc.cpp:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/nmmintrin.h:19:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/smmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/tmmintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/pmmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
In file included from ../src/metrohash128crc.cpp:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/nmmintrin.h:19:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/smmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/tmmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/pmmintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/emmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
In file included from ../src/metrohash128crc.cpp:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/nmmintrin.h:19:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/smmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/tmmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/pmmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/emmintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/xmmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
In file included from ../src/metrohash128crc.cpp:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/nmmintrin.h:19:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/smmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/tmmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/pmmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/emmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/xmmintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:37:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
    __builtin_ia32_emms();
    ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:37:5: note: '__builtin_isless' declared here
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:37:25: error: too few arguments to function call, expected 2, have 0
    __builtin_ia32_emms();
    ~~~~~~~~~~~~~~~~~~~~^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:54:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:71:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
           ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:133:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:163:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:193:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:220:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:243:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:264:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:291:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/mmintrin.h:314:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/metrohash/src/metrohash128crc.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/ayule/code/BoundriMainCode/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/Users/ayule/.nodenv/versions/18.12.1/bin/node" "/Users/ayule/code/BoundriMainCode/node_modules/metrohash/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/ayule/code/BoundriMainCode/node_modules/metrohash

Any ideas?

v8 warning issued after require('metrohash')

After require('metrohash'), node dumps about 10 pages worth of warnings which seem to be the same thing over and over. At the core of it is a V8 warning as follows (note that metrohash functions fine nonetheless, for the time being):

==== C stack trace ===============================

1: v8::Template::Set(v8::Localv8::Name, v8::Localv8::Data, v8::PropertyAttribute)
2: NodeMetroHash<MetroHash64, 8>::Init(char const*, v8::Localv8::Object)
3: InitAll(v8::Localv8::Object)
4: node::DLOpen(v8::FunctionCallbackInfov8::Value const&)
5: v8::internal::FunctionCallbackArguments::Call(void ()(v8::FunctionCallbackInfov8::Value const&))
6: v8::internal::MaybeHandlev8::internal::Object v8::internal::(anonymous namespace)::HandleApiCallHelper(v8::internal::Isolate
, v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)1>)
7: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*)
8: 0xb96d0e092a7
9: 0xb96d0fc16c4
(node) v8::ObjectTemplate::Set() with non-primitive values is deprecated
(node) and will stop working in the next major release.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.