[LEDE-DEV] It seems to me like the build system ignores EXTRA_FLAGS?

Dan Lüdtke mail at danrl.com
Wed Nov 30 13:23:37 PST 2016


Hi,

I am working on a Jool package for LEDE and I am having trouble building the user space binaries for Jool SIIT/NAT64. It is missing `argp` AFAIK.

> ../common/jool-jool.o: In function `main':
> jool.c:(.text.startup+0x89): undefined reference to `argp_parse'
> collect2: error: ld returned 1 exit status
> Makefile:504: recipe for target 'jool' failed
> make[6]: *** [jool] Error 1

However, my build depends on argp-standalone and I also added argp to the EXTRA_CFLAGS (and out of desperation also to EXTRA_LDFLAGS).

This affects the toolchain using musl. If the toolchain uses glibc the packet builds just fine.

Can someone please help me spot the mistake?
I am also not very confident that I understood how the LEDE build system invokes ./configure and automake, any hints there are appreciated, too.

Cheers!

Dan

Build Log: https://paste.fedoraproject.org/494383/14805388/
Makefile:  https://paste.fedoraproject.org/494385/05389191/


==Build log==
Also here: https://paste.fedoraproject.org/494383/14805388/

x86_64-openwrt-linux-musl-gcc -DPACKAGE_NAME=\"Jool\" -DPACKAGE_TARNAME=\"jool\" -DPACKAGE_VERSION=\"3.5.1\" -DPACKAGE_STRING=\"Jool\ 3.5.1\" -DPACKAGE_BUGREPORT=\"jool at nic.mx\" -DPACKAGE_URL=\"\" -DPACKAGE=\"jool\" -DVERSION=\"3.5.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE__BOOL=1 -DHAVE_INET_NTOA=1 -DHAVE_MEMSET=1 -DHAVE_STRCASECMP=1 -DHAVE_STRTOL=1 -I.    -Wall -O2 -I./../../include -I/home/danrl/lede/nat64/source/staging_dir/target-x86_64_musl-1.1.15/usr/include/libnl3   -MT ../common/target/jool-session.o -MD -MP -MF ../common/target/.deps/jool-session.Tpo -c -o ../common/target/jool-session.o `test -f '../common/target/session.c' || echo './'`../common/target/session.c
mv -f ../common/target/.deps/jool-session.Tpo ../common/target/.deps/jool-session.Po
x86_64-openwrt-linux-musl-gcc -Wall -O2 -I./../../include -I/home/danrl/lede/nat64/source/staging_dir/target-x86_64_musl-1.1.15/usr/include/libnl3     -o jool ../../common/netlink/jool-config.o ../../common/stateful/jool-xlat.o ../common/jool-cJSON.o ../common/jool-dns.o ../common/jool-file.o ../common/jool-jool.o ../common/jool-netlink2.o ../common/jool-str_utils.o ../common/argp/jool-options.o ../common/nl/jool-buffer.o ../common/target/jool-bib.o ../common/target/jool-eam.o ../common/target/jool-global.o ../common/target/jool-instance.o ../common/target/jool-joold.o ../common/target/jool-json.o ../common/target/jool-log_time.o ../common/target/jool-pool.o ../common/target/jool-pool4.o ../common/target/jool-pool6.o ../common/target/jool-session.o -L/home/danrl/lede/nat64/source/staging_dir/target-x86_64_musl-1.1.15/usr/lib -lnl-genl-3 -lnl-3 -lpthread -lm 
../common/jool-jool.o: In function `main':
jool.c:(.text.startup+0x89): undefined reference to `argp_parse'
collect2: error: ld returned 1 exit status
Makefile:504: recipe for target 'jool' failed
make[6]: *** [jool] Error 1
make[6]: Leaving directory '/home/danrl/lede/nat64/source/build_dir/target-x86_64_musl-1.1.15/jool-a37b795993c59fb246e93ada49d0ead0775daa69/usr/stateful'
Makefile:345: recipe for target 'all-recursive' failed
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory '/home/danrl/lede/nat64/source/build_dir/target-x86_64_musl-1.1.15/jool-a37b795993c59fb246e93ada49d0ead0775daa69/usr'
Makefile:124: recipe for target '/home/danrl/lede/nat64/source/build_dir/target-x86_64_musl-1.1.15/jool-a37b795993c59fb246e93ada49d0ead0775daa69/.built' failed
make[4]: *** [/home/danrl/lede/nat64/source/build_dir/target-x86_64_musl-1.1.15/jool-a37b795993c59fb246e93ada49d0ead0775daa69/.built] Error 2
make[4]: Leaving directory '/home/danrl/lede/nat64/source/feeds/sixfw/net/jool'
package/Makefile:127: recipe for target 'package/feeds/sixfw/jool/compile' failed
make[3]: *** [package/feeds/sixfw/jool/compile] Error 2
make[3]: Leaving directory '/home/danrl/lede/nat64/source'
package/Makefile:124: recipe for target '/home/danrl/lede/nat64/source/staging_dir/target-x86_64_musl-1.1.15/stamp/.package_compile' failed
make[2]: *** [/home/danrl/lede/nat64/source/staging_dir/target-x86_64_musl-1.1.15/stamp/.package_compile] Error 2
make[2]: Leaving directory '/home/danrl/lede/nat64/source'
/home/danrl/lede/nat64/source/include/toplevel.mk:194: recipe for target 'world' failed
make[1]: *** [world] Error 2
make[1]: Leaving directory '/home/danrl/lede/nat64/source'
Makefile:29: recipe for target 'verbose' failed
make: *** [verbose] Error 2


==Makefile==
Also here: https://paste.fedoraproject.org/494385/05389191/

#
# Copyright (C) 2016 Dan Luedtke <mail at danrl.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.

include $(TOPDIR)/rules.mk

PKG_NAME:=jool
PKG_VERSION:=3.5.1
PKG_RELEASE:=1

PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=COPYING

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/sixfw/Jool.git
PKG_SOURCE_VERSION:=a37b795993c59fb246e93ada49d0ead0775daa69
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=+argp-standalone
PKG_AUTOMAKE_PATHS:=usr
PKG_FIXUP:=autoreconf
MAKE_PATH:=usr

# does not work
#EXTRA_CFLAGS:=-largp-standalone
#EXTRA_LDFLAGS:=-largp-standalone

# does not work either
EXTRA_CFLAGS:=-largp
EXTRA_LDFLAGS:=-largp

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

define Package/jool/Default
	SECTION:=net
	CATEGORY:=Network
	URL:=https://www.jool.mx
	MAINTAINER:=Dan Luedtke <mail at danrl.com>
endef

define Package/jool/Default/description
	Jool is an Open Source SIIT and NAT64 for Linux.
endef

define Package/jool
	$(call Package/jool/Default)
	TITLE:=Jool meta-package
	DEPENDS:=+kmod-jool +jool-tools
endef

define Package/jool/description
	$(call Package/jool/Default/description)
endef

include $(INCLUDE_DIR)/kernel-defaults.mk
include $(INCLUDE_DIR)/package-defaults.mk

define KernelPackage/jool
	SECTION:=kernel
	CATEGORY:=Kernel modules
	SUBMENU:=Network Support
	TITLE:=Jool kernel module
	DEPENDS:= \
		@IPV6 \
		+kmod-crypto-md5 \
		+kmod-nf-conntrack \
		+kmod-nf-conntrack6
	FILES:= \
		$(PKG_BUILD_DIR)/mod/stateful/jool.$(LINUX_KMOD_SUFFIX) \
		$(PKG_BUILD_DIR)/mod/stateless/jool_siit.$(LINUX_KMOD_SUFFIX)
endef

define KernelPackage/jool/description
	$(call Package/jool/Default/description)

	This package provides the kernel module for Jool.
endef

define Package/jool-tools
	$(call Package/jool/Default)
	TITLE:=Jool userspace control programs
	DEPENDS:=+libnl +ethtool
endef

define Package/jool-tools/description
	$(call Package/jool/Default/description)

	This package provides the userspace control programs for Jool.
endef

define Package/jool-tools/install
	$(INSTALL_DIR) $(1)/usr/sbin/
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/stateful/jool       $(1)/usr/sbin/
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/stateless/jool_siit $(1)/usr/sbin/
endef

define Build/Configure
	( cd $(PKG_BUILD_DIR)/usr; ./configure )
endef

define Build/Compile
	$(MAKE) -C "$(LINUX_DIR)" \
		KERNEL_DIR="$(LINUX_DIR)" \
		ARCH="$(LINUX_KARCH)" \
		CROSS_COMPILE="$(TARGET_CROSS)" \
		SUBDIRS="$(PKG_BUILD_DIR)/mod/stateful" \
		V="$(V)" \
		modules
	$(MAKE) -C "$(LINUX_DIR)" \
		KERNEL_DIR="$(LINUX_DIR)" \
		ARCH="$(LINUX_KARCH)" \
		CROSS_COMPILE="$(TARGET_CROSS)" \
		SUBDIRS="$(PKG_BUILD_DIR)/mod/stateless" \
		V="$(V)" \
		modules
	$(call Build/Compile/Default)
endef

$(eval $(call BuildPackage,jool))
$(eval $(call KernelPackage,jool))
$(eval $(call BuildPackage,jool-tools))




More information about the Lede-dev mailing list