0

Hello everyone.

I am trying to compile simple C code.

#include <stdio.h>
void main()
{
printf("Hello world\n");
}

But I get this error.

$ gcc main.c
/data/data/com.termux/files/usr/bin/ld: /data/data/com.termux/files/usr/bin/../lib/gcc/aarch64-unknown-linux-gnu/10.2.0/libgcc.a(lse-init.o): undefined reference to symbol '__getauxval@@GLIBC_2.17'
/data/data/com.termux/files/usr/bin/ld: /data/data/com.termux/files/usr/lib/libc.so.6: error adding symbols: DSO missing from command line                                       
collect2: error: ld returned 1 exit status

I understand that the error occurs due to the fact that the compidator cannot find the font, but this is not accurate. And the same error occurs in C++.

How do I fix this error?

Retired Ninja
  • 4,785
  • 3
  • 25
  • 35
Max Ivan
  • 16
  • 1
  • 3
  • What version of `gcc` are you using and on what platform? Probably not related to this issue, but `void main()` isn't a valid signature. https://stackoverflow.com/questions/204476/what-should-main-return-in-c-and-c – Retired Ninja Jul 17 '21 at 16:27
  • Currently version 10.2.0 is installed and it is installed on termux with proot. – Max Ivan Jul 17 '21 at 16:37

1 Answers1

0

In short, this error occurs due to the fact that libraries of type libc were not in the common directory. These libraries:

-rwxr-xr-x 1 10504 10504 1827624 Aug  4 16:27 /lib/conlib/libc-2.32.so
-rw-r--r-- 1 10504 10504 4592750 Aug  4 16:27 /lib/conlib/libc.a
-rw-r--r-- 1 10504 10504     351 Aug  4 16:27 /lib/conlib/libc.so
lrwxrwxrwx 1 10504 10504      18 Aug  4 16:27 /lib/conlib/libc.so.6 -> libc-2.32.so
-rw-r--r-- 1 10504 10504   24964 Aug  4 16:27 /lib/conlib/libc_nonshared.a
Max Ivan
  • 16
  • 1
  • 3