You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.5 KiB

lttng-tools: musl compile fixes Add two patches to address three distinct build problems spotted by our build bots when compiling lttng-tools: 1) unconditional use of `__GLIBC_PREREQ` On musl based toolchains there is no such macro defined, leading to the following preprocessor error: CC compat-epoll.lo In file included from compat-epoll.c:33:0: poll.h:76:19: error: missing binary operator before token "(" #if __GLIBC_PREREQ(2, 9) 2) undeclared `mode_t` type On musl based toolchains the `mode_t` type is not implicitely defined through other includes, leading to the following compile error: CC hashtable.lo In file included from ../../../src/common/common.h:24:0, from hashtable.c:24: ../../../src/common/runas.h:25:46: error: unknown type name 'mode_t' int run_as_mkdir_recursive(const char *path, mode_t mode, uid_t uid, gid_t gid); ^ ../../../src/common/runas.h:26:36: error: unknown type name 'mode_t' int run_as_mkdir(const char *path, mode_t mode, uid_t uid, gid_t gid); ^ ../../../src/common/runas.h:27:46: error: unknown type name 'mode_t' int run_as_open(const char *path, int flags, mode_t mode, uid_t uid, gid_t gid); ^ 3) multiple definitions The header files declare several `const char *` pointers which are initialized in various `*.c` files later on. Due to a missing `extern` declaration in the header, the final linking of the executables fails with errors such as: CCLD lttng ../../../src/common/.libs/libcommon.a(mi-lttng.o):(.data.rel.ro.local+0x0): multiple definition of `mi_lttng_element_snapshots' commands/enable_events.o:(.bss+0x18): first defined here collect2: error: ld returned 1 exit status This commits addresses these issues with two patches, `100-musl-compat.patch` fixes issue 1 by declaring a fallback dummy declaration of `__GLIBC_PREREQ` and issue 2 by explicitely including `sys/stat.h` which provides `mode_t` according to POSIX. The second patch, `200-use-extern.patch` declares all char pointers in the header file as `extern`, fixing the observed linker errors. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
9 years ago
  1. #
  2. # Copyright (C) 2013-2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=lttng-tools
  9. PKG_VERSION:=2.6.0
  10. PKG_RELEASE:=2
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  12. PKG_SOURCE_URL:=https://lttng.org/files/$(PKG_NAME)/
  13. PKG_MD5SUM:=0478f60395f9564b4a19f45ce7b7f3df
  14. PKG_LICENSE:=LGPL-2.1 GPL-2.0
  15. PKG_LICENSE_FILES:=COPYING
  16. PKG_MAINTAINER:=Nicolas Thill <nico@openwrt.org>
  17. PKG_FIXUP:=autoreconf
  18. PKG_USE_MIPS16:=0
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_INSTALL:=1
  21. include $(INCLUDE_DIR)/package.mk
  22. define Package/lttng-tools
  23. SECTION:=devel
  24. CATEGORY:=Development
  25. TITLE:=Linux Trace Toolkit: next generation (tools)
  26. URL:=https://lttng.org/
  27. DEPENDS:= +lttng-ust +libpopt +libxml2
  28. endef
  29. CONFIGURE_ARGS += --disable-kmod
  30. TARGET_LDFLAGS += -lurcu-bp
  31. MAKE_FLAGS += V="$(V)"
  32. define Build/InstallDev
  33. $(INSTALL_DIR) $(1)/usr/include
  34. $(CP) $(PKG_INSTALL_DIR)/usr/include/lttng $(1)/usr/include/
  35. $(INSTALL_DIR) $(1)/usr/lib
  36. $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblttng-ctl*.{a,so*} $(1)/usr/lib/
  37. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  38. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lttng-ctl.pc $(1)/usr/lib/pkgconfig/
  39. endef
  40. define Package/lttng-tools/install
  41. $(INSTALL_DIR) $(1)/usr/lib
  42. $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblttng-ctl*.so.* $(1)/usr/lib/
  43. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lttng $(1)/usr/lib/
  44. $(INSTALL_DIR) $(1)/usr/bin
  45. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lttng* $(1)/usr/bin/
  46. endef
  47. $(eval $(call BuildPackage,lttng-tools))