node-rdkafka icon indicating copy to clipboard operation
node-rdkafka copied to clipboard

Cannot find ZSTD library on Mac M1 machine

Open Sumu-Ning opened this issue 2 years ago • 3 comments

Environment Information

  • OS [Mac 13.6.2]:
  • Node Version [18.19.0]:
  • NPM Version [10.2.3]:
  • C++ Toolchain [e.g. Visual Studio, llvm, g++]:
  • node-rdkafka version [2.13.0]:

Steps to Reproduce Initialize Kafka producer using zstd codec

    const producer = new Producer({
        'compression.codec': 'zstd',
        ...
    });

Running the Node js application, and got the following error

[server] ERROR 2023-12-07T05:02:58.908Z [src/index.ts] App has failed to startError: Unsupported value "zstd" for configuration property "compression.codec": libzstd not available at build time
[server] Error: Unsupported value "zstd" for configuration property "compression.codec": libzstd not available at build time

node-rdkafka Configuration Settings No customization

Additional context

  • ZSTD installed on my machine using homebrew, and zstd library and include can be found at /opt/homebrew/lib and /opt/homebrew/include, respectively
  • I tried to rebuild RD kafka using npm rebuild node-rdkafka, but it does not help

Sumu-Ning avatar Dec 07 '23 05:12 Sumu-Ning

For me this works:

CPPFLAGS="-I/usr/local/opt/zstd/include" LDFLAGS='-L/usr/local/opt/zstd/lib' npm rebuild node-rdkafka

the paths in my env are different, you might want to adjust accordingly, If these directories /opt/homebrew/lib/zstd and /opt/homebrew/include/zstd exist in your system. try

CPPFLAGS="-I/opt/homebrew/include/zstd" LDFLAGS='-L/opt/homebrew/lib/zstd' npm rebuild node-rdkafka

midnightcodr avatar Mar 14 '24 18:03 midnightcodr