Skip to contentSkip to conversation

json-spirit: Add -latomic to LDFLAGS

PATCH In review [email protected] 3 participants 7 messages Aug 10, 2017 – Aug 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 json-spirit: Add -latomic to LDFLAGS

From: Ming Liu <[email protected]>

This fixes following errors when compiling with clang:

| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_load_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_compare_exchange_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_fetch_sub_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_fetch_add_4'
---
 meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +2 -0
index 53bbf7e..2f456bf 100644
@@ -17,6 +17,8 @@ S = "${WORKDIR}/json_spirit_v${PV}"
 
 DEPENDS = "boost"
 
+LDFLAGS += "-Wl,--as-needed -latomic -Wl,--no-as-needed"
+
 inherit cmake
 
 FILES_${PN}-dev += "${datadir}/cmake/Modules/FindLibJsonSpirit.cmake"
Signature · 1 line
2.7.4
#1 lore raw
Quoted 18 lines · On 8/10/17 8:12 AM, [email protected] wrote:

From: Ming Liu <[email protected]>

This fixes following errors when compiling with clang:

| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_load_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_compare_exchange_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_fetch_sub_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_fetch_add_4'
---
 meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +0 -0
index 53bbf7e..2f456bf 100644

meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb S = "${WORKDIR}/json_spirit_v${PV}" · line 20

Quoted 4 lines
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +1 -0
@@ -17,6 +17,8 @@ S = "${WORKDIR}/json_spirit_v${PV}"
 
 DEPENDS = "boost"
 
+LDFLAGS += "-Wl,--as-needed -latomic -Wl,--no-as-needed"

Do we need --as-needed

Quoted 5 lines
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +1 -0
+
 inherit cmake
 
 FILES_${PN}-dev += "${datadir}/cmake/Modules/FindLibJsonSpirit.cmake"
author
#2 lore raw

Hi, Khem:

I added that since I observed the error only on a armv5e machine, error did not show up on cortexa8/x86_64 machines, so I attempted to guess that option would not be always needed, for instance, if some ARCH support atomic instructions.

//Ming Liu

2017-08-10 17:19 GMT+02:00 Khem Raj <[email protected]>:

Quoted 39 lines · On 8/10/17 8:12 AM, [email protected] wrote:
Quoted 4 lines

From: Ming Liu <[email protected]>

This fixes following errors when compiling with clang:
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to

'__atomic_load_4'

Quoted 1 line

| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to

'__atomic_compare_exchange_4'

Quoted 1 line

| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to

'__atomic_fetch_sub_4'

Quoted 1 line

| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to

'__atomic_fetch_add_4'

Review

Quoted 7 lines
---
 meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb | 2 ++
 1 file changed, 2 insertions(+)
(quoted diff) +0 -0

b/meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb

meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb S = "${WORKDIR}/json_spirit_v${PV}" · line 20

Quoted 8 lines

index 53bbf7e..2f456bf 100644

meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +1 -0
@@ -17,6 +17,8 @@ S = "${WORKDIR}/json_spirit_v${PV}"
 
 DEPENDS = "boost"
 
+LDFLAGS += "-Wl,--as-needed -latomic -Wl,--no-as-needed"

Do we need --as-needed

Quoted 5 lines
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +1 -0
+
 inherit cmake
 
 FILES_${PN}-dev += "${datadir}/cmake/Modules/FindLibJsonSpirit.cmake"
#3 lore raw
Quoted 6 lines · Ming Liu

Hi, Khem:

I added that since I observed the error only on a armv5e machine, error did not show up on cortexa8/x86_64 machines, so I attempted to guess that option would not be always needed, for instance, if some ARCH support atomic instructions.

We should add it for armv5 alone then, for other arches, gcc does provide needed atomics.

Quoted 44 lines

//Ming Liu

2017-08-10 17:19 GMT+02:00 Khem Raj <[email protected]>:

Quoted 39 lines · On 8/10/17 8:12 AM, [email protected] wrote:
Quoted 23 lines

From: Ming Liu <[email protected]>

This fixes following errors when compiling with clang:
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_load_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_compare_exchange_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_fetch_sub_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_fetch_add_4'

---
 meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +0 -0
index 53bbf7e..2f456bf 100644

meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb S = "${WORKDIR}/json_spirit_v${PV}" · line 20

Quoted 4 lines
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +1 -0
@@ -17,6 +17,8 @@ S = "${WORKDIR}/json_spirit_v${PV}"
 
 DEPENDS = "boost"
 
+LDFLAGS += "-Wl,--as-needed -latomic -Wl,--no-as-needed"

Do we need --as-needed

Quoted 5 lines
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +1 -0
+
 inherit cmake
 
 FILES_${PN}-dev += "${datadir}/cmake/Modules/FindLibJsonSpirit.cmake"
author
#4 lore raw

Hi, Khem:

OK, got it, will send a V2 soon.

//Ming Liu

2017-08-10 17:58 GMT+02:00 Khem Raj <[email protected]>:

Quoted 63 lines · Ming Liu
Quoted 3 lines

Hi, Khem:

I added that since I observed the error only on a armv5e machine, error

did

Quoted 1 line

not show up on cortexa8/x86_64 machines, so I attempted to guess that

option

Quoted 2 lines

would not be always needed, for instance, if some ARCH support atomic instructions.

We should add it for armv5 alone then, for other arches, gcc does provide needed atomics.

Quoted 10 lines

//Ming Liu

2017-08-10 17:19 GMT+02:00 Khem Raj <[email protected]>:

Quoted 6 lines · On 8/10/17 8:12 AM, [email protected] wrote:
Quoted 4 lines

From: Ming Liu <[email protected]>

This fixes following errors when compiling with clang:
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference

to

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

'__atomic_load_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference

to

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

'__atomic_compare_exchange_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference

to

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

'__atomic_fetch_sub_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference

to

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

'__atomic_fetch_add_4'

---
 meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +0 -0
index 53bbf7e..2f456bf 100644
@@ -17,6 +17,8 @@ S = "${WORKDIR}/json_spirit_v${PV}"
 
 DEPENDS = "boost"
 
Quoted 8 lines
Quoted 8 lines

meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb S = "${WORKDIR}/json_spirit_v${PV}" · line 20

Quoted 1 line
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +1 -0
+LDFLAGS += "-Wl,--as-needed -latomic -Wl,--no-as-needed"

Do we need --as-needed

Quoted 4 lines
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +1 -0
+
 inherit cmake
 
 FILES_${PN}-dev += "${datadir}/cmake/Modules/

FindLibJsonSpirit.cmake"

Quoted 4 lines
Quoted 3 lines
Quoted 1 line
#5 lore raw
In reply to Khem Raj
Quoted 10 lines · Khem Raj
Quoted 6 lines · Ming Liu

Hi, Khem:

I added that since I observed the error only on a armv5e machine, error did not show up on cortexa8/x86_64 machines, so I attempted to guess that option would not be always needed, for instance, if some ARCH support atomic instructions.

We should add it for armv5 alone then, for other arches, gcc does provide needed atomics.

Is that a design decision for the armv5 BSP or gcc or is it a bug? A pointer to what code determines that would be nice if easy.

../Randy

Quoted 45 lines
Quoted 45 lines

//Ming Liu

2017-08-10 17:19 GMT+02:00 Khem Raj <[email protected]>:

Quoted 39 lines · On 8/10/17 8:12 AM, [email protected] wrote:
Quoted 23 lines

From: Ming Liu <[email protected]>

This fixes following errors when compiling with clang:
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_load_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_compare_exchange_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_fetch_sub_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_fetch_add_4'

---
  meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb | 2 ++
  1 file changed, 2 insertions(+)
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +0 -0
index 53bbf7e..2f456bf 100644

meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb S = "${WORKDIR}/json_spirit_v${PV}" · line 20

Quoted 4 lines
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +1 -0
@@ -17,6 +17,8 @@ S = "${WORKDIR}/json_spirit_v${PV}"
 
  DEPENDS = "boost"
 
+LDFLAGS += "-Wl,--as-needed -latomic -Wl,--no-as-needed"

Do we need --as-needed

Quoted 5 lines
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +1 -0
+
  inherit cmake
 
  FILES_${PN}-dev += "${datadir}/cmake/Modules/FindLibJsonSpirit.cmake"
Signature · 2 lines
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350 | 350 Terry Fox Drive, Suite 200, Ottawa, ON, Canada, K2K 2W5
#6 lore raw
Quoted 14 lines · Randy MacLeod
Quoted 13 lines · Khem Raj
Quoted 9 lines · Ming Liu

Hi, Khem:

I added that since I observed the error only on a armv5e machine, error did
not show up on cortexa8/x86_64 machines, so I attempted to guess that option
would not be always needed, for instance, if some ARCH support atomic instructions.

Quoted 5 lines
Quoted 2 lines

We should add it for armv5 alone then, for other arches, gcc does provide needed atomics.

Is that a design decision for the armv5 BSP or gcc or is it a bug?

Its just missing implementation and applications should have detected that in configure and taken actions accordingly.

Quoted 58 lines

A pointer to what code determines that would be nice if easy.

../Randy

Quoted 40 lines
Quoted 40 lines

//Ming Liu

2017-08-10 17:19 GMT+02:00 Khem Raj <[email protected]>:

Quoted 35 lines · On 8/10/17 8:12 AM, [email protected] wrote:
Quoted 24 lines

From: Ming Liu <[email protected]>

This fixes following errors when compiling with clang:
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_load_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_compare_exchange_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_fetch_sub_4'
| ../json_spirit/libjson_spirit.so.4.0.8: error: undefined reference to '__atomic_fetch_add_4'

---
  meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb | 2 ++
  1 file changed, 2 insertions(+)
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +0 -0
index 53bbf7e..2f456bf 100644

meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb S = "${WORKDIR}/json_spirit_v${PV}" · line 20

Quoted 4 lines
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +1 -0
@@ -17,6 +17,8 @@ S = "${WORKDIR}/json_spirit_v${PV}"
 
  DEPENDS = "boost"
 
+LDFLAGS += "-Wl,--as-needed -latomic -Wl,--no-as-needed"

Do we need --as-needed

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb S = "${WORKDIR}/json_spirit_v${PV}" · line 24

Quoted 5 lines
meta-oe/recipes-devtools/json-spirit/json-spirit_4.08.bb +1 -0
+
  inherit cmake
 
  FILES_${PN}-dev += "${datadir}/cmake/Modules/FindLibJsonSpirit.cmake"

--
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350 | 350 Terry Fox Drive, Suite 200, Ottawa, ON, Canada, K2K 2W5