Questions tagged [libc]

The C standard library consists of a set of sections of the ISO C standard which describe a collection of headers and library routines used to implement common operations, such as input/output and string handling, in the C programming language.

The C standard library consists of a set of sections of the ISO C standard which describe a collection of headers and library routines used to implement common operations, such as input/output and string handling, in the C programming language.

There are many implementations of libc with different resource requirements, security goals, etc. With a typical tool chain the libc, compiler and OS work together to achieve some ISO, Posix or custom features/standards. Some libc implementation are only a subset of the ISO standard, but still full featured enough to be used in many applications.

Specific libc tags:

  • - the full Gnu Libc found on most GCC installs.
  • - a smaller micro-controller libc for resource constrained devices
  • - Android libc
  • - unhosted libc
  • - more modern lighter foot print libc

Websites

See also:

Do not confuse with , which is for the C++ programming language.

1076 questions
17
votes
12 answers

Get the time zone GMT offset in C

I'm using the standard mktime function to turn a struct tm into an epoch time value. The tm fields are populated locally, and I need to get the epoch time as GMT. tm has a gmtoff field to allow you to set the local GMT offset in seconds for just…
friedo
  • 65,762
  • 16
  • 114
  • 184
16
votes
2 answers

Understanding the gcc version and the GLIBC, GLIBCXX versions in more detail

Assume I have the following local gcc, g++ version: $ gcc -v $ g++ -v gcc version 6.3.1 I don't understanding the relation and meaning of the following compared to my compiler version: What is this referring to? /usr/lib64/libstdc++.so.6 Trying…
josh
  • 161
  • 1
  • 1
  • 3
16
votes
3 answers

Go build with another glibc

I have installed another version of GLIBC and want to compile Golang code against this new GLIBC. I have tried the following command for dynamic compilation: go build --ldflags '-linkmode external -L /path/to/another_glibc/ But when I run ldd…
bitbyter
  • 801
  • 1
  • 8
  • 17
16
votes
2 answers

version GLIBC_PRIVATE not defined in file ld-linux-x86-64.so.2

if anyone could give a beginner some help on gcc version issue? I met the issue on "version GLIBCXX_3.4.20' not found". After I followed the link: How to Install gcc 5.3 with yum on CentOS 7.2? I met extra issues as below: scl enable devtoolset-7…
vicky
  • 161
  • 1
  • 1
  • 4
16
votes
4 answers

fgets() function in C

I know everybody has told me to use fgets and not gets because of buffer overflow. However, I am a bit confused about the third parameter in fgets(). As I understand it, fgets is dependent on: char * fgets ( char * str, int num, FILE * stream…
emily
  • 161
  • 1
  • 1
  • 3
16
votes
4 answers

glibc - #define void

I started to look into glibc (GNU Libc) to understand how it's written. In malloc.c, I found a piece of code as follow: #ifndef void #define void void #endif Can someone please explain to me what this means? Isn't void always defined? Thanks
Orion
  • 544
  • 5
  • 15
15
votes
2 answers

GLIBC_2.7 not found

I am getting the following error when trying to run several executables: /lib/libc.so.6: version `GLIBC_2.7' not found (required by .tools/bridge/bridge) I have recently upgraded from CentOS 5.3 to 5.7 (I am required to run these tools on CentOS 5,…
Claudiu
  • 2,124
  • 4
  • 26
  • 36
15
votes
4 answers

Is there really no mremap in Darwin?

I'm trying to find out how to remap memory-mapped files on a Mac (when I want to expand the available space). I see our friends in the Linux world have mremap but I can find no such function in the headers on my Mac.…
Joe
  • 46,419
  • 33
  • 155
  • 245
14
votes
5 answers

How to tell which interface the socket received the message from?

If a socket is bound to IN6ADDR_ANY or INADDR_ANY and you use a call such as recvfrom() to receive messages on the socket. Is there a way to find out which interface the message came from? In the case of IPv6 link-scope messages, I was hoping that…
readonly
  • 343,444
  • 107
  • 203
  • 205
14
votes
2 answers

How does the libc function isatty() work?

I searched the linux repo and couldn't find a definition for it, so I guess it's something that comes with C or something like that? I'm trying to understand how isatty is able to tell whether a file descriptor is a terminal or not, and what it even…
temporary_user_name
  • 35,956
  • 47
  • 141
  • 220
13
votes
5 answers

Getting GCC to compile without inserting call to memcpy

I'm currently using GCC 4.5.3, compiled for PowerPC 440, and am compiling some code that doesn't require libc. I don't have any direct calls to memcpy(), but the compiler seems to be inserting one during the build. There are linker options like…
Brian
  • 133
  • 1
  • 1
  • 4
13
votes
1 answer

ec2 server postgres error "version `GLIBC_2.14' not found"

While trying to \i create_db.sql psql throws the error: psql:create_db.sql:123: ERROR: could not load library "/usr/lib64/pgsql/plpgsql.so": /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/lib64/pgsql/plpgsql.so) Line 123 of…
Lauren
  • 131
  • 1
  • 3
13
votes
4 answers

I need a list of Async-Signal-Safe Functions from glibc

Non syscall's wrappers but something like snprintf(), dprintf()
vitaly.v.ch
  • 2,485
  • 4
  • 26
  • 36
13
votes
1 answer

Adding a Service to Name Service Switch

So I am trying to add a service to NSS (Name Service Switch). Please note the GNU guide on how to do it here. I have been following that guide. I need to implement a service that works with the passwd database. The problem I am having is my module…
David Mokon Bond
  • 1,576
  • 2
  • 18
  • 42
12
votes
2 answers

Where is stdarg.h?

On my system (Mac OS 10.6) /usr/include/stdarg.h is: /* This file is public domain. */ /* GCC uses its own copy of this header */ #if defined(__GNUC__) #include_next #elif defined(__MWERKS__) #include "mw_stdarg.h" #else #error "This…
sidyll
  • 57,726
  • 14
  • 108
  • 151