Project

General

Profile

Bug #3222

gcc - undefined reference to '__atomic_load' (missing libatomic?)

Added by mneumann about 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Userland
Target version:
Start date:
02/08/2020
Due date:
% Done:

0%

Estimated time:

Description

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.

Also available in: Atom PDF