Add LibXml2 to the required library list

Library is supported by all OS, and we effectivly already require the
library due to GLIB, libgcrypt, and GnuTLS also require LibXml2.

Ping #20508
This commit is contained in:
Joakim Karlsson 2025-05-14 10:32:51 +02:00 committed by John Thacker
parent 728b1d0ead
commit 812f277d0e
18 changed files with 23 additions and 104 deletions

View File

@ -28,7 +28,6 @@ jobs:
-DENABLE_CHECKHF_CONFLICT=ON
-DENABLE_GNUTLS=OFF
-DENABLE_KERBEROS=OFF
-DENABLE_LIBXML2=OFF
-DENABLE_ILBC=OFF
-DENABLE_LUA=OFF
-DENABLE_LZ4=OFF

View File

@ -963,7 +963,7 @@ No options:
script: |
cmake -GNinja -DENABLE_CCACHE=ON \
-DENABLE_BROTLI=OFF -DENABLE_CAP=OFF -DENABLE_CHECKHF_CONFLICT=ON -DENABLE_GNUTLS=OFF \
-DENABLE_KERBEROS=OFF -DENABLE_LIBXML2=OFF -DENABLE_ILBC=OFF -DENABLE_LUA=OFF -DENABLE_LZ4=OFF \
-DENABLE_KERBEROS=OFF -DENABLE_ILBC=OFF -DENABLE_LUA=OFF -DENABLE_LZ4=OFF \
-DENABLE_MINIZIP=OFF -DENABLE_NETLINK=OFF -DENABLE_NGHTTP2=OFF -DENABLE_NGHTTP3=OFF \
-DENABLE_BCG729=OFF -DENABLE_OPUS=OFF -DENABLE_PCAP=OFF -DENABLE_PLUGIN_IFDEMO=ON \
-DENABLE_PLUGINS=OFF -DENABLE_SBC=OFF -DENABLE_SMI=OFF -DENABLE_SNAPPY=OFF -DENABLE_SPANDSP=OFF \

View File

@ -1349,6 +1349,8 @@ endif ()
find_package(LEX REQUIRED)
reset_find_package(PCRE2 PCRE2_DEBUG_LIBRARY)
find_package(PCRE2 REQUIRED)
reset_find_package(LibXml2)
find_package(LibXml2 "2.9.7" REQUIRED)
if (NOT WIN32)
find_package(Gettext)
@ -1568,24 +1570,6 @@ if (BUILD_stratoshark)
ws_find_package(Sinsp ENABLE_SINSP HAVE_SINSP "0.17.1")
endif()
# CMake 3.9 and below used 'LIBXML2_LIBRARIES' as the name of the cache entry
# storing the find_library result. Transfer it to the new cache variable such
# that reset_find_package can detect and clear outdated cache variables.
if(DEFINED LIBXML2_LIBRARIES AND NOT DEFINED LIBXML2_LIBRARY)
set(LIBXML2_LIBRARY ${LIBXML2_LIBRARIES} CACHE FILEPATH "")
endif()
# Call reset_find_package explicitly since variables are in upper case.
reset_find_package(LIBXML2)
ws_find_package(LibXml2 ENABLE_LIBXML2 HAVE_LIBXML2)
if(NOT LIBXML2_FOUND)
# CMake 3.9 and below used LIBXML2_LIBRARIES as the name of
# the cache entry storing the find_library result.
# Current CMake (3.13) and below sets LIBXML2_LIBRARIES and LIBXML2_INCLUDE_DIRS
# to a non-empty value, be sure to clear it when not found.
set(LIBXML2_LIBRARIES "")
set(LIBXML2_INCLUDE_DIRS "")
endif()
# Capabilities to run dumpcap as non-root user.
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
ws_find_package(CAP ENABLE_CAP HAVE_LIBCAP)
@ -2428,14 +2412,12 @@ if(USE_REPOSITORY)
if (OPUS_FOUND)
list (APPEND THIRD_PARTY_DLLS "${OPUS_DLL_DIR}/${OPUS_DLL}")
endif(OPUS_FOUND)
if (LIBXML2_FOUND)
foreach( _dll ${LIBXML2_DLLS} )
list (APPEND THIRD_PARTY_DLLS "${LIBXML2_DLL_DIR}/${_dll}")
endforeach(_dll)
foreach( _pdb ${LIBXML2_PDBS} )
list (APPEND THIRD_PARTY_PDBS "${LIBXML2_DLL_DIR}/${_pdb}")
endforeach(_pdb)
endif(LIBXML2_FOUND)
foreach( _dll ${LIBXML2_DLLS} )
list (APPEND THIRD_PARTY_DLLS "${LIBXML2_DLL_DIR}/${_dll}")
endforeach(_dll)
foreach( _pdb ${LIBXML2_PDBS} )
list (APPEND THIRD_PARTY_PDBS "${LIBXML2_DLL_DIR}/${_pdb}")
endforeach(_pdb)
if (SMI_FOUND)
list (APPEND THIRD_PARTY_DLLS "${SMI_DLL_DIR}/${SMI_DLL}")
# Wireshark.nsi wants SMI_DIR which is the base SMI directory
@ -3976,9 +3958,6 @@ if(RPMBUILD_EXECUTABLE)
if (OPUS_FOUND)
list(APPEND _rpmbuild_with_args --with opus)
endif()
if (LIBXML2_FOUND)
list(APPEND _rpmbuild_with_args --with libxml2)
endif()
if (NGHTTP2_FOUND)
list(APPEND _rpmbuild_with_args --with nghttp2)
endif()

View File

@ -117,7 +117,6 @@ option(ENABLE_SPANDSP "Build with G.722/G.726 codecs support in RTP Player" O
option(ENABLE_BCG729 "Build with G.729 codec support in RTP Player" ON)
option(ENABLE_AMRNB "Build with AMRNB codec support in RTP Player" ON)
option(ENABLE_ILBC "Build with iLBC codec support in RTP Player" ON)
option(ENABLE_LIBXML2 "Build with libxml2 support" ON)
option(ENABLE_OPUS "Build with opus support" ON)
option(ENABLE_SINSP "Build with libsinsp+libscap support" ON)

View File

@ -260,9 +260,6 @@
/* Define to 1 if you have the opus library. */
#cmakedefine HAVE_OPUS 1
/* Define to 1 if you have the lixbml2 library. */
#cmakedefine HAVE_LIBXML2 1
/* Define to 1 if you have the `setresgid' function. */
#cmakedefine HAVE_SETRESGID 1

View File

@ -194,6 +194,8 @@ for Arm64 and Intel. wsbuglink:17294[]
current OS default on Windows and macOS, if Wireshark is built with
Qt 6.8 or later as the official installers do. wsbuglink:19328[]
* LibXml2 is now a required dependency.
=== Removed Features and Support
Wireshark no longer supports AirPcap and WinPcap.

View File

@ -956,6 +956,7 @@ This guide assumes `paru` is being used.
paru -S mingw-w64-cmake
paru -S mingw-w64-glib2
paru -S mingw-w64-libgcrypt
paru -S mingw-w64-libxml2
paru -S mingw-w64-c-ares
paru -S mingw-w64-speexdsp
paru -S mingw-w64-libpcap
@ -971,7 +972,6 @@ This guide assumes `paru` is being used.
paru -S mingw-w64-snappy
paru -S mingw-w64-opus
paru -S mingw-w64-opencore-amr
paru -S mingw-w64-libxml2
paru -S mingw-w64-libnghttp2
paru -S mingw-w64-libssh
paru -S mingw-w64-minizip

View File

@ -32,7 +32,6 @@
#include <wsutil/wslog.h>
#include <epan/wmem_scopes.h>
#if defined HAVE_LIBXML2
#include <libxml/xmlversion.h>
#if defined LIBXML_XPATH_ENABLED \
@ -78,8 +77,6 @@ static struct xpath {
#endif /* LIBXML_XPATH_ENABLED && LIBXML_SAX1_ENABLED && LIBXML_TREE_ENABLED */
#endif /* HAVE_LIBXML2 */
struct datatype {
uint16_t id;
const struct epl_datatype *ptr;
@ -568,13 +565,11 @@ populate_object_list(xmlNodeSetPtr nodes, void *_profile)
#else /* ! PARSE_XDD */
#ifdef HAVE_LIBXML2
struct profile *
epl_xdd_load(struct profile *profile _U_, const char *xml_file _U_)
{
return NULL;
}
#endif /* HAVE_LIBXML2 */
#endif /* ! PARSE_XDD */

View File

@ -76,11 +76,7 @@
#include <wsutil/wslog.h>
#include <string.h>
#ifdef HAVE_LIBXML2
#define IF_LIBXML(x) x
#else
#define IF_LIBXML(x)
#endif
#define IF_LIBXML(x) x
void proto_register_epl(void);
void proto_reg_handoff_epl(void);
@ -5238,14 +5234,14 @@ static struct profile *profile_load(wmem_allocator_t *allocator, const char *pat
if (!epl_eds_load(profile, path))
profile_del(profile);
}
#if HAVE_LIBXML2
else if (g_str_has_suffix(path, ".xdd") || g_str_has_suffix(path, ".xdc"))
{
profile = profile_new(allocator);
if (!epl_xdd_load(profile, path))
profile_del(profile);
}
#endif
if (!profile)
report_failure("Profile '%s' couldn't be parsed", path);
@ -6384,10 +6380,8 @@ proto_register_epl(void)
prefs_register_bool_preference(epl_module, "use_sdo_mappings", "Use SDO ObjectMappings for PDO dissection",
"Partition PDOs according to ObjectMappings sent via SDO", &use_sdo_mappings);
#ifdef HAVE_LIBXML2
prefs_register_bool_preference(epl_module, "use_xdc_mappings", "Use XDC ObjectMappings for PDO dissection",
"If you want to parse the defaultValue (XDD) and actualValue (XDC) attributes for ObjectMappings in order to detect default PDO mappings, which may not be sent over SDO ", &use_xdc_mappings);
#endif
prefs_register_bool_preference(epl_module, "interpret_untyped_as_le", "Interpret short (<64bit) data as little endian integers",
"If a data field has untyped data under 8 byte long, interpret it as unsigned little endian integer and show decimal and hexadecimal representation thereof. Otherwise use stock data dissector", &interpret_untyped_as_le);
@ -6517,13 +6511,8 @@ epl_profile_uat_fld_fileopen_check_cb(void *record _U_, const char *path, unsign
if (g_str_has_suffix(path, ".xdd") || g_str_has_suffix(path, ".xdc"))
{
#ifdef HAVE_LIBXML2
*err = NULL;
return true;
#else
*err = ws_strdup_printf("*.xdd and *.xdc support not compiled in. %s", supported);
return false;
#endif
}
*err = g_strdup(supported);

View File

@ -100,10 +100,8 @@
#include <brotli/decode.h>
#endif
#ifdef HAVE_LIBXML2
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#endif
#ifndef _WIN32
#include <signal.h>
@ -325,10 +323,9 @@ epan_init(register_cb cb, void *client_data, bool load_plugins)
}
#endif
#endif
#ifdef HAVE_LIBXML2
xmlInitParser();
LIBXML_TEST_VERSION;
#endif
#ifndef _WIN32
// We might receive a SIGPIPE due to maxmind_db.
@ -458,9 +455,9 @@ epan_cleanup(void)
#ifdef HAVE_LIBGNUTLS
gnutls_global_deinit();
#endif
#ifdef HAVE_LIBXML2
xmlCleanupParser();
#endif
except_deinit();
addr_resolv_cleanup();
@ -917,11 +914,7 @@ epan_gather_compile_info(feature_list l)
#endif /* HAVE_SNAPPY */
/* libxml2 */
#ifdef HAVE_LIBXML2
with_feature(l, "libxml2 %s", LIBXML_DOTTED_VERSION);
#else
without_feature(l, "libxml2");
#endif /* HAVE_LIBXML2 */
/* libsmi */
#ifdef HAVE_LIBSMI

View File

@ -24,7 +24,6 @@
%bcond_with spandsp
%bcond_with bcg729
%bcond_with amrnb
%bcond_with libxml2
%bcond_with nghttp2
%bcond_with nghttp3
%bcond_with sdjournal
@ -161,9 +160,7 @@ BuildRequires: speexdsp-devel
BuildRequires: (lua-devel or lua53-devel or compat-lua-devel or lua52-devel or lua51-devel)
%endif
%if %{with libxml2}
BuildRequires: libxml2-devel
%endif
%if %{with nghttp2}
BuildRequires: libnghttp2-devel
@ -427,11 +424,6 @@ This package contains the Stratoshark GUI and desktop integration files.
%else
-DENABLE_AMRNB=OFF \
%endif
%if %{with libxml2}
-DENABLE_LIBXML2=ON \
%else
-DENABLE_LIBXML2=OFF \
%endif
%if %{with nghttp2}
-DENABLE_NGHTTP2=ON \
%else

View File

@ -71,13 +71,11 @@
#include <wsutil/file_util.h>
#include <epan/prefs.h>
#ifdef HAVE_LIBXML2
#include <wsutil/strtoi.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#endif
#include "packet-pn.h"
@ -4307,7 +4305,6 @@ pnio_gsd_device_equal(const void *key1, const void *key2)
return (a->vendor_id == b->vendor_id) && (a->device_id == b->device_id);
}
#ifdef HAVE_LIBXML2
static wmem_map_t *
pnio_load_gsd_device_modules(const xmlNodePtr deviceNode, xmlXPathContextPtr xpathCtx)
{
@ -4535,7 +4532,6 @@ pnio_load_gsd_device_profile(xmlNodePtr deviceNode, xmlXPathContextPtr xpathCtx,
value->modules = pnio_load_gsd_device_modules(deviceNode, xpathCtx);
value->submodules = pnio_load_gsd_device_submodules(deviceNode, xpathCtx);
}
#endif /* HAVE_LIBXML2 */
static void
pnio_load_gsd_files(void)
@ -4547,7 +4543,6 @@ pnio_load_gsd_files(void)
wmem_free_all(pnio_pref_scope);
}
#ifdef HAVE_LIBXML2
char *diropen = NULL; /* saves the final networkpath to open for GSD-files */
GDir *dir;
const char *filename; /* saves the found GSD-file name */
@ -4611,7 +4606,6 @@ pnio_load_gsd_files(void)
g_dir_close(dir);
}
#endif /* HAVE_LIBXML2 */
}
typedef struct {
address* device;
@ -22044,11 +22038,9 @@ proto_register_pn_io (void)
"Folder containing GSD files", /* Title */
"Place GSD files in this folder.", /* Description */
&pnio_ps_networkpath); /* Variable in which to save the GSD file folder path */
#ifndef HAVE_LIBXML2
prefs_register_static_text_preference(pnio_module, "pnio_no_libxml2",
"This version of Wireshark was built without support for reading GSDML files.",
"This version of Wireshark was built without libxml2 and does not support reading GSDML files.");
#endif
prefs_register_filename_preference(pnio_module, "pnio_configpath",
"Config file for manual extraction",
"Choose a config XML file",

View File

@ -457,9 +457,7 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset,
proto_item *data_item;
proto_item *IODataObject_item;
#ifdef HAVE_LIBXML2
proto_item *IODataObject_item_info;
#endif
proto_tree *IODataObject_tree;
proto_item *ModuleID_item;
proto_item *ModuleDiff_item;
@ -613,8 +611,6 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset,
proto_tree_add_string_format_value(data_tree, hf_pn_io_frame_info_nameofstation, tvb, 0,
0, station_info->nameofstation, "\"%s\"", station_info->nameofstation);
}
#ifdef HAVE_LIBXML2
if (station_info->gsdPathLength == true) { /* given path isn't too long for the array */
if (station_info->gsdFound == true) { /* found a GSD-file */
if (station_info->gsdLocation != NULL) {
@ -633,9 +629,6 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset,
IODataObject_item_info = proto_tree_add_item(data_tree, hf_pn_io_frame_info_gsd_path, tvb, offset, 0, ENC_NA);
proto_item_append_text(IODataObject_item_info, " Please check your GSD-file networkpath. (No Path configured)");
}
#else /* HAVE_LIBXML2 */
proto_tree_add_none_format(data_tree, hf_pn_io_frame_info_gsd_error, tvb, offset, 0, "This copy of Wireshark was built without support for reading GSDML files.");
#endif /* HAVE_LIBXML2 */
}
/* ---- Input IOData-/IOCS-Object Handling ---- */
@ -827,8 +820,6 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset,
proto_tree_add_string_format_value(data_tree, hf_pn_io_frame_info_nameofstation, tvb, 0,
0, station_info->nameofstation, "\"%s\"", station_info->nameofstation);
}
#ifdef HAVE_LIBXML2
if (station_info->gsdPathLength == true) { /* given path isn't too long for the array */
if (station_info->gsdFound == true) { /* found a GSD-file */
if (station_info->gsdLocation != NULL) {
@ -847,9 +838,6 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset,
IODataObject_item_info = proto_tree_add_item(data_tree, hf_pn_io_frame_info_gsd_path, tvb, offset, 0, ENC_NA);
proto_item_append_text(IODataObject_item_info, " Please check your GSD-file networkpath. (No Path configured)");
}
#else /* HAVE_LIBXML2 */
proto_tree_add_none_format(data_tree, hf_pn_io_frame_info_gsd_error, tvb, offset, 0, "This copy of Wireshark was built without support for reading GSDML files.");
#endif /* HAVE_LIBXML2 */
}
/* ---- Output IOData-/IOCS-Object Handling ---- */

View File

@ -57,6 +57,7 @@ BASIC_LIST="
g++
glib-dev
libgcrypt-dev
libxml2-dev
flex
tiff-dev
c-ares-dev
@ -78,7 +79,6 @@ ADDITIONAL_LIST="
libcap-dev
libcap-setcap
libpcap-dev
libxml2-dev
libmaxminddb-dev
krb5-dev
lz4-dev

View File

@ -106,6 +106,8 @@ BASIC_LIST="
libpcap-dev
libpcre2-dev
libspeexdsp-dev
libxml2-dev
libxml2-utils
make
python3
"
@ -193,7 +195,6 @@ ADDITIONAL_LIST="
libsnappy-dev
libspandsp-dev
libsystemd-dev
libxml2-dev
libzstd-dev
ninja-build
perl
@ -214,7 +215,6 @@ DEBDEPS_LIST="
dh-python
docbook-xml
docbook-xsl
libxml2-utils
lintian
lsb-release
po-debconf

View File

@ -104,6 +104,7 @@ REQUIRED_LIST=(
c-ares
glib
libgcrypt
libxml2
pcre2
qt6
speexdsp
@ -119,7 +120,6 @@ OPTIONAL_LIST=(
libnghttp3
libsmi
libssh
libxml2
lua
lz4
minizip

View File

@ -81,6 +81,7 @@ BASIC_LIST="
glib2-devel
libgcrypt-devel
libpcap-devel
libxml2-devel
pcre2-devel
python3
"
@ -89,7 +90,6 @@ ADDITIONAL_LIST="
krb5-devel
libcap-devel
libssh-devel
libxml2-devel
lz4
perl
perl-Parse-Yapp

View File

@ -24,11 +24,9 @@
#include <wsutil/report_message.h>
#include <wsutil/filesystem.h>
#include <wsutil/strtoi.h>
#ifdef HAVE_LIBXML2
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#endif
#include "file_wrappers.h"
#include "wtap-int.h"
@ -2266,7 +2264,6 @@ static ttl_result_t ttl_read_entry(wtap* wth, wtap_rec* rec, int* err, char** er
}
#ifdef HAVE_LIBXML2
static bool
ttl_xml_node_get_number(xmlNodePtr node, xmlXPathContextPtr ctx, double *ret) {
xmlXPathObjectPtr result;
@ -2383,7 +2380,6 @@ ttl_process_xml_config(ttl_t* ttl, const char* text, int size) {
xmlFreeDoc(doc);
return true;
}
#endif /* HAVE_LIBXML2 */
/* Maximum supported line length of preference files */
#define MAX_LINELEN 1024
@ -2717,7 +2713,6 @@ ttl_open(wtap* wth, int* err, char** err_info) {
return WTAP_OPEN_ERROR;
}
offset += TTL_LOGFILE_INFO_SIZE;
#ifdef HAVE_LIBXML2
unsigned int xml_len = header.header_size - offset;
if (xml_len != 0) {
unsigned char* xml = g_try_malloc(xml_len);
@ -2738,7 +2733,6 @@ ttl_open(wtap* wth, int* err, char** err_info) {
g_free(xml);
offset += xml_len;
}
#endif /* HAVE_LIBXML2 */
}
}