Skip to content

uspd: remove '#define __unused' to avoid conflicts with musl on aarch64

Ghost User requested to merge bugfix/rename_unused_attribute into devel

Hello @vdutta :)

This is a very small bugfix for uspd, adding an extra underscore to __unused in src/common.h, which avoids conflicts with musl when targeting aarch64. I did the simplest fix as possible, although I'm not sure that this kind of problem will never happen again in the future even with this change. Let me know if you need something more descriptive or if you need more info. Commit message follows:

During efforts to port IOPSYSWRT to the Raspberry Pi 4 (at least, 64-bit image variants), there was a build failure with uspd.

Related build logs:

make[5]: Entering directory '/home/oskar/dev/iopsyswrt-clean/build_dir/target-aarch64_cortex-a72_musl/uspd-2.0.4/src'
ccache_cc -Os -pipe -g3 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap/home/oskar/dev/iopsyswrt-clean/build_dir/target-aarch64_cortex-a72_musl/uspd-2.0.4:uspd-2.0.4 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I/home/oskar/dev/iopsyswrt-clean/staging_dir/target-aarch64_cortex-a72_musl/usr/include -D_GNU_SOURCE  -I/home/oskar/dev/iopsyswrt-clean/staging_dir/target-aarch64_cortex-a72_musl/usr/include -I/home/oskar/dev/iopsyswrt-clean/staging_dir/target-aarch64_cortex-a72_musl/include -I/home/oskar/dev/iopsyswrt-clean/staging_dir/toolchain-aarch64_cortex-a72_gcc-7.5.0_musl/usr/include -I/home/oskar/dev/iopsyswrt-clean/staging_dir/toolchain-aarch64_cortex-a72_gcc-7.5.0_musl/include/fortify -I/home/oskar/dev/iopsyswrt-clean/staging_dir/toolchain-aarch64_cortex-a72_gcc-7.5.0_musl/include  -fstrict-aliasing -Wall -Wextra -Werror -Wformat -Wformat-signedness -c -o common.o common.c
In file included from /home/oskar/dev/iopsyswrt-clean/staging_dir/toolchain-aarch64_cortex-a72_gcc-7.5.0_musl/include/sys/stat.h:23:0,
                 from /home/oskar/dev/iopsyswrt-clean/staging_dir/target-aarch64_cortex-a72_musl/usr/include/libbbf_api/dmcommon.h:46,
                 from /home/oskar/dev/iopsyswrt-clean/staging_dir/target-aarch64_cortex-a72_musl/usr/include/libbbfdm/dmbbfcommon.h:12,
                 from common.c:25:
/home/oskar/dev/iopsyswrt-clean/staging_dir/toolchain-aarch64_cortex-a72_gcc-7.5.0_musl/include/bits/stat.h:17:19: error: expected identifier or '(' before '[' token
  unsigned __unused[2];
                   ^

This means that:

  • __unused is defined as an attribute in uspd
  • __unused is a field name in one of musl headers (aarch64-specific bits/stat.h)

This causes conflicts in-between the two, thus the build failure. This patch fixes it by slightly renaming the '__unused' #define to '___unused' in uspd.

Edited by Ghost User

Merge request reports