Anyone experienced in compiling and testing on Mac...
# fluent-bit
s
Anyone experienced in compiling and testing on Mac with M2 (macos apple silicone)? I'm running this
cd build && cmake .. -DFLB_TESTS_RUNTIME=On && make
and getting lib_crypto issues:
Copy code
Undefined symbols for architecture arm64:
  "_EVP_MD_size", referenced from:
      _flb_hmac_init in flb_hmac.c.o
      _flb_hash_init in flb_hash.c.o
  "_EVP_PKEY_size", referenced from:
      _flb_crypto_init in flb_crypto.c.o
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libfluent-bit.dylib] Error 1
make[1]: *** [src/CMakeFiles/fluent-bit-shared.dir/all] Error 2
make: *** [all] Error 2
p
There's the CI jobs you can look at
We also build the unit tests for macOS too
The docs also should cover how to do it: https://docs.fluentbit.io/manual/installation/downloads/macos If there is anything missing/wrong then please send a PR to help others.
s
I did installed using homebrew:
Copy code
brew --prefix openssl                            
/opt/homebrew/opt/openssl@3
Unfortunately that didn't help. probably have some other conflicting packages installed... just not sure which one or what, cursor and claude did not help 😞 guess I'll use other linux server...
p
are you setting the OPENSSL_ROOT variable to the actual brew directory?
you can get cmake/make to print out the actual lines it is using btw
s
Copy code
brew install git cmake openssl bison libyaml
export OPENSSL_ROOT_DIR=`brew --prefix openssl`
export PATH=`brew --prefix bison`/bin:$PATH\n
cd build
cmake .. -DFLB_TESTS_RUNTIME=On
make -j10
p
so you're not explicitly setting it 🙂
Did you check the CI workflows which build macOS fine? https://github.com/fluent/fluent-bit/blob/73d20d09565ff5a056a5b6430d34bffc80bffb03/.github/workflows/call-build-macos.yaml#L103
Copy code
-DOPENSSL_ROOT_DIR=$(brew --prefix openssl)
s
I tried that before but lets try again with verbose makefile
p
yeah it'll probably be using the wrong headers or something
s
well it does mention in the failing output:
Copy code
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
_nats.a  ../../library/libflb-plugin-out_nrlogs.a ...(bunch of ../../library/*.a)... /opt/homebrew/opt/openssl@3/lib/libcrypto.dylib /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libz.tbd /opt/homebrew/lib/libzstd.dylib ...
also tried to check vs openssl@1.1 (default is 3)
r
did you clean build directory after you download openssl?
Copy code
export OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)
export LDFLAGS="-L$(brew --prefix openssl@3)/lib"
export CPPFLAGS="-I$(brew --prefix openssl@3)/include"
export PKG_CONFIG_PATH="$(brew --prefix openssl@3)/lib/pkgconfig"
you can rm the content of the build directory and run
Copy code
cmake .. -DFLB_TESTS_RUNTIME=On -DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3)
p
you can also check your cmake output against the last official build as well to see if any obvious issues there: https://github.com/fluent/fluent-bit/actions/runs/19280396810/job/55130063318
s
✅ I managed to solve it with a friend. What I did is replacing these variables: 1. `./src/flb_crypto.c`:
EVP_PKEY_size
->
EVP_PKEY_get_size
2. `./src/flb_hmac.c`:
EVP_MD_size
->
EVP_MD_get_size
and running cmake and make. The question is why it fails to pre-process it on Mac? I have another linux-os arm64 machine (nvidia Jetson) which it worked out-of-the-box
p
It fails to pre-process on "your" mac, official builds seem fine, so I'm guessing something on your specific machine. 🙂 You'll have to compare the output with the official job to see what is different.
s
yea of course
p
I would look at where those variables are being calculated and check what affects them
s
Well it eventually seems like a conflicting headers between openssl 1.1 vs 3.X. setting
-DOPENSSL_USE_STATIC_LIBS=OFF
solved it without code changes. I believe also uninstalling 1.1 from the system completely will also help. 🙌
👍 1
p
Yeah that sounds like you may just have static libs for one version or it's finding version 1 first but using version 3 headers