NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.49k stars 12.99k forks source link

Wireshark on MacOS #103944

Open DKurilo opened 3 years ago

DKurilo commented 3 years ago

I installed wireshark on MacOS with

$ nix-env -iA nixpkgs.wireshark-cli
installing 'wireshark-cli-3.4.0'

Now when I'm trying to start it from UI it's not starting UI and I need to close it with force quit. When I run it from bash with -D I see:

$ ./Wireshark -D
21:33:17.456  Capture Msg  Capture Interface List ...
21:33:17.456  Capture Dbg  sync_interface_list_open
21:33:17.460  Capture Dbg  sync_pipe_open_command
21:33:17.530  Capture Dbg  read 3 indicator: S empty value
21:33:17.531  Capture Dbg  sync_pipe_wait_for_child: wait till child closed
21:33:17.531  Capture Dbg  sync_pipe_wait_for_child: capture child closed after 0.000s
21:33:17.531  Capture Msg  Loading External Capture Interface List ...
21:33:17.532  Capture Dbg  spawn_sync: '/nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/androiddump' '--extcap-interfaces' '--extcap-version=3.4'
21:33:17.532  Capture Dbg  spawn_sync: '/nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/randpktdump' '--extcap-interfaces' '--extcap-version=3.4'
21:33:17.532  Capture Dbg  spawn_sync: '/nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/ciscodump' '--extcap-interfaces' '--extcap-version=3.4'
21:33:17.533  Capture Dbg  spawn_sync: '/nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/udpdump' '--extcap-interfaces' '--extcap-version=3.4'
21:33:17.533  Capture Dbg  spawn_sync: '/nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/sshdump' '--extcap-interfaces' '--extcap-version=3.4'
dyld: Library not loaded: libwiretap.11.dylib
  Referenced from: /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/androiddump
  Reason: image not found
21:33:17.537  Capture Dbg  /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/androiddump finished in 4.818ms
dyld: Library not loaded: libwsutil.12.dylib
  Referenced from: /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/ciscodump
  Reason: image not found
21:33:17.537  Capture Dbg  spawn_sync: '/nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/androiddump' '--extcap-interfaces'
21:33:17.537  Capture Dbg  /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/ciscodump finished in 5.022ms
dyld: Library not loaded: libwiretap.11.dylib
  Referenced from: /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/randpktdump
  Reason: image not found
21:33:17.537  Capture Dbg  spawn_sync: '/nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/ciscodump' '--extcap-interfaces'
21:33:17.537  Capture Dbg  /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/randpktdump finished in 5.508ms
dyld: Library not loaded: libwsutil.12.dylib
  Referenced from: /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/udpdump
  Reason: image not found
21:33:17.538  Capture Dbg  /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/udpdump finished in 4.393ms
21:33:17.538  Capture Dbg  spawn_sync: '/nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/udpdump' '--extcap-interfaces'
21:33:17.538  Capture Dbg  spawn_sync: '/nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/randpktdump' '--extcap-interfaces'
dyld: Library not loaded: libwsutil.12.dylib
  Referenced from: /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/sshdump
  Reason: image not found
21:33:17.538  Capture Dbg  /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/sshdump finished in 4.830ms
21:33:17.538  Capture Dbg  spawn_sync: '/nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/sshdump' '--extcap-interfaces'
dyld: Library not loaded: libwiretap.11.dylib
  Referenced from: /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/androiddump
  Reason: image not found
21:33:17.540  Capture Dbg  /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/androiddump finished in 3.607ms
dyld: Library not loaded: libwsutil.12.dylib
  Referenced from: /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/ciscodump
  Reason: image not found
21:33:17.541  Capture Dbg  /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/ciscodump finished in 3.686ms
dyld: Library not loaded: libwsutil.12.dylib
  Referenced from: /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/udpdump
  Reason: image not found
21:33:17.541  Capture Dbg  /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/udpdump finished in 3.545ms
dyld: Library not loaded: libwiretap.11.dylib
  Referenced from: /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/randpktdump
  Reason: image not found
21:33:17.541  Capture Dbg  /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/randpktdump finished in 3.507ms
dyld: Library not loaded: libwsutil.12.dylib
  Referenced from: /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/sshdump
  Reason: image not found
21:33:17.542  Capture Dbg  /nix/store/z9n7zx7m6hymivhn0k4l4n3id0l5hapc-wireshark-qt-3.4.0/Applications/Wireshark.app/Contents/MacOS/extcap/sshdump finished in 3.731ms
21:33:17.542  Capture Dbg  extcap: completed discovery of 5 tools in 10.977ms
1. en0 (Wi-Fi)
2. awdl0
3. llw0
4. utun0
5. utun1
6. en5
7. lo0 (Loopback)
8. bridge0 (Thunderbolt Bridge)
9. en1 (Thunderbolt 1)
10. en2 (Thunderbolt 2)
11. en3 (Thunderbolt 3)
12. en4 (Thunderbolt 4)
13. gif0
14. stf0
15. ap1

So looks like it can't find lib directory.

$ ls ~/.nix-profile/lib/
dia             libboost_thread.dylib       libnixstore.dylib       libwireshark.14.dylib       libwiretap.11.dylib     libwsutil.12.dylib      wireshark
libboost_context.dylib      libnixexpr.dylib        libnixutil.dylib        libwireshark.dylib      libwiretap.dylib        libwsutil.dylib
libboost_system.dylib       libnixmain.dylib        libwireshark.14.0.0.dylib   libwiretap.11.0.0.dylib     libwsutil.12.0.0.dylib      pkgconfig

MacOS version is Big Sur I'm junior nixpkgs user, so it's possible that I do something wrong. In this case can you please tell me what I need to do to make it working.

aesyondu commented 3 years ago

I have the same issue:

envinfo ``` System: OS: macOS 10.15.7 CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz Memory: 773.68 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 15.8.0 - ~/.asdf/installs/nodejs/15.8.0/bin/node npm: 7.5.1 - ~/.asdf/installs/nodejs/15.8.0/bin/npm Managers: Composer: 2.0.11 - /usr/local/bin/composer Homebrew: 3.1.3 - /usr/local/bin/brew pip3: 21.0.1 - /usr/local/bin/pip3 RubyGems: 3.1.4 - /Users/arvinsevilla/.asdf/shims/gem Utilities: Make: 3.81 - /usr/bin/make GCC: 10.15. - /usr/bin/gcc Git: 2.30.1 - /usr/local/bin/git Clang: 12.0.0 - /usr/bin/clang FFmpeg: 4.3.2 - /usr/local/bin/ffmpeg Servers: Apache: 2.4.41 - /usr/sbin/apachectl Virtualization: Docker: 20.10.5 - /usr/local/bin/docker VirtualBox: 6.1.18 - /usr/local/bin/vboxmanage IDEs: Android Studio: 4.1 AI-201.8743.12.41.7199119 Emacs: 27.2 - /usr/local/bin/emacs Nano: 2.0.6 - /usr/bin/nano VSCode: 1.55.2 - /usr/local/bin/code Vim: 8.2 - /run/current-system/sw/bin/vim Xcode: /undefined - /usr/bin/xcodebuild Languages: Bash: 4.4.23 - /run/current-system/sw/bin/bash Perl: 5.18.4 - /usr/bin/perl PHP: 7.3.11 - /usr/bin/php Protoc: 3.15.6 - /usr/local/bin/protoc Python: 2.7.16 - /usr/bin/python Python3: 3.9.2 - /usr/local/bin/python3 Ruby: 2.7.2 - /Users/arvinsevilla/.asdf/shims/ruby Databases: MySQL: 10.15 - /usr/local/bin/mysql SQLite: 3.28.0 - /usr/bin/sqlite3 Browsers: Chrome: 90.0.4430.85 Edge: 90.0.818.46 Firefox: 88.0 Firefox Developer Edition: 88.0 Safari: 14.1 Safari Technology Preview: 14.2 ```

Below are *.crash reports from console.app

androiddump ``` Process: androiddump [1820] Path: /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/androiddump Identifier: androiddump Version: 0 Code Type: X86-64 (Native) Parent Process: .Wireshark-wrapped [1814] Responsible: .Wireshark-wrapped [1814] User ID: 502 Date/Time: 2021-04-24 20:51:42.388 +0800 OS Version: Mac OS X 10.15.7 (19H524) Report Version: 12 Bridge OS Version: 5.2 (18P4346) Anonymous UUID: 661F54FF-184A-3DDF-B0DE-F583639B30EF Time Awake Since Boot: 640 seconds System Integrity Protection: enabled Crashed Thread: 0 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: DYLD, [0x1] Library missing Application Specific Information: dyld: launch, loading dependent libraries Dyld Error Message: Library not loaded: libwiretap.11.dylib Referenced from: /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/androiddump Reason: image not found Binary Images: 0x10688e000 - 0x10689bff7 +androiddump (0) /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/androiddump 0x106b59000 - 0x106beaf47 dyld (750.6) <326C6480-04F4-3164-A363-53079A148E2F> /usr/lib/dyld ```
ciscodump ``` Process: ciscodump [1822] Path: /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/ciscodump Identifier: ciscodump Version: 0 Code Type: X86-64 (Native) Parent Process: .Wireshark-wrapped [1814] Responsible: .Wireshark-wrapped [1814] User ID: 502 Date/Time: 2021-04-24 20:51:42.393 +0800 OS Version: Mac OS X 10.15.7 (19H524) Report Version: 12 Bridge OS Version: 5.2 (18P4346) Anonymous UUID: 661F54FF-184A-3DDF-B0DE-F583639B30EF Time Awake Since Boot: 640 seconds System Integrity Protection: enabled Crashed Thread: 0 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: DYLD, [0x1] Library missing Application Specific Information: dyld: launch, loading dependent libraries Dyld Error Message: Library not loaded: libwsutil.12.dylib Referenced from: /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/ciscodump Reason: image not found Binary Images: 0x1034ef000 - 0x1034f8fff +ciscodump (0) /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/ciscodump 0x1076b5000 - 0x107746f47 dyld (750.6) <326C6480-04F4-3164-A363-53079A148E2F> /usr/lib/dyld ```
randpktdump ``` Process: randpktdump [1821] Path: /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/randpktdump Identifier: randpktdump Version: 0 Code Type: X86-64 (Native) Parent Process: .Wireshark-wrapped [1814] Responsible: .Wireshark-wrapped [1814] User ID: 502 Date/Time: 2021-04-24 20:51:42.391 +0800 OS Version: Mac OS X 10.15.7 (19H524) Report Version: 12 Bridge OS Version: 5.2 (18P4346) Anonymous UUID: 661F54FF-184A-3DDF-B0DE-F583639B30EF Time Awake Since Boot: 640 seconds System Integrity Protection: enabled Crashed Thread: 0 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: DYLD, [0x1] Library missing Application Specific Information: dyld: launch, loading dependent libraries Dyld Error Message: Library not loaded: libwiretap.11.dylib Referenced from: /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/randpktdump Reason: image not found Binary Images: 0x105412000 - 0x10541afff +randpktdump (0) /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/randpktdump 0x110c04000 - 0x110c95f47 dyld (750.6) <326C6480-04F4-3164-A363-53079A148E2F> /usr/lib/dyld ```
sshdump ``` Process: sshdump [1823] Path: /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/sshdump Identifier: sshdump Version: 0 Code Type: X86-64 (Native) Parent Process: .Wireshark-wrapped [1814] Responsible: .Wireshark-wrapped [1814] User ID: 502 Date/Time: 2021-04-24 20:51:42.394 +0800 OS Version: Mac OS X 10.15.7 (19H524) Report Version: 12 Bridge OS Version: 5.2 (18P4346) Anonymous UUID: 661F54FF-184A-3DDF-B0DE-F583639B30EF Time Awake Since Boot: 640 seconds System Integrity Protection: enabled Crashed Thread: 0 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: DYLD, [0x1] Library missing Application Specific Information: dyld: launch, loading dependent libraries Dyld Error Message: Library not loaded: libwsutil.12.dylib Referenced from: /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/sshdump Reason: image not found Binary Images: 0x1013b8000 - 0x1013bfff7 +sshdump (0) /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/sshdump 0x106f11000 - 0x106fa2f47 dyld (750.6) <326C6480-04F4-3164-A363-53079A148E2F> /usr/lib/dyld ```
udpdump ``` Process: udpdump [1824] Path: /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/udpdump Identifier: udpdump Version: 0 Code Type: X86-64 (Native) Parent Process: .Wireshark-wrapped [1814] Responsible: .Wireshark-wrapped [1814] User ID: 502 Date/Time: 2021-04-24 20:51:42.398 +0800 OS Version: Mac OS X 10.15.7 (19H524) Report Version: 12 Bridge OS Version: 5.2 (18P4346) Anonymous UUID: 661F54FF-184A-3DDF-B0DE-F583639B30EF Time Awake Since Boot: 640 seconds System Integrity Protection: enabled Crashed Thread: 0 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: DYLD, [0x1] Library missing Application Specific Information: dyld: launch, loading dependent libraries Dyld Error Message: Library not loaded: libwsutil.12.dylib Referenced from: /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/udpdump Reason: image not found Binary Images: 0x10eabb000 - 0x10eac1ff7 +udpdump (0) /Volumes/VOLUME/*/Wireshark.app/Contents/MacOS/extcap/udpdump 0x10eac7000 - 0x10ebc1ff3 +libglib-2.0.0.dylib (0) /Volumes/VOLUME/*/libglib-2.0.0.dylib 0x10f6a5000 - 0x10f736f47 dyld (750.6) <326C6480-04F4-3164-A363-53079A148E2F> /usr/lib/dyld ```

Hope this helps.

EDIT:

libwiretap.11.dylib
libwsutil.12.dylib
aesyondu commented 3 years ago

Based on my brief investigation, I noted the following issues (see diff/patch at the bottom):

  1. Incorrect regex syntax in awk
  2. Missing snappy-c.h. I had to add snappy for compilation to proceed
  3. Missing zstd.h. I had to add zstd for compilation to proceed.

For issue number 3, I noted that when using the latest zstd version 1.4.9 I encountered a make error immediately. Based on this macos setup shell script, I changed the zstd version to 1.4.2.

It compiled for more than 6 hours, and I was preparing to create a pull request. Unfortuately it reached an error!!!:

[ 70%] Building C object epan/dissectors/CMakeFiles/dissectors.dir/packet-ncp2222.c.o
[ 70%] Building C object epan/dissectors/CMakeFiles/dissectors.dir/errno.c.o
[ 70%] Building C object epan/dissectors/CMakeFiles/dissectors.dir/packet-dcerpc-nt.c.o
[ 71%] Building C object epan/dissectors/CMakeFiles/dissectors.dir/packet-snort-config.c.o
[ 71%] Building C object epan/dissectors/CMakeFiles/dissectors.dir/usb.c.o
[ 71%] Building C object epan/dissectors/CMakeFiles/dissectors.dir/dissectors.c.o
[ 71%] Built target dissectors
make: *** [Makefile:160: all] Error 2
builder for '/nix/store/skfsg2dj3jny9v50mq3f5x5jdqg93bcp-wireshark-qt-3.4.4.drv' failed with exit code 2
error: build of '/nix/store/skfsg2dj3jny9v50mq3f5x5jdqg93bcp-wireshark-qt-3.4.4.drv' failed

I'm not really sure how to debug this further.

diff/patch ```patch diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix index 249d58ceb60..2d31343e096 100644 --- a/pkgs/applications/networking/sniffers/wireshark/default.nix +++ b/pkgs/applications/networking/sniffers/wireshark/default.nix @@ -3,6 +3,7 @@ , libssh, nghttp2, zlib, cmake, makeWrapper , withQt ? true, qt5 ? null , ApplicationServices, SystemConfiguration, gmp +, snappy, zstd }: assert withQt -> qt5 != null; @@ -37,7 +38,7 @@ in stdenv.mkDerivation { buildInputs = [ gettext pcre perl libpcap lua5 libssh nghttp2 openssl libgcrypt - libgpgerror gnutls geoip c-ares python3 glib zlib + libgpgerror gnutls geoip c-ares python3 glib zlib snappy zstd ] ++ optionals withQt (with qt5; [ qtbase qtmultimedia qtsvg qttools ]) ++ optionals stdenv.isLinux [ libcap libnl ] ++ optionals stdenv.isDarwin [ SystemConfiguration ApplicationServices gmp ] @@ -62,7 +63,7 @@ in stdenv.mkDerivation { mv $out/bin/Wireshark.app $out/Applications/Wireshark.app for f in $(find $out/Applications/Wireshark.app/Contents/PlugIns -name "*.so"); do - for dylib in $(otool -L $f | awk '/^\t*lib/ {print $1}'); do + for dylib in $(otool -L $f | awk '/^\t.*lib/ {print $1}'); do install_name_tool -change "$dylib" "$out/lib/$dylib" "$f" done done diff --git a/pkgs/tools/compression/zstd/default.nix b/pkgs/tools/compression/zstd/default.nix index 6394ea3338d..49f9a2adebc 100644 --- a/pkgs/tools/compression/zstd/default.nix +++ b/pkgs/tools/compression/zstd/default.nix @@ -7,72 +7,44 @@ stdenv.mkDerivation rec { pname = "zstd"; - version = "1.4.9"; + version = "1.4.2"; src = fetchFromGitHub { - owner = "facebook"; - repo = "zstd"; + sha256 = "0ihvkzp9v740sm43wan1f8ah8z29fhiwd4nxq11vp541sf66834g"; rev = "v${version}"; - sha256 = "18alxnym54gswsmsr5ra82q4k1q5fyzsyx0jykb2sk2nkpvx7334"; + repo = "zstd"; + owner = "facebook"; }; - nativeBuildInputs = [ cmake ] - ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - buildInputs = lib.optional stdenv.hostPlatform.isUnix bash; - - patches = [ - # This patches makes sure we do not attempt to use the MD5 implementation - # of the host platform when running the tests - ./playtests-darwin.patch - ]; - - postPatch = lib.optionalString (!static) '' - substituteInPlace build/cmake/CMakeLists.txt \ - --replace 'message(SEND_ERROR "You need to build static library to build tests")' "" - substituteInPlace build/cmake/tests/CMakeLists.txt \ - --replace 'libzstd_static' 'libzstd_shared' - sed -i \ - "1aexport ${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH=$PWD/build_/lib" \ - tests/playTests.sh - ''; + buildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; - cmakeFlags = [ - "-DZSTD_BUILD_SHARED:BOOL=${if (!static) then "ON" else "OFF"}" - "-DZSTD_BUILD_STATIC:BOOL=${if static then "ON" else "OFF"}" - "-DZSTD_PROGRAMS_LINK_SHARED:BOOL=${if (!static) then "ON" else "OFF"}" - "-DZSTD_LEGACY_SUPPORT:BOOL=${if legacySupport then "ON" else "OFF"}" - "-DZSTD_BUILD_TESTS:BOOL=ON" + makeFlags = [ + "ZSTD_LEGACY_SUPPORT=${if legacySupport then "1" else "0"}" ]; - cmakeDir = "../build/cmake"; - dontUseCmakeBuildDir = true; - preConfigure = '' - mkdir -p build_ && cd $_ - ''; checkInputs = [ file ]; doCheck = true; - checkPhase = '' - runHook preCheck - # Patch shebangs for playTests - patchShebangs ../programs/zstdgrep - ctest -R playTests # The only relatively fast test. - runHook postCheck + preCheck = '' + substituteInPlace tests/playTests.sh \ + --replace 'MD5SUM="md5 -r"' 'MD5SUM="md5sum"' ''; + installFlags = [ + "PREFIX=$(out)" + ]; + preInstall = '' - substituteInPlace ../programs/zstdgrep \ + substituteInPlace programs/zstdgrep \ --replace ":-grep" ":-${gnugrep}/bin/grep" \ - --replace ":-zstdcat" ":-$bin/bin/zstdcat" + --replace ":-zstdcat" ":-$out/bin/zstdcat" - substituteInPlace ../programs/zstdless \ - --replace "zstdcat" "$bin/bin/zstdcat" + substituteInPlace programs/zstdless \ + --replace "zstdcat" "$out/bin/zstdcat" ''; - outputs = [ "bin" "dev" ] - ++ lib.optional stdenv.hostPlatform.isUnix "man" - ++ [ "out" ]; + enableParallelBuilding = true; - meta = with lib; { + meta = with stdenv.lib; { description = "Zstandard real-time compression algorithm"; longDescription = '' Zstd, short for Zstandard, is a fast lossless compression algorithm, @@ -83,11 +55,11 @@ stdenv.mkDerivation rec { speed is preserved and remain roughly the same at all settings, a property shared by most LZ compression algorithms, such as zlib. ''; - homepage = "https://facebook.github.io/zstd/"; - changelog = "https://github.com/facebook/zstd/blob/v${version}/CHANGELOG"; + homepage = https://facebook.github.io/zstd/; license = with licenses; [ bsd3 ]; # Or, at your opinion, GPL-2.0-only. - platforms = platforms.all; + platforms = platforms.unix; maintainers = with maintainers; [ orivej ]; }; } + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 016ffb025a6..24882593b91 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23098,6 +23098,8 @@ in wireshark = callPackage ../applications/networking/sniffers/wireshark { inherit (darwin.apple_sdk.frameworks) ApplicationServices SystemConfiguration; libpcap = libpcap.override { withBluez = stdenv.isLinux; }; + snappy = snappy; + zstd = zstd; }; wireshark-qt = wireshark; ```
happysalada commented 2 years ago

Hey, are you still interested in this ? If you are, I'd be happy to help you get this over the line. I have a darwin machine and I don't mind running the build before I go to sleep to test.

DKurilo commented 2 years ago

@happysalada , it would be great to have it working. I believe I need to find some time to figure out what you are going to do. :) If you have links to any resources that will help me to understand how it works, can you write them, please? I know I can read through documentation. I just didn't have time for this yet.

happysalada commented 2 years ago

I think the way to go here is open a PR with the fix about the awk expression, then test and check the error. If you want to open a PR, I'm happy to test, post the error and we can discuss the fixes possible on the PR. I think there where quite some updates since this issue, so that's why the dependency proposed need to be checked again (snappy and zstd). I don't know at all how it works, I wanted to test today. I'm hoping the errors will be clear enough.

stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info

nrhtr commented 1 year ago

I tested nix run nixpkgs#wireshark-cli on my macOS M1 machine and it appears to be working. I think this can be closed.

happysalada commented 1 year ago

Tested on x86_64 darwin and it worked

seh commented 12 months ago

I find that the GUI starts on macOS (x86_64-darwin), but fails to load the required libraries, and crashes soon afterward.

Upon opening the application, it presents a modal dialog with the following message:

Multiple problems found

The plugin 'usbdump.so' has no "plugin_version" symbol
The plugin 'ethercat.so' has no "plugin_version" symbol
The plugin 'wimax.so' has no "plugin_version" symbol
The plugin 'wimaxasncp.so' has no "plugin_version" symbol
The plugin 'stats_tree.so' has no "plugin_version" symbol
The plugin 'profinet.so' has no "plugin_version" symbol
The plugin 'transum.so' has no "plugin_version" symbol
The plugin 'gryphon.so' has no "plugin_version" symbol
The plugin 'unistim.so' has no "plugin_version" symbol
The plugin 'irda.so' has no "plugin_version" symbol
The plugin 'wimaxmacphy.so' has no "plugin_version" symbol
The plugin 'mate.so' has no "plugin_version" symbol
The plugin 'opcua.so' has no "plugin_version" symbol
The plugin 'g726.so' has no "plugin_version" symbol
The plugin 'g722.so' has no "plugin_version" symbol
The plugin 'opus_dec.so' has no "plugin_version" symbol
The plugin 'g729.so' has no "plugin_version" symbol
The plugin 'l16mono.so' has no "plugin_version" symbol
The plugin 'g711.so' has no "plugin_version" symbol
The plugin 'usbdump.so' has no "plugin_version" symbol…

In the main window, it presents this message:

Unknown message from dumpcap reading header, try to show it as a string:
  dyld[43838]: Library not loaded: @rpath/libwiretap.13.dylib
  Referenced from: /nix/store/704a2hazgdwcnmjrrh38laiwg2yzzqkl-wireshark-qt-4.0.6/Applications/Wireshark.app/Contents/MacOS/.dumpcap-wrapped
  Reason: tried: '/tmp/nix-build-wireshark-qt-4.0.6.drv-0/source/build/run/libwiretap.13.dylib' (no such file),
                 '/System/Volumes/Preboot/Cryptexes/OS/tmp/nix-build-wireshark-qt-4.0.6.drv-0/source/build/run/libwiretap.13.dylib' (no such file),
                 '/System/Library/Frameworks/libwiretap.13.dylib' (no such file, not in dyld cache),
                 '/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/libwiretap.13.dylib' (no such file),
                 '/tmp/nix-build-wireshark-qt-4.0.6.drv-0/source/build/run/libwiretap.13.dylib' (no such file),
                 '/System/Volumes/Preboot/Cryptexes/OS/tmp/nix-build-wireshark-qt-4.0.6.drv-0/source/build/run/libwiretap.13.dylib' (no such file),
                 '/System/Library/Frameworks/libwiretap.13.dylib' (no such file, not in dyld cache),
                 '/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/libwiretap.13.dylib' (no such file),
                 '/usr/local/lib/libwiretap.13.dylib' (no such file),
                 '/usr/lib/libwiretap.13.dylib' (no such file, not in dyld cache)
    Child dumpcap process died: Abort
DKurilo commented 7 months ago

BTW, if you start Wireshark from terminal like this:

/run/current-system/Applications/Wireshark.app/Contents/MacOS/Wireshark

it will show error about plugins, but it wil start capturing packets but in terminal there are errors like:

dyld[36997]: Library not loaded: @rpath/libwsutil.14.dylib
  Referenced from: <no uuid> /nix/store/xdzmi2f0lw0flgmf3r2h0bg2gxr5vmd1-wireshark-qt-4.0.10/Applications/Wireshark.app/Contents/MacOS/extcap/.wifidump-wrapped
  Reason: tried: '/tmp/nix-build-wireshark-qt-4.0.10.drv-0/source/build/run/libwsutil.14.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/tmp/nix-build-wireshark-qt-4.0.10.drv-0/source/build/run/libwsutil.14.dylib' (no such file), '/System/Library/Frameworks/libwsutil.14.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/libwsutil.14.dylib' (no such file), '/tmp/nix-build-wireshark-qt-4.0.10.drv-0/source/build/run/libwsutil.14.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/tmp/nix-build-wireshark-qt-4.0.10.drv-0/source/build/run/libwsutil.14.dylib' (no such file), '/System/Library/Frameworks/libwsutil.14.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/libwsutil.14.dylib' (no such file), '/usr/local/lib/libwsutil.14.dylib' (no such file), '/usr/lib/libwsutil.14.dylib' (no such file, not in dyld cache)
dyld[36998]: Library not loaded: @rpath/libwiretap.13.dylib
  Referenced from: <no uuid> /nix/store/xdzmi2f0lw0flgmf3r2h0bg2gxr5vmd1-wireshark-qt-4.0.10/Applications/Wireshark.app/Contents/MacOS/extcap/.androiddump-wrapped
  Reason: tried: '/tmp/nix-build-wireshark-qt-4.0.10.drv-0/source/build/run/libwiretap.13.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/tmp/nix-build-wireshark-qt-4.0.10.drv-0/source/build/run/libwiretap.13.dylib' (no such file), '/System/Library/Frameworks/libwiretap.13.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/libwiretap.13.dylib' (no such file), '/tmp/nix-build-wireshark-qt-4.0.10.drv-0/source/build/run/libwiretap.13.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/tmp/nix-build-wireshark-qt-4.0.10.drv-0/source/build/run/libwiretap.13.dylib' (no such file), '/System/Library/Frameworks/libwiretap.13.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/libwiretap.13.dylib' (no such file), '/usr/local/lib/libwiretap.13.dylib' (no such file), '/usr/lib/libwiretap.13.dylib' (no such file, not in dyld cache)

I don't know if it can help somehow.