Projekt

Allgemein

Profil

Aktionen

Sysroot

Use bookworm container to have an non-matching glibc.

#include <stdio.h>

int main()
{
    int x=0x100;

    printf("Hello world!\n");
    sscanf("0b10", "%i", &x);
    return(1);
}

gcc ./hello.cpp -o hello --sysroot=$PWD -Wl,--sysroot=$PWD -Wl,--dynamic-linker=/lib/ld-linux-x86-64.so.2
/usr/bin/ld: /tmp/ccsAfE04.o: in function `main':
hello.cpp:(.text+0x3f): undefined reference to `__isoc23_sscanf'
collect2: error: ld returned 1 exit status
gcc ./hello.cpp -o hello --sysroot=$PWD -Wl,--sysroot=$PWD -B${PWD}/usr/lib/x86_64-linux-gnu -Wl,--dynamic-linker=/lib/ld-linux-x86-64.so.2

Von Maximilian Seesslen vor etwa 1 Stunde aktualisiert · 1 Revisionen