Flock Error on compile from git src

When trying to compile a new version of libdaq, I need to pull from the git src.

I know I need to run bootstrap first (Build/Prepare), but I get the error below

mkdir -p /home/grommish/openwrt/dl
SHELL= flock /home/grommish/openwrt/tmp/./home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0.tar.xz.flock -c '  	/home/grommish/openwrt/scripts/download.pl "/home/grommish/openwrt/dl" "/home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0.tar.xz" "skip" "" || (  /home/grommish/openwrt/scripts/dl_github_archive.py --dl-dir="/home/grommish/openwrt/dl" --url="https://github.com/snort3/libdaq.git" --version="c6a40c6752d31f6074b6a36516e9cf1747d7d999" --subdir="/home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0" --source="/home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0.tar.xz" --hash="skip" || ( 	echo "Checking out files from the git repository..."; mkdir -p /home/grommish/openwrt/tmp/dl && cd /home/grommish/openwrt/tmp/dl && rm -rf /home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0 && [ \! -d /home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0 ] && git clone  https://github.com/snort3/libdaq.git /home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0 && (cd /home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0 && git checkout c6a40c6752d31f6074b6a36516e9cf1747d7d999 && git submodule update --init --recursive) && echo "Packing checkout..." && export TAR_TIMESTAMP=`cd /home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0 && git log -1 --format='\''@%ct'\''` && rm -rf /home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0/.git && 	tar --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name ${TAR_TIMESTAMP:+--mtime="$TAR_TIMESTAMP"} -c /home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0 | 	xz -zc -7e > /home/grommish/openwrt/tmp/dl//home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0.tar.xz && mv /home/grommish/openwrt/tmp/dl//home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0.tar.xz /home/grommish/openwrt/dl/ && rm -rf /home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0; );  )    '
flock: cannot open lock file /home/grommish/openwrt/tmp/./home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0.tar.xz.flock: No such file or directory
make[3]: *** [Makefile:77: /home/grommish/openwrt/dl//home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0.tar.xz] Error 66

Here is the Makefile

#
# Copyright (C) 2012-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=libdaq
PKG_VERSION:=3.0.0-alpha5
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/snort3/libdaq.git
PKG_SOURCE_DATE:=2020-01-31
PKG_SOURCE_VERSION:=c6a40c6752d31f6074b6a36516e9cf1747d7d999
PKG_BUILD_DIR:=$(BUILD_DIR)/daq-3.0.0
PKG_MIRROR_HASH:=skip
PKG_SOURCE_SUBDIR:=$(BUILD_DIR)/daq-3.0.0

PKG_BUILD_DIR:=$(BUILD_DIR)/daq-3.0.0
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Grommish <grommish@gmail.com>

PKG_INSTALL:=1

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

define Package/libdaq
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=DAQ library
  URL:=$(PKG_SOURCE_URL)
  DEPENDS:=+libdnet +libpcap
endef

define Package/libdaq/description
 DAQ 3.0.0-alpha5
 Data Acquisition library for packet I/O.
endef

CONFIGURE_ARGS+= \
	--disable-static \
	--with-dnet-includes="$(STAGING_DIR)/usr/include" \
	--with-dnet-libraries="$(STAGING_DIR)/usr/lib" \
	--with-libpcap-includes="$(STAGING_DIR)/usr/include" \
	--with-libpcap-libraries="$(STAGING_DIR)/usr/lib" \

define Build/Prepare
	# libdaq from src doesn't come with a configure
	( cd $(HOST_BUILD_DIR); ./bootstrap )
endef


define Build/InstallDev
	$(INSTALL_DIR) $(STAGING_DIR)/usr/include
	$(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(STAGING_DIR)/usr/include/
	$(INSTALL_DIR) $(STAGING_DIR)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(STAGING_DIR)/usr/lib/
	$(INSTALL_DIR) $(STAGING_DIR)/usr/lib/daq
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/daq/* $(STAGING_DIR)/usr/lib/daq/
	$(INSTALL_DIR) $(STAGING_DIR)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/daq-modules-config $(STAGING_DIR)/usr/bin/
endef

define Package/libdaq/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
	$(INSTALL_DIR) $(1)/usr/lib/daq
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/daq/*.so* $(1)/usr/lib/daq/
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/daq-modules-config $(1)/usr/bin/
endef

$(eval $(call BuildPackage,libdaq))

Can you check that the host tools were built and that you have this file:
ls openwrt/staging_dir/host/bin/flock

I'm asking as it seems to run the alternative command when the file is missing (from rules.mk)

-rwxr-xr-x 1 grommish grommish 18144 Apr 20 21:22 flock

It's there.. And if I'm compiling from the tar.gz source, it's fine. I only see this when attempting to do the git-src compile rather than a predefined tarball. The issue for me is that the existing tarball is outdated, so it has to be pulled from the repo directly.

/home/grommish/openwrt/tmp/./home/grommish/openwrt/build_dir/target-mips64_octeonplus_64_musl/daq-3.0.0.tar.xz.flock is not a valid directory to create a lock into, that's what the error is saying. If we look, it's made of a temp directory and the full build_dir path (which doesn't exist)

You need to change PKG_SOURCE_SUBDIR to something like daq-3.0.0 without BUILD_DIR in it. This is used to unpack the source in the temp directory. (flock worked for me after that change - I didn't check any further)

1 Like

That was it.. Thank you, sir!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.