Search notes:

libc: building a test version

GLIBC_ROOT=~/glibc
GLIBC_BUILD=$GLIBC_ROOT.build
GLIBC_INST=$GLIBC_ROOT.inst
GLIBC_TEST=$GLIBC_ROOT.test

mkdir $GLIBC_BUILD
cd    $GLIBC_BUILD

$GLIBC_ROOT/configure --prefix=$GLIBC_INST

make 
make install

cd $GLIBC_TEST

gcc                                         \
  -nostdinc                                 \
  -I$GLIBC_INST/include                     \
  -I$(gcc --print-file-name=include)        \
  -nostdlib                                 \
  -nostartfiles                             \
  -o foo                                    \
   $GLIBC_INST/lib/crt1.o                   \
   $GLIBC_INST/lib/crti.o                   \
 $(gcc  --print-file-name=crtbegin.o)       \
   foo.c                                    \
  $GLIBC_INST/lib/libc.so.6                 \
  $GLIBC_INST/lib/libc_nonshared.a          \
 $(gcc  --print-file-name=crtend.o)         \
  $GLIBC_INST/lib/crtn.o

export LD_LIBRARY_PATH=$GLIBC_INST/lib
foo.c:
#include <stdio.h>
int main() {

  printf("This is a %s, the number is %d\n", "test", 42);

  return 0;
}
Before running the executable, LD_LIBRARY_PATH must be set:
export LD_LIBRARY_PATH=$GLIBC_INST/lib

See also

gcc -nostartfiles, gcc -nostdlib
The Standard C Library

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758200821, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/C-C-plus-plus/C/libc/building-test-version(83): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78