Wireshark mailing list archives

Re: Issues with cross-compiling


From: João Valverde <j () v6e pt>
Date: Mon, 17 Jan 2022 14:09:55 +0000

Hi,

You would have a better chance of receiving helpful feedback on the CMake side of things if you also described the actual error in detail.

On 17/01/22 02:01, Glen Huang wrote:
Hi,

I’m trying to create an OpenWrt package for Wireshark.

I think I’m pretty close. However, I got stuck at lemon, which if I’m not wrong, should be compiled by my build 
machine’s compiler. From the source code, I found out it supports the LEMON_C_COMPILER variable, which I assigned with 
the build machine’s compiler, but after compiling, CMAKE used the target platform’s linking flags for linking, which 
apparently failed. I’m not very familiar with CMAKE, so would appreciate some help.

Cross-compiling has cropped up here a few times in the past decades, but the ones I managed to find are all pertaining 
to Wireshark’s autotools era, so they’re not particularly helpful, at least for my limited knowledge in this area.

Here is the OpenWrt package’s Makefile I have come up with so far:

include $(TOPDIR)/rules.mk

PKG_NAME:=wireshark
PKG_VERSION:=3.6.1
PKG_RELEASE:=1

PKG_SOURCE_URL:=https://www.wireshark.org/download/src/
PKG_SOURCE:=wireshark-$(PKG_VERSION).tar.xz
PKG_HASH:=0434eda8fb6bf88e2b42a67eb5d1de254a67d505bec3bb51fee9d7cad7925a38

PKG_BUILD_PARALLEL:=1
CMAKE_INSTALL:=1

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

define Package/wireshark
   SECTION:=net
   CATEGORY:=Network
   TITLE:=Network protocol analyzer
   URL:=https://www.wireshark.org/
   DEPENDS:=+libpcap +glib2 +libgcrypt +libcares
endef

define Package/wireshark/description
         Network protocol analyzer
endef

CMAKE_OPTIONS += \
         -DCMAKE_CROSSCOMPILING=1 \
         -DHAVE_C99_VSNPRINTF=TRUE \
         -DLEMON_C_COMPILER=$(CMAKE_HOST_C_COMPILER) \
         -DBUILD_wireshark=OFF \
         -DBUILD_androiddump=OFF \
         -DBUILD_ciscodump=OFF \
         -DBUILD_idl2wrs=OFF

define Package/wireshark/install
         # figure out later
endef

$(eval $(call BuildPackage,wireshark))
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
              mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
            mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: