ngscopeclient / scopehal-apps

ngscopeclient and other client applications for libscopehal.
https://www.ngscopeclient.org/
BSD 3-Clause "New" or "Revised" License
535 stars 83 forks source link

macOS: ngscopeclient tries to dlopen all of /opt/homebrew #623

Open rgov opened 8 months ago

rgov commented 8 months ago

On macOS 14.0, I built ngscopeclient 6056adc479ba2a80531e1b535b7b7052c2a8a153 and got it running with the workarounds covered in other issues plus the environment variables from https://github.com/ngscopeclient/scopehal-docs/pull/58.

When starting up, I get several complaints from Tensorflow, then the program aborts.

2023-10-29 14:14:13.425505: W tensorflow/core/common_runtime/input_colocation_exemption_registry.cc:33] Input colocation exemption for op: IdentityN already registered
2023-10-29 14:14:13.430134: E tensorflow/tsl/lib/monitoring/collection_registry.cc:81] Cannot register 2 metrics with the same name: /tensorflow/serving/batching/enable_large_batch_splitting
2023-10-29 14:14:13.433836: E tensorflow/tsl/lib/monitoring/collection_registry.cc:81] Cannot register 2 metrics with the same name: /tensorflow/api/op/using_fake_quantization
2023-10-29 14:14:13.442854: F tensorflow/core/framework/function.cc:2027] Check failed: GetOpGradFactory()->insert({op, func}).second Duplicated gradient for Softmax
zsh: abort      ngscopeclient

... are you using Tensorflow?

rgov commented 8 months ago

No, it looks like somehow it is loading ... every single binary in /opt/homebrew. Impressive.

Is there a plugin auto discovery and loading mechanism perhaps?

azonenberg commented 8 months ago

I think what might be happening is something funky happening with the plugin loading code, where it thinks /opt/homebrew is the plugin search directory so it's trying to dlopen() everything there?

Like I said, system wide installation on macos has never been tested.

azonenberg commented 8 months ago
rgov commented 8 months ago

Could you point me to the plugin loading code and what the install paths look like on Linux?

azonenberg commented 8 months ago

It looks like we have a workaround for this exact issue but /opt/homebrew isn't included.

https://github.com/ngscopeclient/scopehal/blob/master/scopehal/scopehal.cpp?ts=4#L299

rgov commented 8 months ago

https://github.com/ngscopeclient/scopehal-apps/issues/393

Workaround:

    # Patch plugin enumeration code to fix #393, #623
    inreplace "lib/scopehal/scopehal.cpp",
      'if(binDir.find("/usr") != 0)',
      "if(binDir.find(\"#{HOMEBREW_PREFIX}\") != 0)"