[DragonFlyBSD - Bug #3222] (Resolved) gcc - undefined reference to '__atomic_load' (missing libatomic?)

liweitianux bugtracker-admin at leaf.dragonflybsd.org
Thu Oct 22 21:21:55 PDT 2026


Issue #3222 has been updated by liweitianux.

Status changed from New to Resolved
Assignee set to liweitianux

Added @libatomic@ to gcc120 and the test program now works.

----------------------------------------
Bug #3222: gcc - undefined reference to '__atomic_load' (missing libatomic?)
http://bugs.dragonflybsd.org/issues/3222#change-14908

* Author: mneumann
* Status: Resolved
* Priority: Normal
* Assignee: liweitianux
* Category: Userland
* Target version: 6.4
* Start date: 2020-02-08
----------------------------------------
I can't compile the following C11 program:

// atomic_test.c
#include <stdio.h>
#include <complex.h>
#include <stdatomic.h>

int main(void)
{
    _Atomic long double _Complex x; 
    printf("(%Lf,%Lf)\n",creall(x), cimagl(x));
    return 0;
}

> cc -std=c11 atomic_test.c
/tmp//ccTm73vw.o:atomic_test.c:function main: error: undefined reference to '__atomic_load'
/tmp//ccTm73vw.o:atomic_test.c:function main: error: undefined reference to '__atomic_load'
collect2: error: ld returned 1 exit status

On my Linux system, I can link in -latomic:

> cc -std=c11 atomic_test.c -latomic

But it seems this got removed from DragonFly's gcc8. I try to compile the Pony compiler ponyc,
which requires these atomic ops.




-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account


More information about the Bugs mailing list