How to build a statically linked executable, before i loose my mind

ryuukk_ ryuukk.dev at gmail.com
Sat Jul 13 17:06:26 UTC 2024


On Saturday, 13 July 2024 at 16:44:22 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
> On 14/07/2024 4:37 AM, ryuukk_ wrote:
>> On Saturday, 13 July 2024 at 16:16:20 UTC, Richard (Rikki) 
>> Andrew Cattermole wrote:
>>> Seeing ``_d_arraybounds_slice`` missing sounds like druntime 
>>> isn't being linked against.
>>>
>>> It is possible that your distribution of ldc doesn't include 
>>> a static build of druntime/phobos. You need to verify that ld 
>>> is trying to link against a static build and that static 
>>> build exists.
>> 
>> `curl -fsS https://dlang.org/install.sh | bash -s ldc`
>
> Okay yup, looks like its all there in latest release.
>
> Have to dump out what ld is getting passed to it, and what it 
> thinks it is doing next.


```
/usr/bin/ld -plugin 
/usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so 
-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper 
-plugin-opt=-fresolution=/tmp/ccBV7TjM.res 
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s 
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc 
-plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m 
elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker 
/lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o bin/dls 
/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/home/runner/dlang/ldc-1.39.0/bin/../lib -L/home/runner/dlang/ldc-1.39.0/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/home/runner/dlang/ldc-1.39.0/lib -L/usr/lib/gcc/x
```


https://github.com/ryuukk/dls/actions/runs/9921536908/job/27409615370


It works locally, but not their machine, ubuntu apparently


More information about the Digitalmars-d-learn mailing list