The sad news is that the LEMON_C_COMPILER variable is a mini hack and I doubt it can be arm twisted to support your use case.

On 17/01/22 16:14, Glen Huang wrote:
Sure,

This is the compilation error I got

gcc -DNDEBUG -L/sdk/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/usr/lib 
-L/sdk/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/lib -znow -zrelro -fPIE -pie 
CMakeFiles/lemon.dir/lemon.c.o -o ../../run/lemon
/usr/bin/ld: 
/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o: in function 
`_start':
(.text+0x12): undefined reference to `__libc_csu_fini'
/usr/bin/ld: (.text+0x19): undefined reference to `__libc_csu_init'
collect2: error: ld returned 1 exit status

I don’t think musl should show up here, since my build machine is Debian.

On Jan 17, 2022, at 10:09 PM, João Valverde <j...@v6e.pt> wrote:

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-requ...@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-requ...@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-requ...@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-requ...@wireshark.org?subject=unsubscribe

Reply via email to