Build issue on the mips platform
Looks like it is still an issue for mips:
action-stress-threads.c: In function 'snoopyTestCli_action_stress_threads_threadMain':
action-stress-threads.c:230:77: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
230 | if (verbose) printf(" t%d %llu : Hello from thread #%d\n", seqNrPub, (unsigned long long)pthread_self(), seqNrPub);
| ^
action-stress-threads.c:234:91: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
234 | if (verbose) printf(" t%d %llu : Threads before snoopy_init(): %d\n", seqNrPub, (unsigned long long)pthread_self(), snoopy_tsrm_get_threadCount());
| ^
action-stress-threads.c:236:91: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
236 | if (verbose) printf(" t%d %llu : Threads after snoopy_init(): %d\n", seqNrPub, (unsigned long long)pthread_self(), snoopy_tsrm_get_threadCount());
| ^
action-stress-threads.c:246:89: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
246 | printf(" t%d %llu : Datasource %s returned negative result: %d\n", seqNrPub, (unsigned long long)pthread_self(), dsName, retVal);
| ^
action-stress-threads.c:248:67: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
248 | printf(" t%d %llu : DS result: %30s = %s\n", seqNrPub, (unsigned long long)pthread_self(), dsName, dsResult);
| ^
action-stress-threads.c:253:91: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
253 | if (verbose) printf(" t%d %llu : Threads before snoopy_cleanup(): %d\n", seqNrPub, (unsigned long long)pthread_self(), snoopy_tsrm_get_threadCount());
| ^
action-stress-threads.c:255:91: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
255 | if (verbose) printf(" t%d %llu : Threads after snoopy_cleanup(): %d\n", seqNrPub, (unsigned long long)pthread_self(), snoopy_tsrm_get_threadCount());
| ^
action-stress-threads.c:259:75: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
259 | if (verbose) printf(" t%d %llu : Thread exiting: #%d\n", seqNrPub, (unsigned long long)pthread_self(), seqNrPub);
| ^
Originally posted by @condemil in https://github.com/a2o/snoopy/issues/246#issuecomment-1398180443
@condemil, can you think of a way where I can test out this build variation myself? I.e. is there a hosting service where I can rent a mips system for a few hours?
I am using OpenWRT SDK to cross-compile the sources. You can follow these steps to do the same:
sudo apt install gawk
mkdir -p $HOME/openwrt
cd $HOME/openwrt
git clone https://github.com/a2o/snoopy
wget https://downloads.openwrt.org/releases/22.03.2/targets/ath79/nand/openwrt-sdk-22.03.2-ath79-nand_gcc-11.2.0_musl.Linux-x86_64.tar.xz -O openwrt.tar.xz
tar xf openwrt.tar.xz
export SDK=$HOME/openwrt/openwrt-sdk-22.03.2-ath79-nand_gcc-11.2.0_musl.Linux-x86_64
export PATH=$SDK/staging_dir/host/bin:$PATH
mkdir -p mypackages/snoopy
ln -s $HOME/openwrt/snoopy/.git $HOME/openwrt/mypackages/snoopy/git-src
create file mypackages/snoopy/Makefile with the following contents:
include $(TOPDIR)/rules.mk
PKG_NAME:=snoopy
PKG_VERSION:=2.5.1
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/snoopy-$(PKG_VERSION)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/a2o/snoopy.git
PKG_SOURCE_VERSION:=snoopy-$(PKG_VERSION)
PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.mk
define Package/snoopy
SECTION:=base
CATEGORY:=Utilities
TITLE:=Snoopy Command Logger
URL:=https://github.com/a2o/snoopy
endef
define Package/snoopy/description
Snoopy Command Logger is a small library that logs all program
executions on your system.
endef
define Build/Configure
$(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR))
endef
define Package/snoopy/install
$(INSTALL_DIR) $(1)/usr/local/lib
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libsnoopy.so $(1)/usr/local/lib/libsnoopy.so
endef
$(eval $(call BuildPackage,snoopy))
call these commands:
cd $SDK
echo "src-link mypackages $HOME/openwrt/mypackages" > $SDK/feeds.conf
./scripts/feeds update mypackages
./scripts/feeds install -a -p mypackages
make package/snoopy/compile -j1 V=s
In menuconfig make sure these are enabled:
Advanced configuration options (for developers) -> Enable package source tree override (NEW)
Utilities -> snoopy
Once you do changes in the code under $HOME/openwrt/snoopy git repo you need to commit those changes as OpenWRT build system takes sources from git HEAD for package source tree override mode.
More info about package build can be found here: https://openwrt.org/docs/guide-developer/packages
Your linux distro may have some dependencies missing, all required dependencies specified in here: https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem
Much appreciated, @condemil. I'll give it a go in the coming days/weeks/months.