zeek / broker

Zeek's Messaging Library
https://docs.zeek.org/projects/broker
Other
65 stars 28 forks source link

Python bindings build warning "dynamic_lookup may not work with chained fixups" on MacOS #280

Open ckreibich opened 2 years ago

ckreibich commented 2 years ago

@vpax writes on Slack:

For a fresh checkout of master under MacOS Monterey, when building I get a warning:

Linking CXX shared module auxil/broker/python/broker/_broker.so ld: warning: -undefined dynamic_lookup may not work with chained fixups

Presumably this is harmless, but thought I should flag it

A few other projects have hit this:

This suggests the fix might be easy: https://issues.guix.gnu.org/issue/57849#4

Since Broker's test cases cover this and we cover MacOS in CI, I'm thinking this doesn't affect use of the bindings in practice.

Neverlord commented 2 years ago

Thanks for the ticket.

This suggests the fix might be easy: https://issues.guix.gnu.org/issue/57849#4

Seems like it isn't that easy. From the same thread:

-bundle_loader requires -bundle. Ld gives an error if -bundle_loader is used without -bundle. A "bundle" in Mach-O, which is what MacOS is using instead of ELF, say, is something different than a shared library.

We don't build bundle targets in Broker. Adding the flag to our shared library target does indeed fail:

clang: error: invalid argument '-bundle_loader -compatibility_version' not allowed with '-dynamiclib'

After a bit of digging, we actually don't set -undefined dynamic_lookup anywhere. The only match seems to be in pybind11: https://github.com/pybind/pybind11/blob/master/tools/pybind11Common.cmake#L78. So we probably can't fix that on our end and I'm not sure how a fix would look like for sending a PR.

There's one more match, though: https://github.com/zeek/cmake/blob/master/ZeekPluginDynamic.cmake#L225. Are Zeek plugins raising the same warning?

CsBigDataHub commented 1 year ago

FYI.. https://issues.guix.gnu.org/issue/57849

Looks like using -Wl,-w will help.