Sysroot » Historie » Version 1
Maximilian Seesslen, 15.10.2026 18:49
| 1 | 1 | Maximilian Seesslen | h1. Sysroot |
|---|---|---|---|
| 2 | |||
| 3 | Use bookworm container to have an non-matching glibc. |
||
| 4 | |||
| 5 | <pre><code class="c"> |
||
| 6 | #include <stdio.h> |
||
| 7 | |||
| 8 | int main() |
||
| 9 | { |
||
| 10 | int x=0x100; |
||
| 11 | |||
| 12 | printf("Hello world!\n"); |
||
| 13 | sscanf("0b10", "%i", &x); |
||
| 14 | return(1); |
||
| 15 | } |
||
| 16 | |||
| 17 | </code></pre> |
||
| 18 | |||
| 19 | <pre> |
||
| 20 | gcc ./hello.cpp -o hello --sysroot=$PWD -Wl,--sysroot=$PWD -Wl,--dynamic-linker=/lib/ld-linux-x86-64.so.2 |
||
| 21 | /usr/bin/ld: /tmp/ccsAfE04.o: in function `main': |
||
| 22 | hello.cpp:(.text+0x3f): undefined reference to `__isoc23_sscanf' |
||
| 23 | collect2: error: ld returned 1 exit status |
||
| 24 | 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 |
||
| 25 | </pre> |