Cannot compile irqbalance @ glibc

Hi,

I'm trying to build the current master build with:

gcc v8.2, glibc, -O2, binutils 2.32

System: Arch Linux (latest).

I have spotted this issue and added the three lines into the Makefile.

No luck. Log is showing not much:

> configure.ac:7: installing './compile'
> configure.ac:6: installing './missing'
> parallel-tests: installing './test-driver'
> autoreconf: Leaving directory `.'
> (cd /home/user/openwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/irqbalance-1.6.0/./; if [ -x ./configure ]; then find /home/user/openwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/irqbalance-1.6.0/ -name config.guess | xargs -r chmod u+w; find /home/user/openwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/irqbalance-1.6.0/ -name config.guess | xargs -r -n1 cp --remove-destination /home/user/openwrt/openwrt/scripts/config.guess; find /home/user/openwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/irqbalance-1.6.0/ -name config.sub | xargs -r chmod u+w; find /home/user/openwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/irqbalance-1.6.0/ -name config.sub | xargs -r -n1 cp --remove-destination /home/user/openwrt/openwrt/scripts/config.sub; AR="arm-openwrt-linux-gnueabi-gcc-ar" AS="arm-openwrt-linux-gnueabi-gcc -c -O2 -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libiconv-stub/include -I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libintl-stub/include -ffile-prefix-map=/home/user/openwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/irqbalance-1.6.0=irqbalance-1.6.0 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=arm-openwrt-linux-gnueabi-ld NM="arm-openwrt-linux-gnueabi-gcc-nm" CC="arm-openwrt-linux-gnueabi-gcc" GCC="arm-openwrt-linux-gnueabi-gcc" CXX="arm-openwrt-linux-gnueabi-g++" RANLIB="arm-openwrt-linux-gnueabi-gcc-ranlib" STRIP=arm-openwrt-linux-gnueabi-strip OBJCOPY=arm-openwrt-linux-gnueabi-objcopy OBJDUMP=arm-openwrt-linux-gnueabi-objdump SIZE=arm-openwrt-linux-gnueabi-size CFLAGS="-O2 -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libiconv-stub/include -I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libintl-stub/include -ffile-prefix-map=/home/user/openwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/irqbalance-1.6.0=irqbalance-1.6.0 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CXXFLAGS="-O2 -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libiconv-stub/include -I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libintl-stub/include -ffile-prefix-map=/home/user/openwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/irqbalance-1.6.0=irqbalance-1.6.0 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CPPFLAGS="-I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/include -I/home/user/openwrt/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-9.3.0_glibc_eabi/usr/include -I/home/user/openwrt/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-9.3.0_glibc_eabi/include -I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libiconv-stub/include -I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libintl-stub/include " LDFLAGS="-L/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib -L/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/lib -L/home/user/openwrt/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-9.3.0_glibc_eabi/usr/lib -L/home/user/openwrt/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-
> vfpv4_gcc-9.3.0_glibc_eabi/lib -L/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libiconv-stub/lib -Wl,-rpath-link=/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libiconv-stub/lib -L/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libintl-stub/lib -Wl,-rpath-link=/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libintl-stub/lib -znow -zrelro -lpthread -lintl "  GLIB2_LIBS="/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libglib-2.0.a /home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libiconv-stub/lib/libiconv.a"  ./configure --target=arm-openwrt-linux --host=arm-openwrt-linux --build=x86_64-pc-linux-gnu --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls  --disable-numa --with-libcap_ng=no --with-systemd=no --without-irqbalance-ui --enable-static=glib2 ; fi; )
> configure: WARNING: unrecognized options: --disable-nls
> configure: loading site script /home/user/openwrt/openwrt/include/site/arm
> checking for a BSD-compatible install... /bin/install -c
> checking whether build environment is sane... yes
> checking for arm-openwrt-linux-strip... arm-openwrt-linux-gnueabi-strip
> checking for a thread-safe mkdir -p... /bin/mkdir -p
> checking for gawk... gawk
> checking whether make sets $(MAKE)... yes
> checking whether make supports nested variables... yes
> checking build system type... x86_64-pc-linux-gnu
> checking host system type... arm-openwrt-linux-gnu
> checking how to print strings... printf
> checking for style of include used by make... GNU
> checking for arm-openwrt-linux-gcc... arm-openwrt-linux-gnueabi-gcc
> checking whether the C compiler works... no
> configure: error: in `/home/user/openwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/irqbalance-1.6.0':
> configure: error: C compiler cannot create executables
> See `config.log' for more details
> make[2]: *** [Makefile:72: /home/user/openwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/irqbalance-1.6.0/.configured_a17fb5ef857664f03cd0ce37cc5ea591] Error 77
> make[2]: Leaving directory '/home/user/openwrt/openwrt/feeds/packages/utils/irqbalance'
> time: package/feeds/packages/irqbalance/compile#5.20#0.57#6.65

Anyone an idea?

Have you seen this message?

1 Like

Yes I've seen it. But there is not more there like on compile log.

[...]

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME "irqbalance"
#define PACKAGE_TARNAME "irqbalance"
#define PACKAGE_VERSION "1.6.0"
#define PACKAGE_STRING "irqbalance 1.6.0"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PACKAGE "irqbalance"
#define VERSION "1.6.0"

configure: exit 77

Like error 77 above. :confused:

Here is the whole config.log:

https://controlc.com/59c162bc

Maybe this:

/bin/ld: cannot find -lintl

one of the additions in the patchfile above.

ping @hnyman

1 Like

Haven't yet looked into it.
Sounds like glibc somehow expects full intl libs unlike musl.
(I have never compiled with glibc, so no experience with its quirks.)

You might test adding the typical nls.mk include line to the Makefile.

Ps.

That site dislikes adblockers...

But that linker problem sounds like a probable culprit.

(The stupid things here is that irqbalance does not really require much complex text functions, especially as we have disabled the GUI components. And generally we "disable NLS".)

1 Like

I have a feeling it's due to glib2. With the 2.64.2 update, -lintl gets added through pkgconfig.

1 Like

It was me who posted the github issue you linked to in your first post.

The lines you added from my github issue is what is causing this configure error: libintl.so does not exist in your staging area.and so cannot be linked.

configure:3429: checking whether the C compiler works
configure:3451: arm-openwrt-linux-gnueabi-gcc -O2 -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libiconv-stub/include -I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libintl-stub/include -ffile-prefix-map=/home/user/openwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/irqbalance-1.6.0=irqbalance-1.6.0 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/include -I/home/user/openwrt/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-9.3.0_glibc_eabi/usr/include -I/home/user/openwrt/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-9.3.0_glibc_eabi/include -I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libiconv-stub/include -I/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libintl-stub/include  -L/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib -L/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/lib -L/home/user/openwrt/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-9.3.0_glibc_eabi/usr/lib -L/home/user/openwrt/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-9.3.0_glibc_eabi/lib -L/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libiconv-stub/lib -Wl,-rpath-link=/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libiconv-stub/lib -L/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libintl-stub/lib -Wl,-rpath-link=/home/user/openwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/usr/lib/libintl-stub/lib -znow -zrelro -lpthread -lintl  conftest.c  >&5
/home/user/openwrt/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-9.3.0_glibc_eabi/lib/gcc/arm-openwrt-linux-gnueabi/9.3.0/../../../../arm-openwrt-linux-gnueabi/bin/ld: cannot find -lintl
collect2: error: ld returned 1 exit status
configure:3455: $? = 1
configure:3493: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "irqbalance"
| #define PACKAGE_TARNAME "irqbalance"
| #define PACKAGE_VERSION "1.6.0"
| #define PACKAGE_STRING "irqbalance 1.6.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "irqbalance"
| #define VERSION "1.6.0"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3498: error: in `/home/user/openwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/irqbalance-1.6.0':
configure:3500: error: C compiler cannot create executables
See `config.log' for more details

You could resolve this particular error by including libintl-full in your build configuration. You'll need to add the line PKG_BUILD_DEPENDS:=libintl-full to the top of the Makefile to get it to build libintl and put the libintl.so into your staging directory before it tries to build irqbalance (I should have added this line, but since I always had it in my config, the build system seems to build it first anyway and I didn't notice the omission).

[EDIT: I think you'll need to make that PKG_BUILD_DEPENDS:=gettext-full as the build system uses the directory name rather than the package name in the PKG_BUILD_DEPENDS line]

This error only occurred because of the dependencies and the lines you added which I referred to in the issue I posted on github. If it was not compiling before you added these lines, then you have a different problem.

So, first can you compile it using the vanilla Makefile and post any errors (and the config.log if the configure script errors out).

1 Like

I've been using a heavily customized x86_64 version of Openwrt with glibc for years (first with 15.05 and now with 19.07.2).

The truth is that quite a few packages on Openwrt experience compilation problems and dependency issues when using glibc. Probably because few people are using it due to the difficulties of getting everything built, and so few problem reports are made.

In fact, the current version of 19.07.2 kernel panics on x86_64 with the included version of glibc so I had to bump to 2.30, which in itself required a whole bunch of supplemental patches to make it work.

Hauke implemented similar patches for 2.31 which I think has been pushed to master already, although the packages feed has not been patched with anything, so people trying to build using glibc are likely to experience problems with a number of packages.

I use glibc since I have a bunch of stuff that requires it and also since I favour speed over size: my router is an 8-core C3758 SoC with 16GB of RAM and 250GB of SSD, so I don't care about the space/bloat.

1 Like

I just did a full clean and build, which I had not previously done when compiling irqbalance and got another error this time. Not sure why this error didn't pop up when I just added irqbalance as a module to an already built system.

I needed to add the following patch to fix it as it's assuming that it's linking against the libiconv stub, which is only there if CONFIG_PACKAGE_libiconv is selected, whereas it should link against the full libiconv.a if CONFIG_PACKAGE-libiconv-full is selected.

I'll add this as an issue on github

diff --git a/utils/irqbalance/Makefile b/utils/irqbalance/Makefile
index d0cc583..713448f 100644
--- a/utils/irqbalance/Makefile
+++ b/utils/irqbalance/Makefile
@@ -52,9 +52,15 @@ CONFIGURE_ARGS+= \
        --without-irqbalance-ui \
        --enable-static=glib2
 
+ifeq ($(CONFIG_PACKAGE_libiconv-full),y)
+       LIB_ICONV += "libiconv-full"
+else
+       LIB_ICONV += "libiconv-stub"
+endif
+
 CONFIGURE_VARS += \
        GLIB2_LIBS="$(STAGING_DIR)/usr/lib/libglib-2.0.a \
-               $(STAGING_DIR)/usr/lib/libiconv-stub/lib/libiconv.a"
+               $(STAGING_DIR)/usr/lib/$(LIB_ICONV)/lib/libiconv.a"
 
 define Package/irqbalance/install
        $(INSTALL_DIR) $(1)/usr/sbin

EDIT: the check should probably be ifneq ($(CONFIG_PACKAGE_libiconv-full),) instead

1 Like

or just use nls.mk...

1 Like

I still wonder if the original issue mentioned by @pwned and also @dl12345 was caused by clibc or glib2

@pwned @dl12345
Do you intentionally set the full NLS in your build?
Or do you run otherwise just vanilla config, but just have glibc instead of musl?

You error about "lintl" suggests that you have at least partianlly NLS enabled, and I wonder if that in intentional, or if that is just caused by using glibc (like the topic title suggests).

1 Like

Yeah, earlier there was no glib2 dependency, but the upgrade to 1.6.0 caused the inclusion of that library. As only a few functions are needed, the library is linked statically so that only the needed parts get linked in.

That has caused the line STAGING_DIR)/usr/lib/libiconv-stub/lib/libiconv.a

You are right, that prevents using the full NLS version.

The best solution would likely be to use include/nls.mk in the Makefile like @neheb suggests, and modify the line accordingly, to reference to $(ICONV_PREFIX) instead of the stub

You might test if that fixes it for you.

I haven't really worked with the NLS stuff as none of apps that I use, require NLS functionality.

1 Like

gcc v9, glibc, -O2, binutils 2.32 (without any modifications/patch on irqbalance).

makefile without any modifications (includes already mentioned nls.mk)!:

https://pastebin.com/62Qkk0v5

config log:

https://pastebin.com/ckzZQsg7

compile log:

https://pastebin.com/Gygmdnvc

I'm just adding:

CONFIG_PACKAGE_kmod-nls-cp437=y
CONFIG_PACKAGE_kmod-nls-cp850=y
CONFIG_PACKAGE_kmod-nls-iso8859-1=y
CONFIG_PACKAGE_kmod-nls-iso8859-15=y
CONFIG_PACKAGE_kmod-nls-utf8=y

I do this since I compile OpenWrt by myself. I always used glibc. Because I prefer standards (not because of the "speed"). IMO size does not matter anymore for devices >= Midrange (not exactly I know :wink: ). And yes I'm aware that more code means higher security risks.
Over time I almost always had minor issues like this compiling with glibc. But only minor things like this nls issue. But I never had any issues with codepages before. I do this as a habit since decades (not specific for OpenWrt). For OpenWrt it's not necessary. The only usecase would be writing proper filenames to mounted external drives.
For this case I decided to write sth. Just to indicate that the patch is not working as intended. If there is no fix available I will drop nls for getting irqbalance working.

as there is already the nls.mk include, you could try changing the
$(STAGING_DIR)/usr/lib/libiconv-stub/lib/libiconv.a
to
$STAGING_DIR)/usr/lib/$(ICONV_PREFIX)/lib/libiconv.a
as nls.mk sets that according to the NLS status.

1 Like

I am more interested on your generic OpenWrt config than on the irqbalance logs (as the package just reacts to your toplevel settings or packages.
Is NLS enabled in your OpenWrt config?
What does ./scripts/diffconfig.sh show?

1 Like

Hi hnyman,

thx for reply. I compiled irqbalance again with your modification only. As far as I can see the errors are exactly the same.

config diff (as you requested):
https://pastebin.com/gAZtXnRw

config.log/compile.log (new)
https://pastebin.com/9Mqsm06J
https://pastebin.com/eK0U83P7

EDIT:

My last build with exactly (only made a defconfig for this new build) the same diff as above was:
r12143-b3e86cbb4f_20.029.45466-48749ca
No issues with irqbalance or glibc at this time.

Yes, intentionally set to full NLS

1 Like

Ok, so I've done some more testing.

Firstly, the reason that the compile did not fail with the inconv-full vs iconv-stub issue on my system initially is that there are two packages, procps-ng and dovecot that both have the line PKG_BUILD_DEPENDS:=libiconv, without checking whether iconv-full is set or not.

Because I have package procps-ng selected, libiconv-stub was incorrectly built and present in my staging area. However, after cleaning the system, since procps-ng only got built after irqbalance, libiconv-stub was not there. Hence the error in the clean build case.

So procps-ng and dovecot will need to be modified to check which version of libiconv is being used.

Then, the errors with irqbalance. They're all glib2 functions calling routines in pthread or libintl.

ICONV_PREFIX is actually the full path, so that won't work. The line would need to read $(ICONV_PREFIX)/lib/libiconv.a

The following fixed it correctly for me [EDIT: the DEPENDS:= line should also be made conditional on libiconv-stub vs libiconv-full; I omitted that in the patch below`

iff --git a/utils/irqbalance/Makefile b/utils/irqbalance/Makefile
index d0cc583..ffa5412 100644
--- a/utils/irqbalance/Makefile
+++ b/utils/irqbalance/Makefile
@@ -28,8 +28,13 @@ include $(INCLUDE_DIR)/nls.mk
 
 include $(INCLUDE_DIR)/package.mk
 
+ifneq ($(CONFIG_PACKAGE_libiconv-full),)
+PKG_BUILD_DEPENDS:=glib2 gettext-full 
+else
+PKG_BUILD_DEPENDS:=glib2 gettext
+endif
+
 define Package/irqbalance
-  PKG_BUILD_DEPENDS:=glib2
   SECTION:=utils
   CATEGORY:=Utilities
   DEPENDS:=+libintl-full +libpthread
@@ -43,8 +48,6 @@ define Package/irqbalance/description
  increase performance.
 endef
 
 CONFIGURE_ARGS+= \
        --disable-numa \
        --with-libcap_ng=no \
@@ -54,7 +57,9 @@ CONFIGURE_ARGS+= \
 
 CONFIGURE_VARS += \
        GLIB2_LIBS="$(STAGING_DIR)/usr/lib/libglib-2.0.a \
-               $(STAGING_DIR)/usr/lib/libiconv-stub/lib/libiconv.a"
+               $(ICONV_PREFIX)/lib/libiconv.a \
+               -L$(STAGING_DIR_ROOT)/lib/libpthread -lpthread \
+               -L$(INTL_PREFIX)/lib -lintl"
 
 define Package/irqbalance/install
        $(INSTALL_DIR) $(1)/usr/sbin

Note that pthread cannot be linked statically while libc is linked dynamically. If trying to do so, then the following errors result

libc/root-x86/lib/libpthread.a(pthread_create.o): in function `__pthread_create_2_1':
pthread_create.c:(.text+0x167a): undefined reference to `_dl_stack_flags'
/opt/openwrt/staging_dir/toolchain-x86_64_gcc-8.3.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/8.3.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: pthread_create.c:(.text+0x1f2c): undefined reference to `_dl_stack_flags'
/opt/openwrt/staging_dir/toolchain-x86_64_gcc-8.3.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/8.3.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: /opt/openwrt/staging_dir/target-x86_64_glibc/root-x86/lib/libpthread.a(elision-lock.o): in function `_dl_tunable_set_elision_enable':
elision-lock.c:(.text+0xe2): undefined reference to `_dl_x86_cpu_features'

So this would not work, even if we wanted to link statically

CONFIGURE_VARS += \
    GLIB2_LIBS="$(STAGING_DIR)/usr/lib/libglib-2.0.a \
        $(ICONV_PREFIX)/lib/libiconv.a \
        $(STAGING_DIR_ROOT)/lib/libpthread.a \
        $(INTL_PREFIX)/lib/libintl.a"

@hnyman I'll update the issue on github with this info...

1 Like

Actually, looking at nls.mk it has all the necessary definitions added to TARGET_LDFLAGS already, so the following looks much cleaner

nls.mk adds to PKG_BUILD_DEPENDS appropriately, so the line in the Makefile should just be modified slight to add rather than overwrite it.

# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=irqbalance
PKG_VERSION:=1.6.0
PKG_RELEASE:=7

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/Irqbalance/irqbalance.git
PKG_SOURCE_VERSION:=0348a3bf7db6132b79aee421165db84ee96239aa
PKG_MIRROR_HASH:=ce1cd84cd315492d4260786735eae81e49515ec3eebe652920a7dc57b93c0c2c
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPLv2

PKG_MAINTAINER:=Hannu Nyman <hannu.nyman@iki.fi>

PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=autogen.sh

PKG_BUILD_PARALLEL:=1

include $(INCLUDE_DIR)/nls.mk

include $(INCLUDE_DIR)/package.mk

PKG_BUILD_DEPENDS += glib2

define Package/irqbalance
  SECTION:=utils
  CATEGORY:=Utilities
  DEPENDS:=$(ICONV_DEPENDS) $(INTL_DEPENDS)
  TITLE:=IRQ usage balancing for multi-core systems
  URL:=https://github.com/Irqbalance/irqbalance
endef

define Package/irqbalance/description
 The purpose of irqbalance is to distribute hardware interrupts across
 processors/cores on a multiprocessor/multicore system in order to
 increase performance.
endef

ifeq ($(CONFIG_BUILD_NLS),y)
TARGET_LDFLAGS += -lintl -liconv
endif

ifeq ($(CONFIG_USE_GLIBC),y)
TARGET_LDFLAGS += -lpthread
endif

CONFIGURE_ARGS+= \
	--disable-numa \
	--with-libcap_ng=no \
	--with-systemd=no \
	--without-irqbalance-ui \
	--enable-static=glib2

CONFIGURE_VARS += \
	GLIB2_LIBS="$(STAGING_DIR)/usr/lib/libglib-2.0.a \
		$(TARGET_LDFLAGS)"

define Package/irqbalance/install
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/irqbalance $(1)/usr/sbin/
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/irqbalance.init $(1)/etc/init.d/irqbalance
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_DATA) ./files/irqbalance.config $(1)/etc/config/irqbalance
endef

$(eval $(call BuildPackage,irqbalance))
1 Like

Just for reference. I'm not choosing nls directly on purpose. It's choosen e. g. by filesystem modules which I supplemented with additional languages only.

I have compiled my config from abvoe just without the package "irqbalance" (not a solution I know). But there were no errors. So for my setup there is no crossreference from other packages.