Skip to contentSkip to conversation

meta-riscv: building curl, "undefined reference to '__atomic_exchange_1'

yocto Robert P. J. Day 2 participants 7 messages Jul 7, 2022 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 5 lines · Robert P. J. Day

on admittedly unsupported ubuntu 22.04 platform but it's clear this
is a known issue as it's pretty much identical to what one reads here:

https://github.com/advancedtelematic/aktualizr/issues/1427

Quoted 8 lines

the explanation being that, "not every atomic operation is currently supported by GCC on RISC-V."

oddly, building a riscv64 core-image-minimal once upon a time on
fedora worked just fine, so i'm assuming a difference in gcc versions is what is causing this.

what is the recommended workaround for this?

another data point, matches exactly what i'm referring to:

https://github.com/curl/curl/issues/9055

rday

#2 lore raw
Quoted 16 lines · Robert P. J. Day
Quoted 12 lines · Robert P. J. Day

on admittedly unsupported ubuntu 22.04 platform but it's clear this
is a known issue as it's pretty much identical to what one reads here:

https://github.com/advancedtelematic/aktualizr/issues/1427

the explanation being that, "not every atomic operation is currently supported by GCC on RISC-V."

oddly, building a riscv64 core-image-minimal once upon a time on
fedora worked just fine, so i'm assuming a difference in gcc versions is what is causing this.

Quoted 6 lines
Quoted 1 line

what is the recommended workaround for this?

another data point, matches exactly what i'm referring to:

https://github.com/curl/curl/issues/9055

does backporting

https://github.com/curl/curl/commit/50efb0822aa0e0ab165158dd0a26e65a2290e6d2

to curl help ?

Quoted 11 lines

rday

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
You automatically follow any topics you start or reply to. View/Reply Online (#57470): https://lists.yoctoproject.org/g/yocto/message/57470
Mute This Topic: https://lists.yoctoproject.org/mt/92225230/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 21 lines · Khem Raj
Quoted 20 lines · Robert P. J. Day
Quoted 5 lines · Robert P. J. Day

on admittedly unsupported ubuntu 22.04 platform but it's clear this
is a known issue as it's pretty much identical to what one reads here:

https://github.com/advancedtelematic/aktualizr/issues/1427

Quoted 8 lines

the explanation being that, "not every atomic operation is currently supported by GCC on RISC-V."

oddly, building a riscv64 core-image-minimal once upon a time on
fedora worked just fine, so i'm assuming a difference in gcc versions is what is causing this.

what is the recommended workaround for this?

another data point, matches exactly what i'm referring to:

Quoted 8 lines
Quoted 2 lines

https://github.com/curl/curl/issues/9055

does backporting

https://github.com/curl/curl/commit/50efb0822aa0e0ab165158dd0a26e65a2290e6d2

to curl help ?

it does indeed fix the curl build error, thanks. i haven't tested
its operation yet, but getting a build was all i was after at the moment.

rday

#4 lore raw
In reply to Khem Raj
Quoted 21 lines · Khem Raj
Quoted 20 lines · Robert P. J. Day
Quoted 5 lines · Robert P. J. Day

on admittedly unsupported ubuntu 22.04 platform but it's clear this
is a known issue as it's pretty much identical to what one reads here:

https://github.com/advancedtelematic/aktualizr/issues/1427

Quoted 8 lines

the explanation being that, "not every atomic operation is currently supported by GCC on RISC-V."

oddly, building a riscv64 core-image-minimal once upon a time on
fedora worked just fine, so i'm assuming a difference in gcc versions is what is causing this.

what is the recommended workaround for this?

another data point, matches exactly what i'm referring to:

Quoted 8 lines
Quoted 2 lines

https://github.com/curl/curl/issues/9055

does backporting

https://github.com/curl/curl/commit/50efb0822aa0e0ab165158dd0a26e65a2290e6d2

to curl help ?

as i read it, this issue is also related to -pthread versus
-lpthread:

https://blog.jiejiss.com/A-RISC-V-gcc-pitfall-revealed-by-a-glibc-update/

rday

#5 lore raw
Quoted 27 lines · Robert P. J. Day
Quoted 24 lines · Khem Raj
Quoted 22 lines · Robert P. J. Day
Quoted 5 lines · Robert P. J. Day

on admittedly unsupported ubuntu 22.04 platform but it's clear this
is a known issue as it's pretty much identical to what one reads here:

https://github.com/advancedtelematic/aktualizr/issues/1427

Quoted 8 lines

the explanation being that, "not every atomic operation is currently supported by GCC on RISC-V."

oddly, building a riscv64 core-image-minimal once upon a time on
fedora worked just fine, so i'm assuming a difference in gcc versions is what is causing this.

what is the recommended workaround for this?

another data point, matches exactly what i'm referring to:

https://github.com/curl/curl/issues/9055

Quoted 9 lines
Quoted 5 lines

does backporting

https://github.com/curl/curl/commit/50efb0822aa0e0ab165158dd0a26e65a2290e6d2

to curl help ?

as i read it, this issue is also related to -pthread versus
-lpthread:

this would mean that you want to rely on side effects of -pthread which may work with gcc but may not
work with clang or other compiler drivers. The issue you have is that some variables are needing atomics
and solution is either you link with libatomic or avoid using the code which needs them

Quoted 4 lines

https://blog.jiejiss.com/A-RISC-V-gcc-pitfall-revealed-by-a-glibc-update/

rday

#6 lore raw
Quoted 38 lines · Khem Raj
Quoted 27 lines · Robert P. J. Day
Quoted 24 lines · Khem Raj
Quoted 22 lines · Robert P. J. Day
Quoted 5 lines · Robert P. J. Day

on admittedly unsupported ubuntu 22.04 platform but it's clear this
is a known issue as it's pretty much identical to what one reads here:

https://github.com/advancedtelematic/aktualizr/issues/1427

Quoted 8 lines

the explanation being that, "not every atomic operation is currently supported by GCC on RISC-V."

oddly, building a riscv64 core-image-minimal once upon a time on
fedora worked just fine, so i'm assuming a difference in gcc versions is what is causing this.

what is the recommended workaround for this?

another data point, matches exactly what i'm referring to:

https://github.com/curl/curl/issues/9055

Quoted 9 lines
Quoted 5 lines

does backporting

https://github.com/curl/curl/commit/50efb0822aa0e0ab165158dd0a26e65a2290e6d2

to curl help ?

as i read it, this issue is also related to -pthread versus
-lpthread:

Quoted 8 lines

this would mean that you want to rely on side effects of -pthread which may work with gcc but may not
work with clang or other compiler drivers. The issue you have is that some variables are needing atomics
and solution is either you link with libatomic or avoid using the code which needs them

Quoted 1 line

https://blog.jiejiss.com/A-RISC-V-gcc-pitfall-revealed-by-a-glibc-update/

so while i'm still trying to wrap my head around all this, what
*would* be the ideal resolution for this? the link above suggests the simple solution of introducing a gcc config option "--always-link-libatomic". would that solve all this in a general way, not just for RISC-V?

rday

#7 lore raw
Quoted 56 lines · Robert P. J. Day
Quoted 1 line · Khem Raj

On Thu, Jul 7, 2022 at 1:06 PM Robert P. J. Day <[email protected]>

Quoted 4 lines · wrote:
Quoted 4 lines · Khem Raj
Quoted 2 lines

On Thu, Jul 7, 2022 at 6:14 AM Robert P. J. Day <

Quoted 5 lines · [email protected]> wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · Robert P. J. Day
Quoted 3 lines

on admittedly unsupported ubuntu 22.04 platform but it's clear

this

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

is a known issue as it's pretty much identical to what one reads

here:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

https://github.com/advancedtelematic/aktualizr/issues/1427

the explanation being that, "not every atomic operation is

currently

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

supported by GCC on RISC-V."

oddly, building a riscv64 core-image-minimal once upon a time

on

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

fedora worked just fine, so i'm assuming a difference in gcc

versions

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

is what is causing this.

what is the recommended workaround for this?

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

another data point, matches exactly what i'm referring to:

https://github.com/curl/curl/issues/9055

does backporting

https://github.com/curl/curl/commit/50efb0822aa0e0ab165158dd0a26e65a2290e6d2

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

to curl help ?

as i read it, this issue is also related to -pthread versus
-lpthread:

Quoted 8 lines

this would mean that you want to rely on side effects of -pthread which may work with gcc but may not
work with clang or other compiler drivers. The issue you have is that some variables are needing atomics
and solution is either you link with libatomic or avoid using the code which needs them

Quoted 1 line
Quoted 7 lines

https://blog.jiejiss.com/A-RISC-V-gcc-pitfall-revealed-by-a-glibc-update/

so while i'm still trying to wrap my head around all this, what
*would* be the ideal resolution for this? the link above suggests the simple solution of introducing a gcc config option "--always-link-libatomic". would that solve all this in a general way, not just for RISC-V?

Probably, but again if you need a function from a library you include it on linker cmdline if it’s intrinsics then compiler driver doing the needed is best way
Preferably without introducing compiler specific options

Quoted 4 lines

rday