Skip to contentSkip to conversation

opensaf: Add -latomic to LDFLAGS

PATCH In review [email protected] 2 participants 2 messages May 22, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 opensaf: Add -latomic to LDFLAGS

From: Mingli Yu <[email protected]>

* Add "-Wl,--as-needed -latomic -Wl,--no-as-needed" to LDFLAGS to let the libatomic handled automatically if required to fix below build error as atomic operations on some arch such as x86 are supplied by the compiler. For other arch which lacks the instructions, a standardized external call provided by external library libatomic will be made to perform the operation.

  | src/amf/amfd/bin_osafamfd-main.o: In function `std::__atomic_base<unsigned long long>::load(std::memory_order) const':
  | $Prj/build/tmp/work/ppc7400-wrs-linux/opensaf/5.2.0-r0/recipe-sysroot/usr/include/c++/6.3.0/bits/atomic_base.h:396: undefined reference to `__atomic_load_8'
  | $Prj/build/tmp/work/ppc7400-wrs-linux/opensaf/5.2.0-r0/recipe-sysroot/usr/include/c++/6.3.0/bits/atomic_base.h:396: undefined reference to `__atomic_load_8'
  | collect2: error: ld returned 1 exit status
  | make[2]: *** [Makefile:8200: bin/osafamfd] Error 1
  | make[2]: *** Waiting for unfinished jobs....
  | make[2]: Leaving directory '$Prj/build/tmp/work/ppc7400-wrs-linux/opensaf/5.2.0-r0/build'
  | make[1]: *** [Makefile:19749: all-recursive] Error 1
  | make[1]: Leaving directory '$Prj/build/tmp/work/ppc7400-wrs-linux/opensaf/5.2.0-r0/build'
  | make: *** [Makefile:6175: all] Error 2

Reference: https://gcc.gnu.org/wiki/Atomic/GCCMM/LIbrary#line-23

---
 meta-networking/recipes-daemons/opensaf/opensaf_5.2.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-networking/recipes-daemons/opensaf/opensaf_5.2.0.bb +2 -0
index babf03e..be79ba8 100644
@@ -43,6 +43,8 @@ PACKAGECONFIG_append = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' sys
 
 PKGLIBDIR="${libdir}"
 
+LDFLAGS += "-Wl,--as-needed -latomic -Wl,--no-as-needed"
+
 do_install_append() {
     cp -av --no-preserve=ownership ${B}/lib/.libs/*.so* ${D}${libdir}
     rm -fr "${D}${localstatedir}/lock"
Signature · 1 line
2.8.1
#1 lore raw
Quoted 33 lines · On Mon, May 22, 2017 at 2:42 AM, <[email protected]> wrote:

From: Mingli Yu <[email protected]>

* Add "-Wl,--as-needed -latomic -Wl,--no-as-needed" to LDFLAGS to let the libatomic handled automatically if required to fix below build error as atomic operations on some arch such as x86 are supplied by the compiler. For other arch which lacks the instructions, a standardized external call provided by external library libatomic will be made to perform the operation.

  | src/amf/amfd/bin_osafamfd-main.o: In function `std::__atomic_base<unsigned long long>::load(std::memory_order) const':
  | $Prj/build/tmp/work/ppc7400-wrs-linux/opensaf/5.2.0-r0/recipe-sysroot/usr/include/c++/6.3.0/bits/atomic_base.h:396: undefined reference to `__atomic_load_8'
  | $Prj/build/tmp/work/ppc7400-wrs-linux/opensaf/5.2.0-r0/recipe-sysroot/usr/include/c++/6.3.0/bits/atomic_base.h:396: undefined reference to `__atomic_load_8'
  | collect2: error: ld returned 1 exit status
  | make[2]: *** [Makefile:8200: bin/osafamfd] Error 1
  | make[2]: *** Waiting for unfinished jobs....
  | make[2]: Leaving directory '$Prj/build/tmp/work/ppc7400-wrs-linux/opensaf/5.2.0-r0/build'
  | make[1]: *** [Makefile:19749: all-recursive] Error 1
  | make[1]: Leaving directory '$Prj/build/tmp/work/ppc7400-wrs-linux/opensaf/5.2.0-r0/build'
  | make: *** [Makefile:6175: all] Error 2

Reference: https://gcc.gnu.org/wiki/Atomic/GCCMM/LIbrary#line-23

---
 meta-networking/recipes-daemons/opensaf/opensaf_5.2.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-networking/recipes-daemons/opensaf/opensaf_5.2.0.bb +0 -0
index babf03e..be79ba8 100644

meta-networking/recipes-daemons/opensaf/opensaf_5.2.0.bb PACKAGECONFIG_append = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' sys · line 47

Quoted 5 lines
meta-networking/recipes-daemons/opensaf/opensaf_5.2.0.bb +2 -0
@@ -43,6 +43,8 @@ PACKAGECONFIG_append = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' sys
 
 PKGLIBDIR="${libdir}"
 
+LDFLAGS += "-Wl,--as-needed -latomic -Wl,--no-as-needed"
+

it would be better if the configury could detect libatomic and then we could use a PACKAGECONFIG knob to control it based on if libatomic is avaliable in a given combination or not.

Quoted 11 lines
meta-networking/recipes-daemons/opensaf/opensaf_5.2.0.bb +0 -1
 do_install_append() {
     cp -av --no-preserve=ownership ${B}/lib/.libs/*.so* ${D}${libdir}
     rm -fr "${D}${localstatedir}/lock"
--

2.8.1

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel