package/libftdi1: fix static build with libusb and -latomic

Use pkg-config to retrieve libusb dependencies such as -latomic and
avoid the following static build failure raised since bump of libusb to
version 1.0.25 in commit aad609936f:

/nvmedata/autobuild/instance-29/output-1/per-package/libftdi1/host/bin/../lib/gcc/sparc-buildroot-linux-uclibc/10.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: /nvmedata/autobuild/instance-29/output-1/per-package/libftdi1/host/sparc-buildroot-linux-uclibc/sysroot/lib/libusb-1.0.a(core.o): in function `libusb_unref_device':
/nvmedata/autobuild/instance-29/output-1/build/libusb-1.0.25/libusb/core.c:1186: undefined reference to `__atomic_fetch_add_4'

Fixes:
 - http://autobuild.buildroot.org/results/1ca7cd85ae60ad4797a6d8a83b2fb51d7eab96d9

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Fabrice Fontaine 2022-12-08 21:23:38 +01:00 committed by Yann E. MORIN
parent 1567fbd72d
commit de82d57b56
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,47 @@
From b5b8fab6063ad90bb5ef05a72708ecde1796bc81 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Fri, 13 May 2022 18:11:50 +0200
Subject: [PATCH] CMakeLists.txt: fix static build with libusb and -latomic
Use pkg-config to retrieve libusb dependencies such as -latomic and
avoid the following static build failure:
/nvmedata/autobuild/instance-29/output-1/per-package/libftdi1/host/bin/../lib/gcc/sparc-buildroot-linux-uclibc/10.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: /nvmedata/autobuild/instance-29/output-1/per-package/libftdi1/host/sparc-buildroot-linux-uclibc/sysroot/lib/libusb-1.0.a(core.o): in function `libusb_unref_device':
/nvmedata/autobuild/instance-29/output-1/build/libusb-1.0.25/libusb/core.c:1186: undefined reference to `__atomic_fetch_add_4'
Fixes:
- http://autobuild.buildroot.org/results/1ca7cd85ae60ad4797a6d8a83b2fb51d7eab96d9
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Retrieved from:
http://developer.intra2net.com/git/?p=libftdi;a=commit;h=b5b8fab6063ad90bb5ef05a72708ecde1796bc81]
---
CMakeLists.txt | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 58f664a..d20aa94 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,8 +25,16 @@ if(${CMAKE_BUILD_TYPE} STREQUAL Debug)
endif(${CMAKE_BUILD_TYPE} STREQUAL Debug)
# find libusb
-find_package ( USB1 REQUIRED )
-include_directories ( ${LIBUSB_INCLUDE_DIR} )
+find_package( PkgConfig )
+if (PkgConfig_FOUND)
+ pkg_check_modules( LIBUSB libusb-1.0 )
+ if (LIBUSB_FOUND)
+ include_directories ( ${LIBUSB_INCLUDE_DIRS} )
+ else()
+ find_package ( USB1 REQUIRED )
+ include_directories ( ${LIBUSB_INCLUDE_DIR} )
+ endif()
+endif()
# Find Boost
if (FTDIPP OR BUILD_TESTS)
--
1.7.1

View File

@ -8,7 +8,7 @@ LIBFTDI1_VERSION = 1.5
LIBFTDI1_SOURCE = libftdi1-$(LIBFTDI1_VERSION).tar.bz2
LIBFTDI1_SITE = http://www.intra2net.com/en/developer/libftdi/download
LIBFTDI1_INSTALL_STAGING = YES
LIBFTDI1_DEPENDENCIES = libusb
LIBFTDI1_DEPENDENCIES = host-pkgconf libusb
LIBFTDI1_LICENSE = LGPL-2.1 (libftdi1), MIT (libftdi1)
LIBFTDI1_LICENSE_FILES = LICENSE COPYING.LIB
LIBFTDI1_CONFIG_SCRIPTS = libftdi1-config