liblibwireshark icon indicating copy to clipboard operation
liblibwireshark copied to clipboard

Issue with make

Open liorzemah opened this issue 8 years ago • 17 comments
trafficstars

I do the commands as specified, I git clone, mkdir cd etc, cmake works fine, but then i fail to make.

lior@lior-Lenovo-G570:~/Documents/liblibwireshark/build$ make [ 2%] Building C object caputils/CMakeFiles/caputils.dir/capture-pcap-util-unix.c.o /home/lior/Documents/liblibwireshark/caputils/capture-pcap-util-unix.c:29:27: fatal error: wsutil/wspcap.h: No such file or directory compilation terminated. caputils/CMakeFiles/caputils.dir/build.make:62: recipe for target 'caputils/CMakeFiles/caputils.dir/capture-pcap-util-unix.c.o' failed make[2]: *** [caputils/CMakeFiles/caputils.dir/capture-pcap-util-unix.c.o] Error 1 CMakeFiles/Makefile2:586: recipe for target 'caputils/CMakeFiles/caputils.dir/all' failed make[1]: *** [caputils/CMakeFiles/caputils.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2

Here is the CMake output:

~/Documents/liblibwireshark/build$ cmake .. -- The C compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") -- Checking for one of the modules 'glib-2.0' -- Found GLIB2: /usr/lib/x86_64-linux-gnu/libglib-2.0.so
-- Found GMODULE2: /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so
-- Found PCAP: /usr/include
-- Looking for pcap_open_dead -- Looking for pcap_open_dead - found -- Looking for pcap_freecode -- Looking for pcap_freecode - found -- Looking for pcap_breakloop -- Looking for pcap_breakloop - found -- Looking for pcap_create -- Looking for pcap_create - found -- Looking for pcap_datalink_name_to_val -- Looking for pcap_datalink_name_to_val - found -- Looking for pcap_datalink_val_to_description -- Looking for pcap_datalink_val_to_description - found -- Looking for pcap_datalink_val_to_name -- Looking for pcap_datalink_val_to_name - found -- Looking for pcap_findalldevs -- Looking for pcap_findalldevs - found -- Looking for pcap_free_datalinks -- Looking for pcap_free_datalinks - found -- Looking for pcap_get_selectable_fd -- Looking for pcap_get_selectable_fd - found -- Looking for pcap_lib_version -- Looking for pcap_lib_version - found -- Looking for pcap_list_datalinks -- Looking for pcap_list_datalinks - found -- Looking for pcap_set_datalink -- Looking for pcap_set_datalink - found -- Looking for bpf_image -- Looking for bpf_image - found -- Looking for pcap_setsampling -- Looking for pcap_setsampling - not found -- Looking for pcap_set_tstamp_precision -- Looking for pcap_set_tstamp_precision - found -- Looking for pcap_open -- Looking for pcap_open - not found -- Wireshark version: 2.2.7 -- Wireshark install dir: /usr -- /home/lior/Documents/liblibwireshark/examples/02-seek-interactive-online.c -- Configuring done -- Generating done -- Build files have been written to: /home/lior/Documents/liblibwireshark/build

liorzemah avatar Sep 12 '17 09:09 liorzemah

Easiest fix would be creating a private.cmake file in the project's root directory and add following lines to it:

set(Wireshark_DIR "/my/path/to/wireshark")
include_directories(SYSTEM "/my/path/to/wireshark")
link_directories("/my/path/to/wireshark/build/run")

Add more include_directories for other things it might complain about. This is necessary, because Wireshark doesn't install internal headers, which this project depends on.

Since I created this project, I learnt about pluginIF, which is an official interface for using Wireshark. You might want to check it out.

a3f avatar Sep 12 '17 09:09 a3f

those paths, are they to wireshark themselves or this lib? I have installed wireshark via apt install wireshark, how will I work with this?

liorzemah avatar Sep 12 '17 10:09 liorzemah

You'll need to download the Wireshark source code and point to it.

a3f avatar Sep 12 '17 10:09 a3f

Preferably, our own fork to avoid running into problems: https://github.com/epl-viz/wireshark

a3f avatar Sep 12 '17 10:09 a3f

Alright, i've cloned your fork of wireshark, so I need to first create a "build" file and then cmake the wireshark folder, and only then point towards that folder from the liblibwireshark folder in the private.cmake file? I say this because I don't see any build folder in the wireshark source code

liorzemah avatar Sep 12 '17 10:09 liorzemah

Wireshark's core functionality is split into a number of libraries: libwireshark, libwsutil, libwscodecs and so on. These are installed system-wide, but your system wireshark doesn't install headers for them and the headers in the repository might be of an incompatible version, so you need to compile Wireshark yourself.

You can do so with CMake or with Autotools. With CMake it would look like this:

cd epl-viz-wireshark
mkdir build
cd build
cmake ..
make

a3f avatar Sep 12 '17 10:09 a3f

I've done what you said with your fork, and I've tried to cmake it but it will tell me the following:

wireshark/build$ cmake .. -- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Generating build using CMake 3.5.1 -- No custom file found in /home/lior/Videos/wireshark -- Configuration types: -- CMAKE_C_FLAGS_RELWITHDEBINFO: -O2 -g -DNDEBUG -- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O2 -g -DNDEBUG -- V: 2.4.1, MaV: 2, MiV: 4, PL: 1, EV: . -- Found PythonInterp: /usr/bin/python (found version "2.7.12") -- Found python module asn2wrs: /home/lior/Videos/wireshark/tools/asn2wrs.py CMake Warning at CMakeLists.txt:444 (find_package): By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt5Core", but CMake did not find one.

Could not find a package configuration file provided by "Qt5Core" with any of the following names:

Qt5CoreConfig.cmake
qt5core-config.cmake

Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set "Qt5Core_DIR" to a directory containing one of the above files. If "Qt5Core" provides a separate development package or SDK, be sure it has been installed.

-- Checking for c-compiler flag: -fexcess-precision=fast -- Performing Test C__fexcess_precision_fast_VALID -- Performing Test C__fexcess_precision_fast_VALID - Success -- Checking for c++-compiler flag: -fexcess-precision=fast -- Performing Test CXX__fexcess_precision_fast_VALID -- Performing Test CXX__fexcess_precision_fast_VALID - Success -- Checking for c-compiler flag: -Wall -- Performing Test C__Wall_VALID -- Performing Test C__Wall_VALID - Success -- Checking for c-compiler flag: -Wextra -- Performing Test C__Wextra_VALID -- Performing Test C__Wextra_VALID - Success -- Checking for c-compiler flag: -Wendif-labels -- Performing Test C__Wendif_labels_VALID -- Performing Test C__Wendif_labels_VALID - Success -- Checking for c-compiler flag: -Wpointer-arith -- Performing Test C__Wpointer_arith_VALID -- Performing Test C__Wpointer_arith_VALID - Success -- Checking for c-compiler flag: -Wformat-security -- Performing Test C__Wformat_security_VALID -- Performing Test C__Wformat_security_VALID - Success -- Checking for c-compiler flag: -fwrapv -- Performing Test C__fwrapv_VALID -- Performing Test C__fwrapv_VALID - Success -- Checking for c-compiler flag: -fno-strict-overflow -- Performing Test C__fno_strict_overflow_VALID -- Performing Test C__fno_strict_overflow_VALID - Success -- Checking for c-compiler flag: -Wvla -- Performing Test C__Wvla_VALID -- Performing Test C__Wvla_VALID - Success -- Checking for c-compiler flag: -Waddress -- Performing Test C__Waddress_VALID -- Performing Test C__Waddress_VALID - Success -- Checking for c-compiler flag: -Wattributes -- Performing Test C__Wattributes_VALID -- Performing Test C__Wattributes_VALID - Success -- Checking for c-compiler flag: -Wdiv-by-zero -- Performing Test C__Wdiv_by_zero_VALID -- Performing Test C__Wdiv_by_zero_VALID - Success -- Checking for c-compiler flag: -Wignored-qualifiers -- Performing Test C__Wignored_qualifiers_VALID -- Performing Test C__Wignored_qualifiers_VALID - Success -- Checking for c-compiler flag: -Wpragmas -- Performing Test C__Wpragmas_VALID -- Performing Test C__Wpragmas_VALID - Success -- Checking for c-compiler flag: -Wno-overlength-strings -- Performing Test C__Wno_overlength_strings_VALID -- Performing Test C__Wno_overlength_strings_VALID - Success -- Checking for c-compiler flag: -Wno-long-long -- Performing Test C__Wno_long_long_VALID -- Performing Test C__Wno_long_long_VALID - Success -- Checking for c-compiler flag: -Wheader-guard -- Performing Test C__Wheader_guard_VALID -- Performing Test C__Wheader_guard_VALID - Failed -- Checking for c-compiler flag: -Wframe-larger-than=16384 -- Performing Test C__Wframe_larger_than_16384_VALID -- Performing Test C__Wframe_larger_than_16384_VALID - Success -- Checking for c-compiler flag: -Wc++-compat -- Performing Test C__Wc_compat_VALID -- Performing Test C__Wc_compat_VALID - Success -- Checking for c-compiler flag: -Wshadow -- Performing Test C__Wshadow_VALID -- Performing Test C__Wshadow_VALID - Success -- Checking for c-compiler flag: -Wno-pointer-sign -- Performing Test C__Wno_pointer_sign_VALID -- Performing Test C__Wno_pointer_sign_VALID - Success -- Checking for c-compiler flag: -Wold-style-definition -- Performing Test C__Wold_style_definition_VALID -- Performing Test C__Wold_style_definition_VALID - Success -- Checking for c-compiler flag: -Wstrict-prototypes -- Performing Test C__Wstrict_prototypes_VALID -- Performing Test C__Wstrict_prototypes_VALID - Success -- Checking for c-compiler flag: -Wlogical-op -- Performing Test C__Wlogical_op_VALID -- Performing Test C__Wlogical_op_VALID - Success -- Checking for c-compiler flag: -Wjump-misses-init -- Performing Test C__Wjump_misses_init_VALID -- Performing Test C__Wjump_misses_init_VALID - Success -- Checking for c-compiler flag: -Wunused-const-variable -- Performing Test C__Wunused_const_variable_VALID -- Performing Test C__Wunused_const_variable_VALID - Failed -- Checking for c-compiler flag: -Wshorten-64-to-32 -- Performing Test C__Wshorten_64_to_32_VALID -- Performing Test C__Wshorten_64_to_32_VALID - Failed -- Checking for c-compiler flag: -Werror=implicit -- Performing Test C__Werror_implicit_VALID -- Performing Test C__Werror_implicit_VALID - Success -- Checking for c++-compiler flag: -Wall -- Performing Test CXX__Wall_VALID -- Performing Test CXX__Wall_VALID - Success -- Checking for c++-compiler flag: -Wextra -- Performing Test CXX__Wextra_VALID -- Performing Test CXX__Wextra_VALID - Success -- Checking for c++-compiler flag: -Wendif-labels -- Performing Test CXX__Wendif_labels_VALID -- Performing Test CXX__Wendif_labels_VALID - Success -- Checking for c++-compiler flag: -Wpointer-arith -- Performing Test CXX__Wpointer_arith_VALID -- Performing Test CXX__Wpointer_arith_VALID - Success -- Checking for c++-compiler flag: -Wformat-security -- Performing Test CXX__Wformat_security_VALID -- Performing Test CXX__Wformat_security_VALID - Success -- Checking for c++-compiler flag: -fwrapv -- Performing Test CXX__fwrapv_VALID -- Performing Test CXX__fwrapv_VALID - Success -- Checking for c++-compiler flag: -fno-strict-overflow -- Performing Test CXX__fno_strict_overflow_VALID -- Performing Test CXX__fno_strict_overflow_VALID - Success -- Checking for c++-compiler flag: -Wvla -- Performing Test CXX__Wvla_VALID -- Performing Test CXX__Wvla_VALID - Success -- Checking for c++-compiler flag: -Waddress -- Performing Test CXX__Waddress_VALID -- Performing Test CXX__Waddress_VALID - Success -- Checking for c++-compiler flag: -Wattributes -- Performing Test CXX__Wattributes_VALID -- Performing Test CXX__Wattributes_VALID - Success -- Checking for c++-compiler flag: -Wdiv-by-zero -- Performing Test CXX__Wdiv_by_zero_VALID -- Performing Test CXX__Wdiv_by_zero_VALID - Success -- Checking for c++-compiler flag: -Wignored-qualifiers -- Performing Test CXX__Wignored_qualifiers_VALID -- Performing Test CXX__Wignored_qualifiers_VALID - Success -- Checking for c++-compiler flag: -Wpragmas -- Performing Test CXX__Wpragmas_VALID -- Performing Test CXX__Wpragmas_VALID - Success -- Checking for c++-compiler flag: -Wno-overlength-strings -- Performing Test CXX__Wno_overlength_strings_VALID -- Performing Test CXX__Wno_overlength_strings_VALID - Success -- Checking for c++-compiler flag: -Wno-long-long -- Performing Test CXX__Wno_long_long_VALID -- Performing Test CXX__Wno_long_long_VALID - Success -- Checking for c++-compiler flag: -Wheader-guard -- Performing Test CXX__Wheader_guard_VALID -- Performing Test CXX__Wheader_guard_VALID - Failed -- Checking for c++-compiler flag: -Wframe-larger-than=16384 -- Performing Test CXX__Wframe_larger_than_16384_VALID -- Performing Test CXX__Wframe_larger_than_16384_VALID - Success -- Performing Test FVHIDDEN -- Performing Test FVHIDDEN - Success statuscheck linker flag - test linker flags: -Wl,--as-needed -- Performing Test WS_LD_FLAG_VALID0 -- Performing Test WS_LD_FLAG_VALID0 - Success statuscheck linker flag - test linker flags: -pie -- Performing Test WS_LD_FLAG_VALID1 -- Performing Test WS_LD_FLAG_VALID1 - Success -- Packagelist: CAP;CARES;GCRYPT;GEOIP;GLIB2;GMODULE2;GNUTLS;GTHREAD2;Gettext;Git;KERBEROS;LEX;LIBSSH;LUA;LZ4;LibXml2;M;NGHTTP2;NL;PCAP;POD;Perl;PythonInterp;Qt5Core;Qt5LinguistTools;Qt5Multimedia;Qt5PrintSupport;Qt5Svg;Qt5Widgets;SBC;SETCAP;SH;SMI;SNAPPY;SPANDSP;YACC;YAPP;ZLIB -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") -- Checking for one of the modules 'libcap' -- Could NOT find CAP (missing: CAP_LIBRARY CAP_INCLUDE_DIR) -- CAP NOT FOUND -- Could NOT find CARES (missing: CARES_LIBRARY CARES_INCLUDE_DIR) -- CARES NOT FOUND CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message): Could NOT find GCRYPT (missing: GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR) (Required is at least version "1.4.2") Call Stack (most recent call first): /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE) cmake/modules/FindGCRYPT.cmake:42 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:938 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/lior/Videos/wireshark/build/CMakeFiles/CMakeOutput.log". See also "/home/lior/Videos/wireshark/build/CMakeFiles/CMakeError.log".

liorzemah avatar Sep 12 '17 10:09 liorzemah

You'll have to install Wireshark's required dependencies. I think all of them should be listed when running in apt-rdepends wireshark. You can also check out the Wireshark documentation for more details.

a3f avatar Sep 12 '17 10:09 a3f

I've just installed apt-rdepends wireshark and I still have the same error occurred while cmake

liorzemah avatar Sep 12 '17 11:09 liorzemah

apt-rdepends doesn't install anything. It lists what's required for the package. Install the development version of those packages.

a3f avatar Sep 12 '17 11:09 a3f

alright cool, it lists all the dependencies, however, is there a way I can install a lot of them at once? I'd rather not go installing them one by one.

liorzemah avatar Sep 12 '17 11:09 liorzemah

I am not a Debian user, but googling brought me to https://ubuntuforums.org/showthread.php?t=1681006&p=10424779#post10424779

sudo apt-get build-dep wireshark

a3f avatar Sep 12 '17 11:09 a3f

Alright cool, do you know how should i use this command?

it's give the next error: Reading package lists... Done E: You must put some 'source' URIs in your sources.list

liorzemah avatar Sep 12 '17 11:09 liorzemah

Google it? ;)

a3f avatar Sep 12 '17 11:09 a3f

I try to make but i get this error:

root@lior-Lenovo-G570:/home/lior/Documents/liblibwireshark/build# make
[ 11%] Built target caputils
[ 45%] Built target objlib
[ 52%] Built target capchild
[ 54%] Built target liblibwireshark
[ 57%] Linking C executable uat
libliblibwireshark.so.0.0.2: undefined reference to `ws_strtou32'
libliblibwireshark.so.0.0.2: undefined reference to `get_nonzero_guint32'
libliblibwireshark.so.0.0.2: undefined reference to `report_warning'
collect2: error: ld returned 1 exit status
CMakeFiles/uat.dir/build.make:100: recipe for target 'uat' failed
make[2]: *** [uat] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/uat.dir/all' failed
make[1]: *** [CMakeFiles/uat.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

liorzemah avatar Sep 13 '17 18:09 liorzemah

You have built Wireshark already, right? If so: @mensinda It looks like CMake links against system Wireshark instead of the Wireshark specified in the private.cmake. Could you please take a look?

@liorzemah Till then, you could just do a system-wide install of the Wireshark you already built with make install. This should fix the link errors. (I guess your installed version of Wireshark isn't 2.4.0)

a3f avatar Sep 13 '17 18:09 a3f

I also have same issue: [cmake] Generating build using CMake 3.16.0-rc1 [cmake] CMake build type: Debug [cmake] V: 3.0.7, MaV: 3, MiV: 0, PL: 7, EV: . [cmake] Linker flags: [cmake] CMake Error at /Applications/CMake.app/Contents/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message): [cmake] Could NOT find GCRYPT (missing: GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR) [cmake] (Required is at least version "1.4.2") [cmake] Call Stack (most recent call first): [cmake] /Applications/CMake.app/Contents/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE) [cmake] cmake/modules/FindGCRYPT.cmake:44 (find_package_handle_standard_args) [cmake] CMakeLists.txt:1006 (find_package) [cmake] [cmake] [cmake] Configuring incomplete, errors occurred! [cmake] See also "/Users/jacky/Desktop/wireshark/wireshark-3.0.7/build/CMakeFiles/CMakeOutput.log". [cmake] See also "/Users/jacky/Desktop/wireshark/wireshark-3.0.7/build/CMakeFiles/CMakeError.log". [cmake] CMake Deprecation Warning: [cmake] The 'cmake-server(7)' is deprecated. Please port clients to use the [cmake] 'cmake-file-api(7)' instead. [cmake] [cmake] [cms-driver] CMake 配置过程中出错: [cmake-server] Configuration failed.

weiguoping2014 avatar Dec 10 '19 09:12 weiguoping2014